29

I'm using the acronym package to produce a list of abbreviations and acronyms. Now, I want that the full name is printed after every new section and/or chapter. For example:

\acro{PC}{Personal Computer}

The usage would be:

Chapter 1:
\ac{PC} with puts out "Personal Computer (PC)" since its the first usage. For every further usage within this chapter it puts out only "PC".
Chapter 2:
Now \ac{PC} should again print "Personal Computer (PC)" for the first usage and only "PC" for all following. Currently it prints in both cases only "PC".

It would also be nice if there is an option to enable this also for each section.

2
  • 4
    call \acresetall at the beginning of a chapter. Or -- untested -- load the etoolbox package and place \preto\chapter\acresetall in your preamble (or \preto\section\acresetall if you want to reset at each call of \section)
    – cgnieder
    Aug 2, 2013 at 12:31
  • 1
    Thank you! exactly what i was looking for. Unfortunately, I cant vote up your comment. Maybe if you write a complete answer.
    – bonanza
    Aug 2, 2013 at 12:52

1 Answer 1

39

acronym provides \acresetall for resetting the behaviour. After using it each acronym will behave as if it is called for the first time. So just call \acresetall at the beginning of a chapter (or section).

In order to automate this you can load the etoolbox package and place \preto\chapter\acresetall in your preamble (or \preto\section\acresetall if you want to reset at each call of \section):

\documentclass{scrartcl}

\usepackage{acronym}
\newacro{fb}{foo bar}

\usepackage{etoolbox}
\preto\section\acresetall

\begin{document}

\section{foo}
\ac{fb} and \ac{fb}

\section{foo}
\ac{fb} and \ac{fb}

\end{document}

enter image description here

1
  • 1
    This solution results in a warning: Label(s) may have changed. Rerun to get cross-references right by using this with cleveref. Any idea what could be the cause? Cannot reproduce it with your MWE though and my document is so complex that I could not figure out what's causing that issue.
    – Patrick
    May 20, 2020 at 16:58

You must log in to answer this question.

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