[latex3-commits] [latex3/latex2e] mk/taggingsocket: Add expandable commands for using tagging sockets without arguments (a7b270d79)
github at latex-project.org
github at latex-project.org
Mon Oct 21 00:51:56 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : mk/taggingsocket
Link : https://github.com/latex3/latex2e/commit/a7b270d7991d27b1a25ccc74419b9af0329163f9
>---------------------------------------------------------------
commit a7b270d7991d27b1a25ccc74419b9af0329163f9
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Mon Oct 21 00:51:31 2024 +0200
Add expandable commands for using tagging sockets without arguments
>---------------------------------------------------------------
a7b270d7991d27b1a25ccc74419b9af0329163f9
base/changes.txt | 1 +
base/lttagging.dtx | 29 ++++++++++++++++++++++++++---
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 6d927f9c0..9beea5e8e 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -9,6 +9,7 @@ not part of the distribution.
2024-10-21 Marcel Krüger <Marcel.Krueger at latex-project.org>
* lttagging.dtx
Adapt two argument tagging sockets to preserve second argument when the socket is disabled.
+ Add expandable versions of tagging socket use commands.
2024-10-18 Clea Rees <reesc21 at cf.ac.uk>
* lttextcomp.dtx
diff --git a/base/lttagging.dtx b/base/lttagging.dtx
index 6c67c3d6b..f15e7f6eb 100644
--- a/base/lttagging.dtx
+++ b/base/lttagging.dtx
@@ -104,7 +104,9 @@
% debugging strings\ldots
%
%
+% \DescribeMacro\UseExpandableTaggingSocket
% \DescribeMacro\UseTaggingSocket
+% \DescribeMacro\tag_socket_use_expandable:n
% \DescribeMacro\tag_socket_use:n
% \DescribeMacro\tag_socket_use:nn
% \DescribeMacro\tag_socket_use:nnn
@@ -141,8 +143,12 @@
% if e.g. \cs{SuspendTagging} is in force. There may be reasons for doing
% that but in general we expect to always use \cs{UseTaggingSocket}.
%
-% The L3 programming layer versions \cs{tag_socket_use:n}, and
-% \cs{tag_socket_use:nn}, \cs{tag_socket_use:nnn}
+% For special cases like in some \cs{halign} contexts we need a fully expandable
+% version of the commend. For these cases, \cs{UseExpandableTaggingSocket} can be
+% used.
+%
+% The L3 programming layer versions \cs{tag_socket_use_expandable:n},
+% \cs{tag_socket_use:n}, \cs{tag_socket_use:nn}, and \cs{tag_socket_use:nnn}
% are slightly more efficient than
% \cs{UseTaggingSocket} because they do not have to determine how
% many arguments the socket takes when disabling it.
@@ -168,9 +174,11 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tag_socket_use:n,
+% \begin{macro}{\tag_socket_use_expandable:n,
+% \tag_socket_use:n,
% \tag_socket_use:nn,
% \tag_socket_use:nnn,
+% \UseExpandableTaggingSocket,
% \UseTaggingSocket,
% }
% Again this is not the final definition for the kernel; it is just
@@ -190,7 +198,9 @@
% These definitions will get updated in \pkg{tagpdf}.
% The default in the kernel is just to get rid of the first argument, the second is preserved if present:
% \changes{v1.0k}{2024/10/21}{Changed behavior of two argument tagging sockets when disabled.}
+% \changes{v1.0k}{2024/10/21}{Added expandable variants}
% \begin{macrocode}
+\cs_new:Npn \tag_socket_use:n #1 { }
\cs_new_protected:Npn \tag_socket_use:n #1 { }
\cs_new_protected:Npn \tag_socket_use:nn #1#2 { }
\cs_new_protected:Npn \tag_socket_use:nnn #1#2#3 { #3 }
@@ -209,6 +219,19 @@
\ERRORusetaggingsocket % that should get a proper error message
}
% \end{macrocode}
+% The same as an expandable command:
+% \begin{macrocode}
+\cs_new:Npn \UseExpandableTaggingSocket #1 {
+ \int_case:nnF
+ { \int_use:c { c__socket_tagsupport/#1_args_int } }
+ {
+ 0 \prg_do_nothing:
+ 1 \use_none:n
+ 2 \use_ii:nn
+ }
+ \ERRORusetaggingsocket % that should get a proper error message
+}
+% \end{macrocode}
%
% \end{macro}
%
More information about the latex3-commits
mailing list.