Skip to content

Commit 482259d

Browse files
committed
Add options to unused list when unknown key is active
1 parent 19b1327 commit 482259d

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

base/changes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
66
not part of the distribution.
77
================================================================================
88

9+
2025-02-22 Joseph Wright <[email protected]>
10+
* ltkeys.dtx:
11+
Correct addition to unused option list with unknown key property (gh/1183)
12+
913
2025-02-21 Ulrike Fischer <[email protected]>
1014
* lttagging.dtx: move declaration of marginpar sockets from latex-lab into lttagging.
1115

base/ltkeys.dtx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
%<*driver>
3434
% \fi
3535
\ProvidesFile{ltkeys.dtx}
36-
[2025/02/18 v1.0p LaTeX Kernel (Keyval options)]
36+
[2025/02/22 v1.0q LaTeX Kernel (Keyval options)]
3737
% \iffalse
3838
\documentclass{l3doc}
3939
\GetFileInfo{ltkeys.dtx}
@@ -368,6 +368,8 @@
368368
% \changes{v1.0h}{2022/06/20}{Use raw options data}
369369
% \changes{v1.0m}{2024/01/13}{Trim spaces off key names}
370370
% \changes{v1.0n}{2024/06/19}{Refactor function}
371+
% \changes{v1.0q}{2025/02/22}
372+
% {Correct unused option tracking where unknown keys are allowed}
371373
% \begin{macro}{\@@_options_class:nnn}
372374
% \changes{v1.0h}{2022/06/20}{New function}
373375
% \changes{v1.0i}{2022/07/05}{Correct naming of raw class options storage}
@@ -394,7 +396,7 @@
394396
{
395397
\exp_args:Ne \@@_options_class:nnn
396398
{ \tl_trim_spaces:e { \@@_remove_equals:n {##1} } }
397-
{##1} {#1}
399+
{##1} {#1}
398400
}
399401
}
400402
}
@@ -407,7 +409,7 @@
407409
}
408410
{
409411
\keys_if_exist:nnTF {#3} { unknown }
410-
{ \@@_options_class:nn {#1} {#2} }
412+
{ \clist_put_right:Nn \l_@@_options_clist {#2} }
411413
{
412414
\clist_if_in:NnF \@unusedoptionlist {#1}
413415
{ \clist_put_right:Nn \@unusedoptionlist {#1} }

base/testfiles/github-1183.lvt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
\input{test2e}
2+
3+
\begin{filecontents}[overwrite]{github-1183.cls}
4+
\NeedsTeXFormat{LaTeX2e}
5+
\ProvidesClass{github-1183}
6+
\LoadClassWithOptions{article}
7+
8+
\DeclareKeys[testwork]{%
9+
test .code = \newcommand{\foo}{#1},
10+
test .usage = load,
11+
% the following three lines give an equivalent definition of your bertha
12+
% option as defined with `\DeclareOption{bertha}{}`
13+
bertha .code = {},
14+
bertha .value_forbidden:n = true,
15+
bertha .usage = load,
16+
% if you use this unknown handler, you get "test" and "bertha" as unknown
17+
% options, if you omit it you get "a4paper" as unknown option
18+
unknown .code = {}
19+
}
20+
\ProcessKeyOptions[testwork]
21+
22+
\endinput
23+
\end{filecontents}
24+
\documentclass[a4paper,test=wtf,bertha]{github-1183}
25+
26+
\START
27+
\begin{document}
28+
\END

base/testfiles/github-1183.tlg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This is a generated file for the LaTeX2e validation system.
2+
Don't change this file in any respect.
3+
(github-1183.aux)
4+
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
5+
LaTeX Font Info: ... okay on input line ....
6+
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
7+
LaTeX Font Info: ... okay on input line ....
8+
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line ....
9+
LaTeX Font Info: ... okay on input line ....
10+
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line ....
11+
LaTeX Font Info: ... okay on input line ....
12+
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line ....
13+
LaTeX Font Info: ... okay on input line ....
14+
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line ....
15+
LaTeX Font Info: ... okay on input line ....
16+
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
17+
LaTeX Font Info: ... okay on input line ....

0 commit comments

Comments
 (0)