Bug Tracker 
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 returnsTeX 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.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=171
Date: 2021-01-08 13:37:00
Hello,
I have investigated this and it seems to be an
What seems to be happening is that when you use the keysxkeyval
bug. I could reduce the issue to the following (maybe not so minimal) example:[symbols,record]
inglossaries-extra.sty
,xkeyval
changes the key family fromglossaries-extra.sty
toglossaries.sty
(given in the argument to\setupglossaries
) in order to execute thesymbols
option. Then, when executingrecord
, it gets stuck withglossaries.sty
and doesn't know that it has to switch back to familyglossaries-extra.sty
(given implicitly by running\ProcessOptionsX
insideglossaries-extra.sty
), so it gets stuck in a loop, trying to execute optionrecord
(which does exist), but failing to find the right family.When you use the keys
[record,symbols]
, the family starts asglossaries-extra.sty
, the optionrecord
is executed, then\setupglossaries
changes the family toglossaries.sty
and the optionsymbols
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
The important part of the patch is the definition ofxkeyval
:\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 ifxkeyval
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 onglossaries(-extra).sty
.