Bug Tracker RSS feed

One or more errors has occurred:

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 171🔗
Date: 2021-01-06 14:25:19
Last update: 2022-10-19 19:57:17
Status Closed (Fixed)
Category glossaries-extra
Version 1.45
Summary glossaries-extra does not recognise glossaries commands

Sign in to subscribe to notifications about this report.

Description

In my thesis I use this package to create a list of symbols/nomenclature. Without the glossaries package and only using glossaries-extra everything is fine, however when adding the former TeX returns
 TeX capacity exceeded, sorry [parameter stack size=10000]. \RequirePackage. 
In the documentation it is stated that glossaries-extra requires glossaries but for some reason it thows an error for me. Removing \usepackage{glossaries} resolves the error. However in this case, commands provided by the package such as \glossarysection are not recognised and thus throws
 Undefined control sequence. \renewcommand*{\glossarysection}[2]
when attempting the following (which should work according to the glossaries-extra manual (page 192)):
\documentclass{article}
\usepackage{glossaries}
\usepackage[symbols,stylemods={tree},record]{glossaries-extra}
\glsxtrsetgrouptitle{latin}{Latin letters}
\GlsXtrLoadResources[
src={numbers.bib},
type=symbols,
group={letters},% assign group label
set-widest,% needed for 'alttree' styles
save-locations=false
]
\begin{document}
\printunsrtglossary[type=symbols,style=alttreegroup,\printunsrtglossaryunitsetup{section}%
    \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}]
\end{document}
I also stated the question over at StackExchange: [Link]

MWE

Download (484B)

\documentclass{article}
\usepackage[symbols,stylemods={tree},record]{glossaries-extra}
\glsxtrsetgrouptitle{latin}{Latin letters}
\GlsXtrLoadResources[
src={numbers.bib},
type=symbols,
group={letters},% assign group label
set-widest,% needed for 'alttree' styles
save-locations=false
]
\begin{document}
	\printunsrtglossary[type=symbols,style=alttreegroup,\printunsrtglossaryunitsetup{section}%
	\renewcommand*{\glossarysection}[2][]{\subsection*{Summary}]
\end{document}

Evaluation

You have some syntax errors in your MWE. The optional argument of \printunsrtglossary should be a key=value list and should not contain commands. The glossaries package is automatically loaded by glossaries-extra and it's best to leave it that way rather than loading glossaries explicitly. So the correct code should be:

\documentclass{article}
\usepackage[symbols,stylemods={tree},record]{glossaries-extra}
\glsxtrsetgrouptitle{latin}{Latin letters}
\GlsXtrLoadResources[
src={example-glossaries-brief},
type=symbols,
group={letters},% assign group label
set-widest,% needed for 'alttree' styles
save-locations=false
]
\begin{document}
\printunsrtglossaryunitsetup{section}%
\renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}

\printunsrtglossary[type=symbols,style=alttreegroup]
\end{document}

However, although this is the recommended approach, it should still be possible to explicitly load glossaries first so I'll investigate.

It seems related to a combination of the symbols and record package options as the following now breaks:

\documentclass{article}
\usepackage{glossaries}
\usepackage[symbols,record]{glossaries-extra}
\begin{document}
Test.
\end{document}

Since this used to work, my guess is that some dependency has changed that is now causing interference.

Update 2021-01-07 13:47 GMT

There seems to be a very specific set of circumstances that triggers this error: glossaries.sty is loaded before glossaries-extra.sty and glossaries-extra.sty is loaded with a mixture of glossaries.sty and glossaries-extra.sty package options where the glossaries.sty options are listed first. So, for example, the following works fine:

\documentclass{article}
\usepackage[symbols,record]{glossaries-extra}
\begin{document}
Test.
\end{document}
as does:
\documentclass{article}
\usepackage[record,symbols]{glossaries-extra}
\begin{document}
Test.
\end{document}
However the following doesn't work:
\documentclass{article}
\usepackage{glossaries}
\usepackage[symbols,record]{glossaries-extra}
\begin{document}
Test.
\end{document}
but switching the options round does work:
\documentclass{article}
\usepackage{glossaries}
\usepackage[symbols,record]{glossaries-extra}
\begin{document}
Test.
\end{document}
So the simplest workaround is to not load glossaries.sty first. If you don't have that option (for example, you are using another package that automatically loads glossaries.sty) then re-order the package options.

For those who want more technical details: the glossaries-extra.sty package defines an internal command \glsxtr@dooption{option} that either does

\setupglossaries{option}
if glossaries.sty has already been loaded or
\PassOptionsToPackage{option}{glossaries}
otherwise. Any options that aren't defined by glossaries-extra.sty are dealt with by the following code:
\DeclareOptionX*{%
 \expandafter\glsxtr@dooption\expandafter{\CurrentOption}}
(where \DeclareOptionX is provided by xkeyval, which in turn loads keyval). The record option is defined in glossaries-extra.sty using \define@choicekey. This means that it shouldn't be picked up by \DeclareOptionX. The symbols option is defined in glossaries.sty so it should be picked up by \DeclareOptionX.

