TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following:


    \write0{    Test}

    \expandafter\def\csname abrv@#1\endcsname{#2}%
    {#2 (\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?

share|improve this question
up vote 3 down vote accepted

Inside the environment abstract you are inside a group. \abrvusedtrue is a local assignment (\let\ifabrvused\iftrue). The switch is reset to false after the environment. Use \global\abrvusedtrue instead.

share|improve this answer
Thanks it works. Just noticed how the line '{#2 (\textbf{#1})}%' always starts a newline before writing the text. Happen to know why? – Poul K. Sørensen Jan 13 '13 at 18:57
@s093294 You have an empty line in your definition that causes the end of the previous paragraph. – Heiko Oberdiek Jan 13 '13 at 20:12
\@ifundefined{abrv@#1}{% do not seem to work. Its written to aux file for both abstract and and document. I assume its the same problem, just dont know where to tell it to use global for that – Poul K. Sørensen Jan 26 '13 at 0:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.