Some acronyms created with acro package don't show up in the acronyms list
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}
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 ...
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: