oetiker / acronym

LaTeX Acronym Package
9 stars 11 forks source link

Full name never printed if first usage is within \caption #6

Open kirchhof opened 6 years ago

kirchhof commented 6 years ago

If an acronym is first mentioned in a caption, then the full name of that acronym will never be printed. Neither in the caption nor in the text.

Minimal working example:

\documentclass[12pt]{article}

\usepackage{acronym}

\acrodef{FSK}{Frequency-Shift Keying}

\begin{document}

\begin{figure}[t]
\caption{Here, the acronym is mentioned in a caption before it appears in text \ac{FSK}.}
\end{figure}

\noindent
This is the first usage of the acronym in text \ac{FSK}.

\end{document}

The expected output for that example is:

Figure 1: Here, we mention the acronym in a caption before it appears in text FSK.
This is the first usage of the acronym in text Frequency-Shift Keying (FSK).

The actual output for that example:

Figure 1: Here, we mention the acronym in a caption before it appears in text FSK.
This is the first usage of the acronym in text FSK.

If the figure definition is moved below the text line, the acronym's full name is printed correctly.

oetiker commented 6 years ago

The acronym gets expanded inside the list of figures which is processed first ... even when you do not print it ... (\listoffigures) ... it is not immediately clear to me how this could be taken care of automatically.

But there are workarounds as suggested by Heiko Oberdiek:

Keep in mind that figures and tables are usually floating objects, where the final placement in the typeset document can be before or after the corresponding position in the source file. Therefore, I would not use \ac inside captions.

Instead, \acs{...} can be used to force the short form to keep the caption titles short. Or `\acf*{...}' can be used to get the full form to always provide the explanation of the acronym. The star prevents that the acronym is marked as used.

If you want to have a different behaviour for the list of figures, use the optional argument of \caption.