I want to have a macro that behaves differently based on the context. Assume I write a tutorial in X language. A term that I use must be written in X language followed by the corresponding English translation (enclosed and italicized in ()) only when it occurs at the first time. The remaining occurrence will only be written in X language.
I can do it with the following code.
\newif\ifVector
\newcommand{\Vector}{%
\ifVector
vektor%
\else
vektor (\textit{vector})%
\Vectortrue
\fi}
But a new problem arises. How to make the macro change its capitalization when it appears in the beginning of a sentence? Here is my complete dummy code for you.
\documentclass[preview,border=12pt]{standalone}
\newif\ifVector
\newcommand{\Vector}{%
\ifVector
vektor%
\else
vektor (\textit{vector})%
\Vectortrue
\fi}
\begin{document}
\Vector\space isg kush guste vien. Fur sji nam von gis ta marjo
navar \Vector. \Vector\space is fin nom bis kan da dej vanm.
\end{document}

\vectorand\Vectorwith appropriate capitalization in each? – Thruston Sep 13 '13 at 15:28