What seems to be happening is that when glossaries.sty is loaded first, both symbols and record are being picked up by \DeclareOptionX (which can be verified by inserting \show\CurrentOption at the start of the \DeclareOptionX) but only when symbols is listed first. The symbols option is processed correctly but the record option (which glossaries.sty doesn't recognise) gets stuck in a loop, which results in the following transcript:

> \CurrentOption=macro:
->symbols.
\XKV@doxs ->\show \CurrentOption
                                 \expandafter \glsxtr@dooption \expandafter ...
l.1637 \RequirePackage
                      {glossaries}
?
> \CurrentOption=macro:
->record.
\XKV@doxs ->\show \CurrentOption
                                 \expandafter \glsxtr@dooption \expandafter ...
l.1637 \RequirePackage
                      {glossaries}
?
[...]
l.1637 \RequirePackage
                      {glossaries}

> \CurrentOption=macro:
->record.
\XKV@doxs ->\show \CurrentOption
                                 \expandafter \glsxtr@dooption \expandafter ...
l.1637 \RequirePackage
                      {glossaries}

! TeX capacity exceeded, sorry [parameter stack size=10000].
\XKV@ifcmd #1#2#3->
                   \def \XKV@@ifcmd ##1#2##2##3\@nil ##4{\def ##4{##2}\ifx #...
l.1637 \RequirePackage
                      {glossaries}
where [...] indicates multiple instances of
> \CurrentOption=macro:
->record.
\XKV@doxs ->\show \CurrentOption
                                 \expandafter \glsxtr@dooption \expandafter ...
l.1637 \RequirePackage
                      {glossaries}

This therefore seems to be an issue with xkeyval or keyval since \DeclareOptionX shouldn't be picking up the record option and it shouldn't be triggering an infinite loop.

Update 2022-10-19: fixed in v1.49 (make sure you also update glossaries and mfirstuc as well).

Comments

2 comments.

🔗Comment from anonymous
Date: 2021-01-08 13:37:00

Hello,

I have investigated this and it seems to be an xkeyval bug. I could reduce the issue to the following (maybe not so minimal) example:

\begin{filecontents}[overwrite,noheader]{glossaries.sty}
\DeclareOptionX{symbols}{\typeout{optionX symbols}}
\ProcessOptionsX
\newcommand*{\setupglossaries}[1]{%
  \setkeys{glossaries.sty}{#1}\relax}
\end{filecontents}

\begin{filecontents}[overwrite,noheader]{glossaries-extra.sty}
% \RequirePackage{xkeyval}
\define@key{glossaries-extra.sty}{record}{\typeout{key record=#1}}
\DeclareOptionX*{%
 \expandafter\setupglossaries\expandafter{\CurrentOption}}
\ProcessOptionsX
\end{filecontents}

\documentclass{article}
\usepackage{glossaries}
% \usepackage[record=a,symbols]{glossaries-extra} % works
\usepackage[symbols,record=a]{glossaries-extra} % breaks
\begin{document}
Test.
\end{document}
What seems to be happening is that when you use the keys [symbols,record] in glossaries-extra.sty, xkeyval changes the key family from glossaries-extra.sty to glossaries.sty (given in the argument to \setupglossaries) in order to execute the symbols option. Then, when executing record, it gets stuck with glossaries.sty and doesn't know that it has to switch back to family glossaries-extra.sty (given implicitly by running \ProcessOptionsX inside glossaries-extra.sty), so it gets stuck in a loop, trying to execute option record (which does exist), but failing to find the right family.

When you use the keys [record,symbols], the family starts as glossaries-extra.sty, the option record is executed, then \setupglossaries changes the family to glossaries.sty and the option symbols gets executed there correctly.

(beware: some parts of the analysis above may be wrong)

I got to work around the problem with the following patch to xkeyval:

\documentclass{article}

% xkeyval patch
\usepackage{xkeyval}
\makeatletter
\def\XKV@t@stoptc#1[#2]#3{%
  \XKV@makepf{#2}%
  \XKV@checksanitizeb{#3}\XKV@resa % <-- new family (glossaries.sty)
  \edef\XKV@resb{%
    \noexpand\XKV@sp@deflist
      \noexpand\XKV@fams{\XKV@resa,\XKV@fams}}% <-- new family + old family (glossaries-extra.sty)
  \XKV@resb
  \@testopt#1{}%
}
\def\XKV@@d@x[#1]{%
  \@ifnextchar<%
    {\XKV@@@d@x[#1]}%
    {\edef\XKV@resa{<\@currname.\@currext>}%
     \expandafter\@swaptwoargs\expandafter
       {\XKV@resa}{\XKV@@@d@x[#1]}}%
}
\def\XKV@t@st@pte#1[#2]{%
  \XKV@makepf{#2}%
  \@ifnextchar<{\XKV@@t@st@pte#1}%
    {\edef\XKV@resa{<\@currname.\@currext>}%
     \expandafter\@swaptwoargs\expandafter
       {\XKV@resa}{\XKV@@t@st@pte#1}}%
}
\makeatother

\usepackage{glossaries}
\usepackage[symbols,record]{glossaries-extra}
\begin{document}
Test.
\end{document}
The important part of the patch is the definition of \XKV@t@stoptc, that adds both the new family (glossaries.sty, from \setkeys{glossaries.sty}) and the old family (glossaries-extra.sty, from \ProcessOptionsX) to the list of families to search (\XKV@fams). The old definition redefined \XKV@fams from scratch, so the old family was lost.

The other two definitions are preemptive corrections to expand \@currname.\@currext before passing it along (it didn't look right to keep them not expanded here).

This seems to fix the problem at hand, but I don't know what changed that this stopped working. It doesn't seem to be related to a change in the LaTeX kernel, but who knows. Unfortunately at the moment I don't have access to an older distribution to check what changed.

Also, if this is indeed a bug in xkeyval, I don't know if the patch is 100% correct. It might cause problems if xkeyval is used by other packages, if it doesn't reset the known families. It might happen that you pass some option to a third package that, if the option happens to have the same name, will take effect on glossaries(-extra).sty.

Replying to Comment #66:

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: 2021-01-08 13:52:00

Thank you very much for your feedback!

Replying to Comment #67:

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=171