[Tex/LaTex] How to print all the acronyms

acronymsglossaries

In my figures I used some acronyms (i.e. embedded in the figures, not readable by LaTeX). I included all the acronyms in a file. LaTeX only printed the acronyms appeared in the text, and ignored other acronyms I included. How to make LaTeX print all the acronyms? Thanks!

Update: In addition, I don't want the pages where the acronyms appear to be shown. Because LaTeX could not read the acronyms in the figures, for those figure-embedded acronyms, there would be no page displayed next to them. It would appear inconsistent: some acronyms with pages next to them and some without. Therefore, I don't want the pages where the acronyms appear to be shown.

Best Answer

There are various methods. First is to use nonumberlist (either as a package option or in \printglossary) in combination with \glsaddall (which must be used after all acronyms have been defined).

For example:

\documentclass{article}

\usepackage{graphics}
\usepackage[acronym,nonumberlist]{glossaries}

\makeglossaries

\newacronym{ac1}{ac1}{acronym 1}
\newacronym{ac2}{ac2}{acronym 1}

\glsaddall

\begin{document}
\gls{ac1}.

\begin{figure}
\centering
\includegraphics{example-image}
\caption{A Figure}
\end{figure}

\printglossaries
\end{document}

This omits all page numbers and includes all entries.

The second method doesn't use nonumberlist or \glsaddall but instead uses \glsaddallunused. This command must go at the end of the document:

\documentclass{article}

\usepackage{graphics}
\usepackage[acronym]{glossaries}

\makeglossaries

\newacronym{ac1}{ac1}{acronym 1}
\newacronym{ac2}{ac2}{acronym 1}

\begin{document}
\gls{ac1}.

\begin{figure}
\centering
\includegraphics{example-image}
\caption{A Figure}
\end{figure}

\printglossaries

\glsaddallunused

\end{document}

This displays the page list for ac1 which has been used in the document, but not for ac2.

For the third method, let's suppose ac2 is displayed in the image. Instead of using \glsaddallused, you can index ac2 next to the image. Like this:

\documentclass{article}

\usepackage{graphics}
\usepackage[acronym]{glossaries}

\makeglossaries

\newacronym{ac1}{ac1}{acronym 1}
\newacronym{ac2}{ac2}{acronym 1}

\begin{document}
\gls{ac1}.

\begin{figure}
\centering
\includegraphics{example-image}\glsadd{ac2}
\caption{A Figure}
\end{figure}

\printglossaries

\end{document}

This doesn't display any text next to the image, but it does index ac2, which means that ac2 now appears in the acronym list with the page number on which the image appears.