Closed u-fischer closed 5 months ago
This issue has been automatically marked as stale because it has not had recent activity.
Sorry to be "that guy", but this broke font packages that conditionally require other packages based on package options (e.g., notomath
). Is this known, and are there mitigation strategies?
@clason do you have an example where notomath breaks? I don't see a package loaded in a group there.
Sure, give me a minute to extract the issue (it happens in a beamer theme).
\documentclass{article}
\usepackage[sfdefault]{notomath}
\begin{document}
Test
\end{document}
The sfdefault
option is what triggers the error:
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./style.tex
LaTeX2e <2024-06-01>
L3 programming layer <2024-05-08>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/02/08 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/notomath/notomath.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2024/texmf-dist/tex/latex/fontaxes/fontaxes.sty)
(/usr/local/texlive/2024/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2024/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2024/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2024/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)
! LaTeX Error: Loading a class or package in a group.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.67 \usepackage
{noto-serif}
Just ignoring that recurses and throws further (identical) errors there about packages required in noto-serif.sty
(and packages required by those packages, and so on -- elephants all the way down).
(Let me know if I should open a new issue.)
Seems to be this line in notomath.sty
that is the culprit:
\ifnoto@sfdefault{\noto@MO{notosans}\else\noto@MO{noto}\fi
(which is defined by \newif\ifnoto@sfdefault \noto@sfdefaultfalse
).
I don't quite see why, but commenting it out removes the error. (Voodoo debugging at its finest!)
Oh, of course, that's a typo (missing brace closing the first clause). 🤦
Thanks for rubber-ducking, and sorry for wasting your time! Looks like this PR is doing its work already ;) I'll notify the maintainer.
well that is a clear bug in the package. The stray brace after \ifnoto@sfdefault
shouldn't be there at all, and in earlier versions it would have lead to ### simple group (level 1) entered at line 54 ({)
. Notify the author.
Brief outline of the bug
Packages should not be loaded in a group as this can lead to misbeheaviour that can be hard to detect or understand. As an example hyperref fails with an internal socket error if a group has been opened by mistake: https://github.com/latex3/hyperref/issues/315.
\usepackage and \RequirePackage should check the group level and error directly.