[latex3-commits] [latex3/latex2e] tagging705-float: WIP, use sockets for caption (dbac837f)
github at latex-project.org
github at latex-project.org
Mon Sep 16 14:12:01 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : tagging705-float
Link : https://github.com/latex3/latex2e/commit/dbac837f387c04f51a128e635da55383e303f3ab
>---------------------------------------------------------------
commit dbac837f387c04f51a128e635da55383e303f3ab
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Sep 16 14:12:01 2024 +0200
WIP, use sockets for caption
>---------------------------------------------------------------
dbac837f387c04f51a128e635da55383e303f3ab
required/latex-lab/latex-lab-float.dtx | 57 +++++++++++++++++++++++++++++++---
1 file changed, 52 insertions(+), 5 deletions(-)
diff --git a/required/latex-lab/latex-lab-float.dtx b/required/latex-lab/latex-lab-float.dtx
index 46cac9d5..4cda86c9 100644
--- a/required/latex-lab/latex-lab-float.dtx
+++ b/required/latex-lab/latex-lab-float.dtx
@@ -528,6 +528,55 @@
\def\hyper at nopatch@caption{}
% \end{macrocode}
%
+% \subsubsection{(Tagging} sockets}
+% \begin{macrocode}
+\str_if_exist:cF { l__socket_tagsupport/caption/begin_plug_str }
+ {
+ \NewSocket{tagsupport/caption/begin}{1}
+ \NewSocket{tagsupport/caption/end}
+ \NewSocket{tagsupport/caption/singleline}{2}
+ \NewSocket{tagsupport/caption/Lbl/end}
+ }
+% \end{macrocode}
+% \begin{plugdecl}{default}
+% The caption begin socket takes an argument: the structure number of
+% the parent float. If the argument is empty, the current structure is used.
+% TODO: a tagpdf key that moves a structure to the begin of the parent.
+% \begin{macrocode}
+\NewSocketPlug {tagsupport/caption/begin}{default}
+ {
+ \tl_if_empty:eTF {#1}
+ {
+ \tag_struct_begin:n{tag=Caption}
+% \end{macrocode}
+% move the caption to the begin of the float structure:
+% \begin{macrocode}
+ \seq_gpop_right:cN {g__tag_struct_kids_\tag_get:n{struct_num}_seq}\l_@@_tmpa_tl
+ \seq_gput_left:cV {g__tag_struct_kids_\tag_get:n{struct_num}_seq}\l_@@_tmpa_tl
+ }
+ {
+ \tag_struct_begin:n{tag=Caption,parent=#1}
+% \end{macrocode}
+% move the caption to the begin of the float structure:
+% \begin{macrocode}
+ \seq_gpop_right:cN {g__tag_struct_kids_#1_seq}\l_@@_tmpa_tl
+ \seq_gput_left:cV {g__tag_struct_kids_#1_seq}\l_@@_tmpa_tl
+ }
+ }
+\AssignSocketPlug{tagsupport/caption/begin}{default}
+% \end{macrocode}
+% \end{plugdecl}
+% \begin{plugdecl}{default}
+% \begin{macrocode}
+\NewSocketPlug {tagsupport/caption/end}{default}
+ {
+ \tag_struct_end:
+ }
+\AssignSocketPlug{tagsupport/caption/end}{default}
+% \end{macrocode}
+% \end{plugdecl}
+% \subsubsection{Redefinitions}
+%
% With hyperref that means that the \cs{refstepcounter} now can affect spacing so we
% change that to the kernel refstepcounter:
% \begin{macrocode}
@@ -577,12 +626,10 @@
% \begin{macrocode}
\tagtool{para=false}
% \end{macrocode}
-% if caption is used outside a float there is perhaps no number, then we use
-% the parent structure and hope ...
+% We pass \cs{@current at float@struct} as parent structure
+% number. If that is empty the socket will use the parent structure and hope ...
% \begin{macrocode}
- \tl_if_empty:NT \@current at float@struct
- { \tl_set:Ne \@current at float@struct {\tag_get:n{struct_num}} }
- \tag_struct_begin:n{tag=Caption,parent=\@current at float@struct}
+ \UseTaggingSocket{\@current at float@struct}
% \end{macrocode}
% move the caption to the begin of the float structure:
% \begin{macrocode}
More information about the latex3-commits
mailing list.