[latex3-commits] [latex3/latex2e] UF-latex-lab-refadaption: store also structure number of Sect (623efd7f)

github at latex-project.org github at latex-project.org
Thu Sep 19 18:36:47 CEST 2024


Repository : https://github.com/latex3/latex2e
On branch  : UF-latex-lab-refadaption
Link       : https://github.com/latex3/latex2e/commit/623efd7faa97bae14ff101cada847c4f2954e096

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

commit 623efd7faa97bae14ff101cada847c4f2954e096
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Sep 19 18:36:47 2024 +0200

    store also structure number of Sect


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

623efd7faa97bae14ff101cada847c4f2954e096
 required/latex-lab/latex-lab-sec.dtx | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/required/latex-lab/latex-lab-sec.dtx b/required/latex-lab/latex-lab-sec.dtx
index 231ed1a8..d9d13a09 100644
--- a/required/latex-lab/latex-lab-sec.dtx
+++ b/required/latex-lab/latex-lab-sec.dtx
@@ -232,13 +232,23 @@
 %
 %
 % \begin{variable}{\g__tag_sec_stack_seq}
-% The stack holds the tag and the level.
+% The stack holds the tag, the level and the structure number.
 %    \begin{macrocode}
 \seq_new:N   \g__tag_sec_stack_seq
-\seq_gpush:Nn\g__tag_sec_stack_seq {{Document}{-100}}
+\seq_gpush:Nn\g__tag_sec_stack_seq {{Document}{-100}{2}}
 %    \end{macrocode}
 % \end{variable}
 % 
+% \begin{macro}{\__tag_get_data_current_Sect:}
+% This allows to retrieve the number of the current Sect structure (or
+% Document if we are outside any Sect) with |\tag_get:n{current_Sect}|
+%    \begin{macrocode}
+\cs_new:Npn \__tag_get_data_current_Sect:
+ {
+   \exp_last_unbraced:Ne\use_iii:nnn{\seq_item:Nn\g__tag_sec_stack_seq{1}}
+ }
+%    \end{macrocode}
+% \end{macro}
 % \begin{variable}{\l__tag_sec_Sect_bool}
 % This boolean controls if a Sect structure is opened. 
 %    \begin{macrocode}
@@ -246,7 +256,6 @@
 \bool_set_true:N\l__tag_sec_Sect_bool
 %    \end{macrocode}
 % \end{variable}
- 
 %
 % \begin{macro}{\__tag_sec_begin:nn}
 % This starts a sectioning structure. 
@@ -260,7 +269,8 @@
          tag= {\int_compare:nNnTF {#1}={-1}{Part}{Sect}}
         ,#2
       } 
-    \seq_gpush:Ne \g__tag_sec_stack_seq {{\g__tag_struct_tag_tl}{\int_eval:n{#1}}}    
+    \seq_gpush:Ne \g__tag_sec_stack_seq 
+      {{\g__tag_struct_tag_tl}{\int_eval:n{#1}}{\g__tag_struct_stack_current_tl}}    
   }
 %    \end{macrocode}
 % \end{macro}
@@ -276,12 +286,12 @@
 \cs_new_protected:Npn\__tag_sec_end:n #1 % #1 level
   {
     \seq_get:NN \g__tag_sec_stack_seq \l__tag_tmpa_tl
-    \int_compare:nNnT {#1}<{\exp_last_unbraced:NV\use_ii:nn\l__tag_tmpa_tl+1}
+    \int_compare:nNnT {#1}<{\exp_last_unbraced:NV\use_ii:nnn\l__tag_tmpa_tl+1}
       {
         \seq_get:NN\g__tag_struct_tag_stack_seq \l__tag_tmpb_tl
         \exp_args:Nee
           \tl_if_eq:nnTF 
-            {\exp_last_unbraced:NV\use_i:nn\l__tag_tmpa_tl}
+            {\exp_last_unbraced:NV\use_i:nnn\l__tag_tmpa_tl}
             {\exp_last_unbraced:NV\use_i:nn\l__tag_tmpb_tl}
             {
               \seq_gpop:NN \g__tag_sec_stack_seq \l__tag_tmpa_tl
@@ -290,7 +300,7 @@
             }
             { 
               \msg_warning:nnee {tag}{wrong-sect-nesting}
-               { \exp_last_unbraced:NV\use_i:nn \l__tag_tmpa_tl }
+               { \exp_last_unbraced:NV\use_i:nnn \l__tag_tmpa_tl }
                { \exp_last_unbraced:NV\use_i:nn \l__tag_tmpb_tl } 
             }
       }  





More information about the latex3-commits mailing list.