# Bug Tracker

ID 150🔗 Nicola Talbot 🦜 2020-02-11 18:36:19 Closed (Fixed) glossaries-extra 1.41 \glsentry... commands in section headings causes an error with undefaction=warn (or record) option

## Description

When an entry is undefined, commands like \glsentryname expand to \csname ...\endcsname forms. This can lead to undefined commands in the table of contents (toc) or list of figures/tables (lof/lot) files.
! Undefined control sequence.
<write> ...protect \numberline {1}\glo@lorem@name
}{\thepage }\protected@fil...

This isn't an issue with the base glossaries package as it doesn't allow the referencing of undefined entries, and so isn't considered a bug with just glossaries.sty.

With glossaries-extra, the undefaction=warn package option (which is automatically implemented by the record option) allows for the referencing of undefined commands that trigger warnings rather than errors. This is essential with bib2gls as the entries are never defined on the first LaTeX call in the build process.

The glossaries-extra package does actually provide commands that are specifically designed for the use in captions and section headers (\glsfmtname etc) so these should typically be used rather than \glsentry.... However, with undefaction=warn the package should gracefully allow \glsentry... in captions and section headings if there's some particular reason to use them over the equivalent \glsfmt....

## MWE

\documentclass{article}

\usepackage[record]{glossaries-extra}

\begin{document}
\section{\glsentryname{lorem}}

\Gls{lorem}.

\printunsrtglossaries
\end{document}


## Evaluation

Fixed in v1.42.

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.