[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Set up preamble-only options (eb9bd304)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Jan 12 18:26:18 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : options
Link : https://github.com/latex3/latex2e/commit/eb9bd304319a6fe752e307491792e939f28fd314
>---------------------------------------------------------------
commit eb9bd304319a6fe752e307491792e939f28fd314
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Fri Nov 26 21:48:04 2021 +0000
Set up preamble-only options
>---------------------------------------------------------------
eb9bd304319a6fe752e307491792e939f28fd314
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.