Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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

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

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.

share|improve this answer
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
add comment

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.

share|improve this answer
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
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.