Latest news 2021-06-05: New blog post: Dickimaw Books Site Account.

Bug Tracker

ID 28🔗
Date: 2013-07-07 05:08:05
Status Closed (Fixed)
Category glossaries
Version 3.06
Summary \Glsentry... doesn't work in arguments of sectioning commands

Sign in to subscribe to notifications about this report.

Description

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

MWE

Download (347B)

\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.

Comments

2 comments.

🔗Comment from Stefan
Date: 2013-12-22 22:47:56

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

Replying to Comment #11:

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

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

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

You can use the Preview button to review your message formatting before submitting.

🔗Comment from Nicola Talbot 🦜
Date: 2013-12-24 12:40:00

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)".

Replying to Comment #12:

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

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

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

You can use the Preview button to review your message formatting before submitting.


Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

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

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

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=28