I have the following:
\newif\ifabrvused
\abrvusedfalse
\def\abrv#1#2{%
\ifabrvused\else%
\newwrite\@loa%
\immediate\openout\@loa=\jobname.loa%
\write0{ Test}
\abrvusedtrue%
\fi%
\@ifundefined{abrv@#1}{%
\expandafter\def\csname abrv@#1\endcsname{#2}%
\immediate\write\@loa{\unexpanded{\item[\textbf{#1}]#2}}%
{#2 (\textbf{#1})}%
}{%
{\textbf{#1}}%
}%
}
The intention is that the first time its called it opens the aux file for writing.
My problem is, that the open part (ifabrvused\else) is getting called twice. I was able to find out that its getting called for the first use within my begin{abstract} and the rest of the document? What am I missing. If its intended to do so, how can i code around it?