4

I am using the command gls to create a glossary at the beginning of my thesis. However if I use the command for example in the caption of a figure environment, then the only time the full text together with its acronym appears only in the list of figures.

This then entails that the first time I use gls for a term in the main body of the thesis, only the acronym appears in the compiled version....

Is there a way to get around this issue??

3

3 Answers 3

6

I've found this to be the quickest solution for me:

\begin{document}
[...]
\glsunsetall
\listoffigures
\listoftables
\glsresetall
[...]
\end{document}

The commands \glsunsetall and \glsresetall have the function to set or reset the so-called first use flag. With the sequence I've written, acronyms in the LoF and LoT are in the short form. Then, thanks to \glsresetall, they are displayed correctly in the text (first use first, and then the short form).

2

assuming you have something like this:

\newacronym{ex}{EX}{Example X}

You can use \caption[ex]{\gls{ex}}. This way, the actual caption shown in List of Figures doesn't invoke glossaries.

2

In addition to the suggestion in the other answer, you can use \glsentryshort instead of \gls in the caption:

\caption{An example \glsentryshort{sample}}

Another option is to use the extension package glossaries-extra which provides commands like \glsfmtshort which are designed to work in captions and section headings. This has the advantage over \glsentryshort in that it includes the font change for styles that set the abbreviation in a particular font. For example:

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short-sc}
\newacronym{sample}{short-form}{long-form}

\begin{document}
\listoffigures

\chapter{Sample}
First use: \gls{sample}.

Next use: \gls{sample}.

\begin{figure}
\centering
Insert figure here.
\caption{An example \glsfmtshort{sample}}
\end{figure}

\printglossaries

\end{document}

If you prefer the long form, you can use \glsfmtlong instead, or the full form with \glsfmtfull.

You must log in to answer this question.

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