6

I am using acro package to make a list of acronyms used throughout the text. When I use the acronym for the first time in a figure's caption, it won't show up in the acronyms list. It stays like that even when I again use the same acronym somewhere else (see CMS in the MWE below). If the acronym is first used before the figure, everything works fine (see ATLAS in the MWE).

The question: How do I make acronyms that first appear in figures' captions appear in the acronym list?

Here's a MWE:

\documentclass[12pt,a4paper]{article}
\usepackage{acro}

\DeclareAcronym{CMS}{short = CMS, long = Compact Muon Solenoid}
\DeclareAcronym{ATLAS}{short = ATLAS, long = A Toroidal LHC ApparatuS}

\begin{document}

\ac{ATLAS} % acronym first used before the figure

\begin{figure}[htb]
  \centering
  \caption{Acronym first used here, in the figure: (\ac{CMS}), the 
           second one was used already (\ac{ATLAS}).}
  \label{fig:label}
\end{figure}

\ac{CMS}\\ % using the acronym again, outside of the figure
\ac{ATLAS}\\
\printacronyms[name=List of acronyms]

\end{document}
  • I'm not sure if this will work, but maybe using \caption[ some text]{ Real caption \ac{thatcoolacronym}} might work I'll check in a minute or ten – Thorbjørn E. K. Christensen Dec 6 '17 at 23:54
  • Unfortunately it doesn't. I skipped that in MWE, but I already use \caption[xyzzy]{real caption} for the list of figures (not to have bibliography quotations for example). – qkurdej Dec 7 '17 at 0:06
5

The problem is the singleline check done by a caption: The caption is stored in a box and measured. As your caption is longer than one line, this box is thrown away and the text is printed as is.

This has two effects: The acronym is marked at used when the box is created and so you get the short acronym in the caption in the second step. And as the box is thrown away nothing is written to the aux-file and so the entry is missing in the list.

The easy way to avoid both problems is to avoid the singleline check with e.g.

   \usepackage[singlelinecheck=false]{caption}

If you don't want this: The first problem can be avoided by adding a reset to the caption, the second by marking the acronyms again as used after the caption. This leads to the following. As you can see it works for both acronyms:

\documentclass[12pt,a4paper]{article}
\usepackage{acro}
%\usepackage[singlelinecheck=false]{caption}
\DeclareAcronym{CMS}{short = CMS, long = Compact Muon Solenoid}
\DeclareAcronym{ATLAS}{short = ATLAS, long = A Toroidal LHC ApparatuS}

\begin{document}

\ac{ATLAS} % acronym first used before the figure


\begin{figure}[htb]
  \centering
  \caption{Acronym first used here, in the figure: 
           (\acifused{CMS}{\ac{CMS}}{\ac{CMS}\acreset{CMS}}), 
           the  second one was used already 
           (\acifused{ATLAS}{\ac{ATLAS}}{\ac{ATLAS}\acreset{ATLAS}}).
           }
           \acuse{CMS}\acuse{ATLAS}
  \label{fig:label}
\end{figure}

\ac{CMS}\\ % using the acronym again, outside of the figure
\ac{ATLAS}\\
\printacronyms[name=List of acronyms]

\end{document}

enter image description here

Side remarks: 1. figures are float objects and not part of the normal reading flow. I would avoid to have the only extended version of an acronym in a caption. 2. The list of figures can change the output again ...

  • That's a great answer! About the side remarks: 1. Of course, I left it like that for the sake of simplicity, I don't mean to use the only extended version in the captions. 2. I don't really understand what you mean by that. – qkurdej Dec 7 '17 at 12:33
  • Regarding 2: If the acronym is transported into the list of figures, the first use will be there. Depending on the wanted output one then need perhaps more resets or the starred versions of the commands. – Ulrike Fischer Dec 7 '17 at 12:38
2

In accordance with section 3.6 of the acro manual. This can be done with the command \acuse{acronym} If you whish to have the long form appear, you can either use \acf{CMS} in the caption, or use it the next time you use the command.

The danger of using \acf{CMS} in the caption is that you might want the first use to be elsehewhere, and then you have to remove the f, the correct way of doing it should be: \acfifused{CMS}{\ac{CMS}}{\acf{CMS}\acuse{CMS}} And I'm pretty sure this is was the normal \ac command does. however the real bugs seems to be with \acifused.

Thus the following:

\documentclass[12pt,a4paper]{article}
\usepackage{acro}

\DeclareAcronym{CMS}{short = CMS, long = Compact Muon Solenoid}
\DeclareAcronym{ATLAS}{short = ATLAS, long = A Toroidal LHC ApparatuS}

\begin{document}

\ac{ATLAS} % acronym first used before the figure

\begin{figure}[htb]
  \centering
  \caption{Acronym first used here, in the figure: (\ac{CMS}\acuse{CMS}), the 
           second one was used already (\ac{ATLAS}).}
  \label{fig:label}
\end{figure}

\ac{CMS}\\ % using the acronym again, outside of the figure
\ac{ATLAS}\\
\printacronyms[name=List of acronyms]

\end{document}

will produce: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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