renewed \ProcessOptions*
Linas Stonys
lstonys at vtex.lt
Thu Nov 23 22:28:31 CET 2023
Hi,
I noticed that \ProcessOptions* acts different in TL2019 and TL2023. In
older Tl if option is global (used in \documentclass)
then inside package it only evaluate that option if it declared inside
package. Now the behavior is changed. If you declare
option in style file and do not use \ProcessOptions then these options
will be processed in other package (in next \ProcessOptions* ).
For example I use same options for many classes and I put them in
separate style file (*myoptions.sty*) an load it in the class with .
There is only one option
\DeclareOption{showbug}{\AtEndOfClass{\IamBug}}
and in the class file I add
\let\IamBug\empty
so I expect to compile normally but with TL2023 I'll get "\IamBug
undefined error" because showbug option
will be executed not in class but in the inside class I loaded package
(*simplepackage.sty*)
HERE is the \ProcessOptions* responsible macro
\def\@xprocess at ptions{%
\ifx\@currext\@clsextension\else
\ifx\@classoptionslist\relax\else
\@for\CurrentOption:=\@classoptionslist\do{%
\ifx\CurrentOption\@empty\else
% *\@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}%
TL2019 was this*
*\@ifundefined{ds@\detokenize\expandafter{\CurrentOption}}{}{% % TL2023 *
\@use at ption
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty
}%
\fi}%
\fi
\fi
*
*Wasn*'*t*\@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}
*good enough to test is global option in current packages options?
*
*Here is min example files
*
myclass.tex*
\documentclass[showbug]{myclass}
\begin{document}
aa
\end{document}
*myclass.cls*
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[]
\RequirePackage{myoptions}
%\input myoptions.sty
\ProcessOptions
\RequirePackage{simplepackage}
\def\normalsize{}
\let\IamBug\empty
\endinput
*
myoptions.sty
*\ProvidesPackage{myoptions}[]
\DeclareOption{showbug}{\AtEndOfClass{\IamBug}}
\endinput
*
simplepackage.sty*
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{simplepackage}[]
\DeclareOption{opt2}{\dnothing}
\expandafter\show\csname simplepackage.sty-h@@k\endcsname % here it
shows ->.
\ProcessOptions*\relax
\expandafter\show\csname simplepackage.sty-h@@k\endcsname % here it
shows ->\IamBug \expandafter \let \csname unprocessedoptions-\@currname
.\@currext \endcsname \relax .
\endinput
Is it a bug in \ProcessOptions* and it will be changed to previous version?
Thanks,
Linas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20231123/ec6d622d/attachment.htm>
More information about the tex-live
mailing list.