summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/lttemplates.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/lttemplates.dtx')
-rw-r--r--macros/latex-dev/base/lttemplates.dtx133
1 files changed, 27 insertions, 106 deletions
diff --git a/macros/latex-dev/base/lttemplates.dtx b/macros/latex-dev/base/lttemplates.dtx
index d27c232fe0..6e950d1ec2 100644
--- a/macros/latex-dev/base/lttemplates.dtx
+++ b/macros/latex-dev/base/lttemplates.dtx
@@ -36,7 +36,7 @@
%<*driver>
% \fi
\ProvidesFile{lttemplates.dtx}
- [2024-02-15 v1.0b LaTeX Kernel (Prototype document functions)]
+ [2024-06-04 v1.0c LaTeX Kernel (Prototype document functions)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{lttemplates.dtx}
@@ -225,7 +225,9 @@
% value, which will be used in by the template if the \meta{key} is
% not set explicitly. The \meta{default} should be of the correct
% form to be accepted by the \meta{key type} of the \meta{key}: this
-% is not checked by the code.
+% is not checked by the code. Expressions for numerical values are
+% evaluated when the template is used, thus for example values given
+% in terms of |em| or |ex| will be set respecting the prevailing font.
% \end{function}
%
% \begin{table}
@@ -318,7 +320,7 @@
% \toprule
% \multicolumn{1}{l}{Key-type} & Description of binding \\
% \midrule
-% boolean & Boolean variable, \emph{e.g}.~\cs{l_tmpa_bool} \\
+% \ & Boolean variable, \emph{e.g}.~\cs{l_tmpa_bool} \\
% choice
% & List of choice implementations
% (see Section~\ref{sec:choices-key}) \\
@@ -469,9 +471,9 @@
% the general idea of fixing some settings.
% \end{function}
%
-% \begin{function}{\IfInstanceExistT, \IfInstanceExistF, \IfInstanceExistTF}
+% \begin{function}{\IfInstanceExistsT, \IfInstanceExisstF, \IfInstanceExistsTF}
% \begin{syntax}
-% \cs{IfInstanceExistTF} \Arg{type} \Arg{instance} \Arg{true code} \Arg{false code}
+% \cs{IfInstanceExistsTF} \Arg{type} \Arg{instance} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the named \meta{instance} of a \meta{type} exists, and
% then inserts the appropriate code into the input stream.
@@ -728,13 +730,13 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\l_@@_default_tl}
+% \begin{variable}{\l_@@_default_tl}
% The default value for a key is recovered here from the property list
% in which it is stored.
% \begin{macrocode}
\tl_new:N \l_@@_default_tl
% \end{macrocode}
-%\ end{macro}
+% \end{variable}
%
% \begin{variable}{\l_@@_error_bool}
% A flag for errors to be carried forward.
@@ -1320,7 +1322,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \subsubsection{Storing values}
%
@@ -1913,7 +1914,8 @@
{ \@@_find_global: }
}
\tl_set:Nn \l_@@_key_name_tl {#1}
- \use:c { @@_assign_ \l_@@_keytype_tl : }
+ \cs_if_exist_use:cF { @@_assign_ \l_@@_keytype_tl : }
+ { \@@_assign_variable: }
}
{ \msg_error:nnn { template } { unknown-attribute } {#1} }
}
@@ -1923,7 +1925,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\@@_find_global:}
% \begin{macro}{\@@_find_global_aux:w}
@@ -2096,103 +2097,20 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_assign_integer:}
-% \begin{macro}{\@@_assign_length:}
-% \begin{macro}{\@@_assign_muskip:}
-% \begin{macro}{\@@_assign_real:}
-% \begin{macro}{\@@_assign_skip:}
-% All of the calculated assignments use the same underlying code, with
-% only the low-level assignment function changing.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_assign_integer:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_variable:N \int_gset:Nn }
- { \@@_assign_variable:N \int_set:Nn }
- }
-\cs_new_protected:Npn \@@_assign_length:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_variable:N \dim_gset:Nn }
- { \@@_assign_variable:N \dim_set:Nn }
-}
-\cs_new_protected:Npn \@@_assign_muskip:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_variable:N \muskip_gset:Nn }
- { \@@_assign_variable:N \muskip_set:Nn }
- }
-\cs_new_protected:Npn \@@_assign_real:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_variable:N \fp_gset:Nn }
- { \@@_assign_variable:N \fp_set:Nn }
- }
-\cs_new_protected:Npn \@@_assign_skip:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_variable:N \skip_gset:Nn }
- { \@@_assign_variable:N \skip_set:Nn }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\@@_assign_tokenlist:}
-% \begin{macro}{\@@_assign_tokenlist_aux:NN}
-% Life would be easy here if it were not for \cs{KeyValue}. To deal
-% correctly with that, we need to allow for the recovery a stored value
-% at point of use.
+% \begin{macro}{\@@_assign_variable:}
+% \begin{macro}{\@@_assign_variable:N, \@@_assign_variable:c}
+% A general-purpose function for all of the other assignments.
+% As long as the value is not coming from another variable, the stored
+% value is simply transferred for output.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_assign_tokenlist:
+\cs_new_protected:Npn \@@_assign_variable:
{
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_tokenlist_aux:NN \tl_gset:NV \tl_gset:Nn }
- { \@@_assign_tokenlist_aux:NN \tl_set:NV \tl_set:Nn }
- }
-\cs_new_protected:Npn \@@_assign_tokenlist_aux:NN #1#2
- {
- \@@_if_key_value:VTF \l_@@_value_tl
- {
- \@@_key_to_value:
- \tl_put_right:Ne \l_@@_assignments_tl
- {
- #1 \exp_not:V \l_@@_var_tl
- { \exp_not:V \l_@@_value_tl }
- }
- }
+ \@@_assign_variable:c
{
- \tl_put_right:Ne \l_@@_assignments_tl
- {
- #2 \exp_not:V \l_@@_var_tl
- { \exp_not:V \l_@@_value_tl }
- }
+ \@@_map_var_type: _
+ \bool_if:NT \l_@@_global_bool { g } set:Nn
}
}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\@@_assign_commalist:}
-% Very similar for commas lists, so some code is shared.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_assign_commalist:
- {
- \bool_if:NTF \l_@@_global_bool
- { \@@_assign_tokenlist_aux:NN \clist_gset:NV \clist_gset:Nn }
- { \@@_assign_tokenlist_aux:NN \clist_set:NV \clist_set:Nn }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_assign_variable:N}
-% A general-purpose function for all of the numerical assignments.
-% As long as the value is not coming from another variable, the stored
-% value is simply transferred for output.
-% \begin{macrocode}
\cs_new_protected:Npn \@@_assign_variable:N #1
{
\@@_if_key_value:VT \l_@@_value_tl
@@ -2203,8 +2121,10 @@
{ \exp_not:V \l_@@_value_tl }
}
}
+\cs_generate_variant:Nn \@@_assign_variable:N { c }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_key_to_value:}
% \begin{macro}{\@@_key_to_value_auxi:w}
@@ -2653,15 +2573,16 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\IfInstanceExistT, \IfInstanceExistF, \IfInstanceExistTF}
+% \begin{macro}{\IfInstanceExistsT, \IfInstanceExistsF, \IfInstanceExistsTF}
% \changes{2024-02-15}{v1.0b}{New macros}
+% \changes{2024-04-17}{v1.0c}{Use plural names}
% More direct translation.
% \begin{macrocode}
-\cs_new:Npn \IfInstanceExistTF #1#2
+\cs_new:Npn \IfInstanceExistsTF #1#2
{ \@@_if_instance_exist:nnTF {#1} {#2} }
-\cs_new:Npn \IfInstanceExistT #1#2
+\cs_new:Npn \IfInstanceExistsT #1#2
{ \@@_if_instance_exist:nnT {#1} {#2} }
-\cs_new:Npn \IfInstanceExistF #1#2
+\cs_new:Npn \IfInstanceExistsF #1#2
{ \@@_if_instance_exist:nnF {#1} {#2} }
% \end{macrocode}
% \end{macro}