Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

Bug Tracker

ID28
StatusClosed (Fixed)
Categoryglossaries
Version3.06
Summary\Glsentry... doesn't work in arguments of sectionning commands

Report

\Glsentryname, \Glsentrytext, \Glsentryplural give errors in arguments of sectionning commands:
! Undefined control sequence.
\makefirstuc #1->\def \gls@argi

MWE

\listfiles
\documentclass{article}
\usepackage{glossaries}

\newglossaryentry{foo}{%
  name=foo,
  plural=foox,
  description=bar
}

\begin{document}
\section{\glsentryname{foo}}
\section{\glsentrytext{foo}}
\section{\glsentryplural{foo}}
\section{\Glsentryname{foo}}
% \section{\Glsentrytext{foo}}
% \section{\Glsentryplural{foo}}
\end{document}

Evaluation

The commands that uppercase the first letter are fragile and need to be protected in moving arguments.
\documentclass{article}
\usepackage{glossaries}

\newglossaryentry{foo}{%
  name=foo,
  plural=foox,
  description=bar
}

\begin{document}
\section{\glsentryname{foo}}
\section{\glsentrytext{foo}}
\section{\glsentryplural{foo}}
\section{\protect\Glsentryname{foo}}
\section{\protect\Glsentrytext{foo}}
\section{\protect\Glsentryplural{foo}}
\end{document}

Update 2013-10-09

As from version 3.09a (experimental release) these commands are now robust. I'll upload the package to CTAN when it's stabilized.

Update 2013-11-14

I've uploaded glossaries v4.0 to CTAN.

Comment from Stefan
Date: 2013-12-22 16:47:56 CST

Hi Nicola,

just a small note: while your workaround works fine for section (etc.) names, it does not work in the optional argument, e.g. \section[\protect\Glsentryname{foo}]{\acf{foo}}

The new version fixed both problems though, but maybe you wanna comment on the optional arguments for those who can not or don't want to upgrade.

regards, Stefan

Comment from Nicola Talbot
Date: 2013-12-24 12:40 BST

Yes, it's the optional argument of sectioning commands that's the moving argument. If the optional argument isn't used, it's assumed to be the same as the mandatory argument, so for old versions of glossaries you can do \section[\protect\Glsentryname{foo}]{\Glsentryname{foo}} because when the optional argument is used, only the fragile commands in the optional argument need protecting.

Note: if you're using hyperref as well, have a look at I get the message "Token not allowed in a PDF string (PDFDocEncoding)".

Add comment.

Watch This Report

If you would like to be notified whenever updates are made to this report, please fill in your email address in the box below and click on "Notify Me of Changes" button. (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional.)
E mail:
Confirm E mail:
Confirm Bug ID:

To unsubscribe from all notifications use the notifications page.

Comment

You can append a comment to the report using the form below. Comments are checked first before being added. Any spam or offensive content will be removed first according to this site's Terms of Website Use. Please bear in mind that I develop and maintain free software in my spare time. If you want commerical level support then you can hire a TeX consultant.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional. If provided, it will be shown with the comment.)
Confirm Bug ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

Click on the Preview button to preview the message.

Return to list.

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs