You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Reporting here because I believe this is ultimately more about \AddToHook than about phase-III of the tagging project.)
This report is about LaTeX2e <2024-11-01> patch level 1 L3 programming layer <2024-12-25>, as well as about LaTeX2e <2025-06-01> pre-release-1 (develop 2025-1-27 branch) L3 programming layer <2025-01-18>.
The following should not compile (yet surprisingly does):
\DocumentMetadata{testphase=phase-III}
\documentclass{report}
\begin{document}
\frontmatter % Why no error? Not defined by "report.cls".
\end{document}
By using phase-III, the various book.cls commands \frontmatter, \mainmatter, \backmatter, \appendix will be defined even when book isn't the document class.
This behavior strikes me as unexpected, although likely benign. Tracing this back a bit, it seems that latex-lab-testphase-sec.sty says things like \AddToHook{cmd/frontmatter/before}{...}, which occurs before it is known which document class will be loaded and thus before it is known whether a particular command like \frontmatter will eventually exist. Of course it is intentional that the hook system allows you to do this kind of thing, to potentially hook packages before it is known whether those packages will be loaded. But if such a hooked package doesn't get loaded, so that there ends up being nothing to hook, should the hook system nonetheless proceed to define things that otherwise wouldn't exist? This strikes me as incorrect, but perhaps the behavior is intentional or unavoidable. For example, I contend the following should not compile:
\AddToHook{cmd/mycommand/before}{tremendous\ }
\documentclass{article}
%\newcommand{\mycommand}{}
\begin{document}
I believe \TeX\ is \mycommand fun. % Undefined command should be an error.
\end{document}
Is this behavior of \AddToHook intentional/unavoidable? In that case, should phase-III do its hooking in a manner that can detect the document class and only hook the particular commands that will be part of the particular document class? (The case I stumbled across seems totally benign, but I imagine there could be some unusual third-party macros that have conditional behavior based on the existence of certain other macros, essentially a strange way of detecting the document class or detecting the presence of certain features, and that conditional behavior would stop working as originally intended.)
The text was updated successfully, but these errors were encountered:
(Reporting here because I believe this is ultimately more about
\AddToHook
than aboutphase-III
of the tagging project.)This report is about LaTeX2e <2024-11-01> patch level 1 L3 programming layer <2024-12-25>, as well as about LaTeX2e <2025-06-01> pre-release-1 (develop 2025-1-27 branch) L3 programming layer <2025-01-18>.
The following should not compile (yet surprisingly does):
By using
phase-III
, the variousbook.cls
commands\frontmatter
,\mainmatter
,\backmatter
,\appendix
will be defined even whenbook
isn't the document class.This behavior strikes me as unexpected, although likely benign. Tracing this back a bit, it seems that
latex-lab-testphase-sec.sty
says things like\AddToHook{cmd/frontmatter/before}{...}
, which occurs before it is known which document class will be loaded and thus before it is known whether a particular command like\frontmatter
will eventually exist. Of course it is intentional that the hook system allows you to do this kind of thing, to potentially hook packages before it is known whether those packages will be loaded. But if such a hooked package doesn't get loaded, so that there ends up being nothing to hook, should the hook system nonetheless proceed to define things that otherwise wouldn't exist? This strikes me as incorrect, but perhaps the behavior is intentional or unavoidable. For example, I contend the following should not compile:Is this behavior of
\AddToHook
intentional/unavoidable? In that case, shouldphase-III
do its hooking in a manner that can detect the document class and only hook the particular commands that will be part of the particular document class? (The case I stumbled across seems totally benign, but I imagine there could be some unusual third-party macros that have conditional behavior based on the existence of certain other macros, essentially a strange way of detecting the document class or detecting the presence of certain features, and that conditional behavior would stop working as originally intended.)The text was updated successfully, but these errors were encountered: