| 1 |
%% |
| 2 |
%% This is file `l3keys2e.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% l3keys2e.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2009-2025 The LaTeX Project |
| 10 |
%% |
| 11 |
%% It may be distributed and/or modified under the conditions of |
| 12 |
%% the LaTeX Project Public License (LPPL), either version 1.3c of |
| 13 |
%% this license or (at your option) any later version. The latest |
| 14 |
%% version of this license is in the file: |
| 15 |
%% |
| 16 |
%% http://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
%% This file is part of the "l3packages bundle" (The Work in LPPL) |
| 19 |
%% and all files in that bundle must be distributed together. |
| 20 |
%% |
| 21 |
%% File: l3keys2e.dtx |
| 22 |
\RequirePackage{expl3}[2020/02/08] |
| 23 |
\@ifpackagelater{expl3}{2020/02/08} |
| 24 |
{} |
| 25 |
{% |
| 26 |
\PackageError{l3keys2e}{Support package l3kernel too old} |
| 27 |
{% |
| 28 |
Please install an up to date version of l3kernel\MessageBreak |
| 29 |
using your TeX package manager or from CTAN.\MessageBreak |
| 30 |
\MessageBreak |
| 31 |
Loading l3keys2e will abort!% |
| 32 |
}% |
| 33 |
\endinput |
| 34 |
} |
| 35 |
\ProvidesExplPackage{l3keys2e}{2025-10-09}{} |
| 36 |
{LaTeX2e option processing using LaTeX3 keys} |
| 37 |
\cs_if_exist:NT \ProcessKeysOptions |
| 38 |
{ \file_input_stop: } |
| 39 |
\cs_generate_variant:Nn \clist_put_right:Nn { Nv } |
| 40 |
\cs_generate_variant:Nn \keys_if_exist:nnT { nx } |
| 41 |
\cs_generate_variant:Nn \keys_if_exist:nnTF { nx } |
| 42 |
\clist_new:N \l__keys_latexe_options_clist |
| 43 |
\bool_new:N \l__keys_process_class_bool |
| 44 |
\cs_new_protected:Npn \__keys_latexe_options:n #1 |
| 45 |
{ |
| 46 |
\clist_clear:N \l__keys_latexe_options_clist |
| 47 |
\__keys_latexe_options_global:n {#1} |
| 48 |
\__keys_latexe_options_local: |
| 49 |
\keys_if_exist:nnF {#1} { unknown } |
| 50 |
{ |
| 51 |
\keys_define:nn {#1} |
| 52 |
{ |
| 53 |
unknown .code:n = |
| 54 |
{ |
| 55 |
\msg_error:nnee { keyvalue } { option-unknown } |
| 56 |
{ \l_keys_key_str } { \@currname } |
| 57 |
} |
| 58 |
} |
| 59 |
\AtEndOfPackage |
| 60 |
{ \keys_define:nn {#1} { unknown .undefine: } } |
| 61 |
} |
| 62 |
\clist_map_inline:Nn \l__keys_latexe_options_clist |
| 63 |
{ |
| 64 |
\tl_set:Nn \CurrentOption {##1} |
| 65 |
\keys_set:nn {#1} {##1} |
| 66 |
} |
| 67 |
\AtEndOfPackage { \cs_set_eq:NN \@unprocessedoptions \scan_stop: } |
| 68 |
} |
| 69 |
\cs_new_protected:Npn \__keys_latexe_options_global:n #1 |
| 70 |
{ |
| 71 |
\cs_if_eq:NNF \@classoptionslist \scan_stop: |
| 72 |
{ |
| 73 |
\cs_if_eq:NNTF \@currext \@clsextension |
| 74 |
{ \__keys_latexe_options_class:n {#1} } |
| 75 |
{ |
| 76 |
\bool_if:NT \l__keys_process_class_bool |
| 77 |
{ \__keys_latexe_options_package:n {#1} } |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
\cs_new_protected:Npn \__keys_latexe_options_class:n #1 |
| 82 |
{ |
| 83 |
\cs_if_free:cF { opt@ \@currname . \@currext } |
| 84 |
{ |
| 85 |
\keys_if_exist:nnTF {#1} { unknown } |
| 86 |
{ |
| 87 |
\clist_put_right:Nv \l__keys_latexe_options_clist |
| 88 |
{ opt@ \@currname . \@currext } |
| 89 |
} |
| 90 |
{ |
| 91 |
\clist_map_inline:cn { opt@ \@currname . \@currext } |
| 92 |
{ |
| 93 |
\keys_if_exist:neTF {#1} { \__keys_latexe_remove_equals:n {##1} } |
| 94 |
{ \clist_put_right:Nn \l__keys_latexe_options_clist {##1} } |
| 95 |
{ \clist_put_right:Nn \@unusedoptionlist {##1} } |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
\cs_new_protected:Npn \__keys_latexe_options_package:n #1 |
| 101 |
{ |
| 102 |
\clist_map_inline:Nn \@classoptionslist |
| 103 |
{ |
| 104 |
\keys_if_exist:neT {#1} { \__keys_latexe_remove_equals:n {##1} } |
| 105 |
{ |
| 106 |
\clist_put_right:Nn \l__keys_latexe_options_clist {##1} |
| 107 |
\clist_remove_all:Nn \@unusedoptionlist {##1} |
| 108 |
} |
| 109 |
} |
| 110 |
} |
| 111 |
\cs_new_protected:Npn \__keys_latexe_options_local: |
| 112 |
{ |
| 113 |
\cs_if_eq:NNF \@currext \@clsextension |
| 114 |
{ |
| 115 |
\cs_if_exist:cT { opt@ \@currname . \@currext } |
| 116 |
{ |
| 117 |
\exp_args:NNc \clist_put_right:NV \l__keys_latexe_options_clist |
| 118 |
{ opt@ \@currname . \@currext } |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
\cs_new:Npn \__keys_latexe_remove_equals:n #1 |
| 123 |
{ \__keys_latexe_remove_equals:w #1 = \s__keys_stop } |
| 124 |
\cs_new:Npn \__keys_latexe_remove_equals:w #1 = #2 \s__keys_stop { \exp_not:n {#1} } |
| 125 |
\cs_new_protected:Npn \ProcessKeysOptions #1 |
| 126 |
{ |
| 127 |
\bool_set_true:N \l__keys_process_class_bool |
| 128 |
\__keys_latexe_options:n {#1} |
| 129 |
} |
| 130 |
\cs_new_protected:Npn \ProcessKeysPackageOptions #1 |
| 131 |
{ |
| 132 |
\bool_set_false:N \l__keys_process_class_bool |
| 133 |
\__keys_latexe_options:n {#1} |
| 134 |
} |
| 135 |
\@onlypreamble \ProcessKeysOptions |
| 136 |
\@onlypreamble \ProcessKeysPackageOptions |
| 137 |
\msg_new:nnnn { keyvalue } { option-unknown } |
| 138 |
{ Unknown~option~'#1'~for~package~#2. } |
| 139 |
{ |
| 140 |
LaTeX~has~been~asked~to~set~an~option~called~'#1'~ |
| 141 |
but~the~#2~package~has~not~created~an~option~with~this~name. |
| 142 |
} |
| 143 |
%% |
| 144 |
%% |
| 145 |
%% End of file `l3keys2e.sty'. |