# Glossaries in List of Figures overflow

Given a figure with a caption, in this caption a glossary term in used as in \gls{wysiwyg}

At the document beginning, after the contents, the \listoffigures command is given.

As the caption contains a glossary reference and the list of Figures is the first to be printed before any other contents LaTeX outputs:

...What you see is what you get....

In my specific case, this results in an overflow of the list of figures. For this reason, I would like the gls package to put the short (wysiwyg) in this list.

How to get this done?

-

Make a short form of the caption via \caption[short form]{long form}. The short form will be printed in the LoF, and shall not contain the \gls.

To keep the glossaries machinery (links) for the glossary entry intact, use the short form as follows:

\caption[Short form: \protect\glsunset{wysiwyg}\gls{wysiwyg}\protect\glsreset{wysiwyg}]%
{Long form: \gls{wysiwyg}}

The \glsunset prevents that wysiwyg becomes a first use glossary entry at this point, the \glsreset sets the usage counter back, so that any following use of wysiwyg will be a first use, as far as glossaries is concerned. This way, the LoF entry will have a hyperlink to the glossary (in addition to being a hyperlink to the figure), the LoF is in the location list of the glossary entry, and you get the formatting of the glossary entry in the LoF as desired.

Somewhat simpler is

This will print the name of the glossary entry in the LoF, hyperlinked to the glossary. You lose the formatting that \gls applies, and the LoF won't be in the location list of the glossary entry.

Still simpler is

\caption[Short form: \glsentryname{wysiwyg}]{Long form: \gls{wysiwyg}}

This is like the above version, but the LoF line will now link only to the figure, not to the glossary anymore. This form probably suffices for most use cases. It's just that I like that I can link from a glossary term in the LoF to the glossary, and also applying styles to the appearance of glossary entries via \glsdisplay(first), which is why I prefer the first form.

-
Of course, this will work, but doing so will "delete" the link made in PDF documents to the glossaries list. – significant Feb 7 '13 at 15:01
@mapf It would be easier to just use \glsentryfirst in the optional argument to \caption as that doesn't modify the first use flag and you won't get the list of figures in the location list for that entry. – Nicola Talbot Apr 11 '13 at 15:39

I interpreted figures and tables to be a "moving argument" from the description given here:

CTAN documentation glossariesbegin.pdf

Therefore I use \glsentrytext{} which seems to work.

-
Welcome to TeX.sx! – texenthusiast Apr 11 '13 at 15:24
That link might get dropped at some point. It's better to link to (mirror.ctan.org/macros/latex/contrib/glossaries/…) – Nicola Talbot Apr 11 '13 at 15:37