[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Add \SetKeysOptions (bd738fab)
Joseph Wright
joseph.wright at morningstar2.co.uk
Tue Nov 30 22:21:40 CET 2021
Repository : https://github.com/latex3/latex2e
On branch : options
Link : https://github.com/latex3/latex2e/commit/bd738fab6ef4536bf900ebbb52832f222c4e86de
>---------------------------------------------------------------
commit bd738fab6ef4536bf900ebbb52832f222c4e86de
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Nov 30 21:21:40 2021 +0000
Add \SetKeysOptions
>---------------------------------------------------------------
bd738fab6ef4536bf900ebbb52832f222c4e86de
base/doc/ltnews35.tex | 4 ++++
base/ltkeys.dtx | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index b549114a..d707683b 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -176,6 +176,10 @@ the first time a package is loaded can be marked using the property
\texttt{.usage = load}, and will result in a warning if used in a subsequent
package loading line.
+Package options defined in this way can also be set within a package using
+the new command \cs{SetKeysOptions}, which again takes an optional argument
+to specify the \emph{family}, plus a mandatory one for the options themselves.
+
\subsection{???}
%
\githubissue{???}
diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index 25774143..711cbd6e 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -115,6 +115,16 @@
% classical \cs{ProcessOptions} command).
% \end{function}
%
+% \begin{function}{\SetKeysOptions}
+% \begin{syntax}
+% \cs{SetKeysOptions} \oarg{family} \Arg{keyvals}
+% \end{syntax}
+% Sets (applies) the explict list of \meta{keyvals} for the \emta{family}:
+% it the latter is not given, the value of \cs{@currname} used. This command
+% may be used within a package to set options before or after using
+% \cs{ProcessKeysOptions}/\cs{ProcessKeysPackageOptions}.
+% \end{function}
+%
% \StopEventually{}
%
% \subsection{Implementation of \pkg{ltkeys}}
@@ -434,6 +444,21 @@
}
% \end{macrocode}
%
+% \subsection{General key setting}
+%
+% \begin{macro}{\SetKeysOptions}
+% A simple wrapper.
+% \begin{macrocode}
+\NewDocumentCommand \SetKeysOptions { o +m }
+ {
+ \IfNoValueTF {#1}
+ { \keys_set:Vn \@currname }
+ { \keys_set:nn {#1} }
+ {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
\ExplSyntaxOff
% \end{macrocode}
More information about the latex3-commits
mailing list.