[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Add \SetKeysOptions (940e7da5)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Jan 12 18:26:46 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : options
Link       : https://github.com/latex3/latex2e/commit/940e7da588e95218dd2ea3ae0655932c37b5a681

>---------------------------------------------------------------

commit 940e7da588e95218dd2ea3ae0655932c37b5a681
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Nov 30 21:21:40 2021 +0000

    Add \SetKeysOptions


>---------------------------------------------------------------

940e7da588e95218dd2ea3ae0655932c37b5a681
 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 cb29f78c..d050b567 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -230,6 +230,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{Floating point and integer calculations}
 
 The L3 programming layer offers expandable commands for calculating
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.