[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Correct functioning of preamble-only options (cae0723b)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Jan 12 18:27:10 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : options
Link : https://github.com/latex3/latex2e/commit/cae0723bc4025232e5cd7c0d241cbc3692813e7a
>---------------------------------------------------------------
commit cae0723bc4025232e5cd7c0d241cbc3692813e7a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed Dec 1 14:32:55 2021 +0000
Correct functioning of preamble-only options
>---------------------------------------------------------------
cae0723bc4025232e5cd7c0d241cbc3692813e7a
base/ltkeys.dtx | 4 ++--
base/testfiles/github-0710.lvt | 17 ++++++++++++++--
base/testfiles/github-0710.tlg | 46 +++++++++++++++++++++++++++++++-----------
3 files changed, 51 insertions(+), 16 deletions(-)
diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index 2003d352..ddc08919 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -425,9 +425,9 @@
{
\prop_map_inline:Nn \l_keys_usage_preamble_prop
{
- \clist_map_inline:nn {#1}
+ \clist_map_inline:nn {#2}
{
- \keys_set:nn {#1}
+ \keys_define:nn {#1}
{
##1 .code:n =
\msg_error:nnn { keys } { preamble-only } {##1}
diff --git a/base/testfiles/github-0710.lvt b/base/testfiles/github-0710.lvt
index 88c96d4b..8870549f 100644
--- a/base/testfiles/github-0710.lvt
+++ b/base/testfiles/github-0710.lvt
@@ -5,12 +5,14 @@
load-option-A .usage = load ,
load-option-B .store = \my at B ,
load-option-B .usage = load ,
- general-option-C .store = \my at C
+ general-option-C .store = \my at C ,
+ preamble-option-D .store = \my at D ,
+ preamble-option-D .usage = preamble
}
\ProcessKeysOptions
\newcommand\mypkgtest{%
\begingroup
- \edef\x{\my at A:\my at B:\my at C}%
+ \edef\x{\my at A:\my at B:\my at C:\my at D}%
\show\x
\endgroup
}
@@ -32,5 +34,16 @@
\mypkgtest
\SetKeysOptions[mypkg]{load-option-A = 666} % 6
\mypkgtest
+\usepackage[preamble-option-D = 777]{mypkg} % 7
+\mypkgtest
+\SetKeysOptions[mypkg]{preamble-option-D = 888} % 8
+\mypkgtest
+
+\OMIT
+\begin{document}
+\TIMO
+
+\SetKeysOptions[mypkg]{general-option-C = 999, preamble-option-D = 999} % 9
+\mypkgtest
\END
\ No newline at end of file
diff --git a/base/testfiles/github-0710.tlg b/base/testfiles/github-0710.tlg
index b205d3b3..bf6b73c8 100644
--- a/base/testfiles/github-0710.tlg
+++ b/base/testfiles/github-0710.tlg
@@ -3,34 +3,34 @@ Don't change this file in any respect.
Author: Joseph Wright
(mypkg.sty)
> \x=macro:
-->111::.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111:::.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
LaTeX3 Warning: Package "mypkg" has already been loaded: ignoring load-time
(LaTeX3) option "load-option-A".
> \x=macro:
-->111::.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111:::.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
LaTeX3 Warning: Package "mypkg" has already been loaded: ignoring load-time
(LaTeX3) option "load-option-A".
> \x=macro:
-->111::333.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111::333:.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
> \x=macro:
-->111::333.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111::333:.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
LaTeX3 Warning: Package "mypkg" has already been loaded: ignoring load-time
(LaTeX3) option "load-option-B".
> \x=macro:
-->111::333.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111::333:.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
! LaTeX3 Error: Key "load-option-A" may only be used in the during loading of
@@ -42,7 +42,29 @@ l. ...\SetKeysOptions[mypkg]{load-option-A = 666}
LaTeX was asked to set a key called "load-option-A", but this is only allowed
in the optional argument when loading package "mypkg".
> \x=macro:
-->111::333.
-\mypkgtest ...f \x {\my at A :\my at B :\my at C }\show \x
+->111::333:.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
+ \endgroup
+l. ...\mypkgtest
+> \x=macro:
+->111::333:777.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
+ \endgroup
+l. ...\mypkgtest
+> \x=macro:
+->111::333:888.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
+ \endgroup
+l. ...\mypkgtest
+! LaTeX3 Error: Key "preamble-option-D" may only be used in the preamble.
+For immediate help type H <return>.
+ ...
+l. ......l-option-C = 999, preamble-option-D = 999}
+ % 9
+LaTeX was asked to set a key called "preamble-option-D", but this is only
+allowed before \begin {document}. You will need to set the key earlier.
+> \x=macro:
+->111::999:888.
+\mypkgtest ...my at A :\my at B :\my at C :\my at D }\show \x
\endgroup
l. ...\mypkgtest
More information about the latex3-commits
mailing list.