I'm writing a text containing several chapters. In addition, I use about 50 acronyms. Now I would like to expand the acronym in each chapter, but only at its first occurrence. For this, I'm thinking of a macro like

   % if first occurence in chapter
   \emph{#1} (#2}
   % else

The macro describes the command I'm planning to use in my text, e.g., "this is a \acronym{very simple}{VS} example". All acronyms do neither contain white spaces or special characters. In contrast, acronyms are only built of letters.

So I think it is possible with counters, but I have no clue how to start. A counter for each acronym? Or check the sectioning counter?

EDIT: since my package list is already quite long, I would prefer a solution without an additional package. If this is not possible, ok, but normally, there is a way without a package, e.g., use simple tabular and calculate column widths manually.

  • 3
    Why don't you use one of the package meant for this? E.g. acro or (larger) glossaries? May 2, 2014 at 8:46
  • @UlrikeFischer I extended my question
    – strauberry
    May 2, 2014 at 8:47
  • A basic thing is that the first ocurrence of the command redefines itself (something like \gdef\…{#2}) and then the rest of them only the second part would show up. By the way, is \acronym the command you are gonna use in your document, or is it the generator of those commands? In that case you would need another argument which is the command itself.
    – Manuel
    May 2, 2014 at 8:57
  • You will need a dedicated acronym counter which is reset at \chapter: the section counter is not reliable as it is possible that you use your acronym only in the third section. And you additionally need for each acronym some test if it has been used in this chapter. Check the code of acro or acronym to find out how they do this. May 2, 2014 at 9:00
  • Manuel and Ulrike, I would provide a 50 points bounty for a complete code example :-)
    – strauberry
    May 2, 2014 at 9:15

1 Answer 1




   % if first occurence in chapter
   \emph{#2} {#1}
 }{   % else


\chapter{First one}

\MyAcronym{Shakespeare}{An author}

\MyAcronym{Shakespeare}{An author}

\MyAcronym{Shakespeare}{An author}

\chapter{Second chapter}

\MyAcronym{Shakespeare}{An author}


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .