Skip to content

Commit

Permalink
Merge pull request #1417 from muzimuzhi/fix/gh1238-OptionNotUsed
Browse files Browse the repository at this point in the history
Fix global options with spaces marked by \OptionNotUsed, gh1238
  • Loading branch information
josephwright authored Aug 30, 2024
2 parents b7e148e + e996bcc commit ac625d8
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 3 deletions.
5 changes: 5 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ not part of the distribution.
* lttagging.dtx: (subsection{Paragraph sockets}): A socket and plug to restore paragraph
setting added.

2024-07-23 Yukai Chou <muzimuzhi@gmail.com>

* ltclass.dtx (section{Implementation}):
Trim spaces from unused option added by \OptionNotUsed (gh/1238)

2024-07-13 Ulrike Fischer <Ulrike.Fischer@latex-project.org>
* lttagging.dtx: (subsection{Tagging sockets}): toc-related tagging sockets added.

Expand Down
16 changes: 16 additions & 0 deletions base/doc/ltnews40.tex
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ \subsection*{Fix existence check of document environments}
%
\githubissue{1399}

\subsection{Handling of global keys with spaces}

If the global (class) options contained spaces around key names,
\cs{ProcessKeyOptions} would fail to remove known keys from the
list of unused global options and \cs{OptionNotUsed} would mistakenly
add space-surrounded key names to that list.
These has been corrected as a hotfix in patch level 1 of the November 2023
release (but unfortunately not mentioned in~\cite{40:ltnews38}) and
the current release, respectively.
%
\githubissue{1238}

\subsection{\pkg{doc}:\ \cs{PrintDescribeMacro} in preamble}

In \pkg{doc} version 2 it was possible alter the definition of
Expand Down Expand Up @@ -397,6 +409,10 @@ \subsection{\pkg{longtable}: Extend caption type}
\emph{\LaTeXe{} news 35}. June 2022.
\url{https://latex-project.org/news/latex2e-news/ltnews35.pdf}

\bibitem{40:ltnews38} \LaTeX{} Project Team.
\emph{\LaTeXe{} news 38}. November 2023.
\url{https://latex-project.org/news/latex2e-news/ltnews38.pdf}

\bibitem{40:ltnews39} \LaTeX{} Project Team.
\emph{\LaTeXe{} news 39}. June 2024.
\url{https://latex-project.org/news/latex2e-news/ltnews39.pdf}
Expand Down
4 changes: 3 additions & 1 deletion base/ltclass.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,9 @@
%<latexrelease>\IncludeInRelease{2021/06/01}%
%<latexrelease> {\OptionNotUsed}{filter unused option list}%
%<*2ekernel|latexrelease>
\def\@remove@eq@value#1=#2\@nil{#1}
\ExplSyntaxOn
\def\@remove@eq@value#1=#2\@nil{\tl_trim_spaces:n{#1}}
\ExplSyntaxOff
% \end{macrocode}
%
% \begin{macrocode}
Expand Down
32 changes: 32 additions & 0 deletions base/testfiles-1run/github-1238b.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
\input{test2e}
\START
\AUTHOR{Yukai Chou}

\OMIT

\begin{filecontents}[force]{\jobname.cls}
\DeclareKeys{
foo .store = \myfoo,
bar .store = \mybar,
baz .code = \OptionNotUsed,
baz .pass-to-packages = true
}
\ProcessKeyOptions
\end{filecontents}

\begin{filecontents}[force]{\jobname.sty}
\DeclareKeys{
baz .store = \mybaz
}
\ProcessKeyOptions
\end{filecontents}

\TIMO

\typeout{"\@unusedoptionlist"}
\documentclass[foo =foo, bar=bar, baz =baz]{\jobname}
\typeout{"\@unusedoptionlist"} % should be "baz"
\usepackage{\jobname}
\typeout{"\@unusedoptionlist"} % should be empty

\END
8 changes: 8 additions & 0 deletions base/testfiles-1run/github-1238b.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
Author: Yukai Chou
""
(github-1238b.cls)
"baz"
(github-1238b.sty)
""
4 changes: 2 additions & 2 deletions base/update-rollback-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ l3build save -epdftex,xetex,luatex \
tlb-latexrelease-rollback-2023-06-01 \
tlb-latexrelease-rollback-2023-11-01 \
tlb-latexrelease-rollback-2024-06-01 \
tlb-latexrelease-rollback-2024-11-01 \
tlb-latexrelease-rollback-003-often \
tlb-rollback-004-often \
tlb-rollback-005 \
github-0479-often

l3build save \
tlb-latexrelease-rollback-2023-06-01
tlb-latexrelease-rollback-2023-06-01 \
tlb-latexrelease-rollback-2024-11-01

l3build save -c config-lthooks \
lthooks-rollback-args
Expand Down

0 comments on commit ac625d8

Please sign in to comment.