[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Set up preamble-only options (9f0ada01)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Nov 26 22:48:04 CET 2021


Repository : https://github.com/latex3/latex2e
On branch  : options
Link       : https://github.com/latex3/latex2e/commit/9f0ada018a68fafe1e21a626060dc5d8067eb247

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

commit 9f0ada018a68fafe1e21a626060dc5d8067eb247
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Nov 26 21:48:04 2021 +0000

    Set up preamble-only options


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

9f0ada018a68fafe1e21a626060dc5d8067eb247
 base/ltkeys.dtx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index 66a648c4..a4190a2b 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -337,6 +337,30 @@
 % \end{macro}
 % \end{macro}
 %
+% \subsection{Option usage scope}
+%
+%  Disable all preamble options in one shot.
+%    \begin{macrocode}
+\tl_gput_left:Nn \@kernel at after@begindocument
+  {
+    \seq_map_inline:Nn \g_keys_usage_preamble_seq
+      {
+        \keys_set:nn { }
+          {
+            #1 .code:n =
+              \msg_error:nnx { keys } { preamble-only }
+                { \l_keys_key_str }
+          }
+      }
+  }
+\msg_new:nnnn { keys } { preamble-only }
+  { Key~"#1"~may~only~be~used~in~the~preamble. }
+  {
+    LaTeX~was~asked~to~set~a~key~called~"#1",~but~this~is~only~allowed~
+    before~\begin{document}.~You~will~need~to~set~the~key~earlier.
+  }
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 \ExplSyntaxOff
 %    \end{macrocode}





More information about the latex3-commits mailing list.