texlive[51873] Master/texmf-dist: xsavebox (13aug19)

commits+karl at tug.org commits+karl at tug.org
Tue Aug 13 22:54:36 CEST 2019


Revision: 51873
          http://tug.org/svn/texlive?view=revision&revision=51873
Author:   karl
Date:     2019-08-13 22:54:36 +0200 (Tue, 13 Aug 2019)
Log Message:
-----------
xsavebox (13aug19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
    trunk/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
    trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty

Modified: trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog	2019-08-13 20:54:26 UTC (rev 51872)
+++ trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog	2019-08-13 20:54:36 UTC (rev 51873)
@@ -1,3 +1,8 @@
+2019-08-13
+	* v0.14
+	* fix: existing \theXXX macros, such as LaTeX counters, could accidentally
+  be overwritten
+	
 2019-06-24
 	* v0.13
 	* fix: dvipdfmx driver option fixed to work with current expl3

Modified: trunk/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty	2019-08-13 20:54:26 UTC (rev 51872)
+++ trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty	2019-08-13 20:54:36 UTC (rev 51873)
@@ -55,8 +55,8 @@
 \RequirePackage{xparse}
 \RequirePackage{l3keys2e}
 
-\def\g at xsb@version at tl{0.13}
-\def\g at xsb@date at tl{2019/06/24}
+\def\g at xsb@version at tl{0.14}
+\def\g at xsb@date at tl{2019/08/13}
 \ProvidesExplPackage{xsavebox}{\g at xsb@date at tl}{\g at xsb@version at tl}
 {saveboxes for repeating content without code replication}
 
@@ -140,7 +140,7 @@
 % content insertion (referencing, actually)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \DeclareDocumentCommand\xusebox{m}{
-  \tl_if_exist:cF{the#1}{\msg_error:nnn{xsavebox}{save-box~undefined}{#1}}
+  \tl_if_exist:cF{xsb_name_#1}{\msg_error:nnn{xsavebox}{save-box~undefined}{#1}}
   \tl_use:c{the#1}
 }
 \msg_set:nnnn{xsavebox}{save-box~undefined}{
@@ -153,6 +153,7 @@
 % saving content
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \DeclareDocumentCommand\xsavebox{smO{\width}O{c}+m}{
+  \xsb_check_box_name:n{#2}
   \group_begin:
   \tl_set:Nn\l_xsb_content_grouped_tl{
     \group_begin:
@@ -164,13 +165,9 @@
   \xsb_beginLTR:
   \IfBooleanTF{#1}{
     %later colour injection possible (pdfTeX, LuaTeX)
-    \hbox_set:Nn\l_xsb_raw_box{ %raw content
-      \color at begingroup\l_xsb_content_grouped_tl\color at endgroup
-    }
+    \hbox_set:Nn\l_xsb_raw_box{\l_xsb_content_grouped_tl} %raw content
     \hbox_set:Nn\l_xsb_box{ %content re-aligned
-      \makebox[#3][#4]{
-        \color at begingroup\l_xsb_content_grouped_tl\color at endgroup
-      }
+      \makebox[#3][#4]{\l_xsb_content_grouped_tl}
     }
   }{
     %the LaTeX way (no colour injection)
@@ -185,7 +182,7 @@
         %for colour injection
         \hbox_set:Nn\l_xsb_box{
           \makebox[\box_wd:N\l_xsb_raw_box][l]{
-            \makebox[#3][s]{\color at begingroup#5\color at endgroup}
+            \makebox[#3][s]{#5}
           }
         }
       }{
@@ -195,13 +192,11 @@
         }
       }
       \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_box
-    }{
+    }{ % raw content
       \IfBooleanTF{#1}{
-        \hbox_set:Nn\l_xsb_raw_box{ %raw content
-          \color at begingroup#5\color at endgroup
-        }
+        \hbox_set:Nn\l_xsb_raw_box{#5}
       }{
-        \sbox\l_xsb_raw_box{#5} %raw content
+        \sbox\l_xsb_raw_box{#5}
       }
       \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_raw_box
     }
@@ -208,9 +203,7 @@
   }{
     \IfBooleanTF{#1}{
       \hbox_set:Nn\l_xsb_box{ %content re-aligned
-        \makebox[#3][#4]{
-          \color at begingroup#5\color at endgroup
-        }
+        \makebox[#3][#4]{#5}
       }
     }{
       \savebox\l_xsb_box[#3][#4]{#5} %re-aligned
@@ -224,6 +217,7 @@
 \DeclareDocumentCommand\xsbox{m+m}{\xsavebox{#1}{#2}}
 
 \DeclareDocumentEnvironment{xlrbox}{m}{
+  \xsb_check_box_name:n{#1}
   \xsb_xlrbox:
 }{
   \xsb_endxlrbox:n{#1}
@@ -230,6 +224,7 @@
 }
 
 \DeclareDocumentEnvironment{xlrbox*}{m}{
+  \xsb_check_box_name:n{#1}
   \xsb_xlrbox_star:
 }{
   \xsb_endxlrbox_star:n{#1}
@@ -236,6 +231,20 @@
 }
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\msg_set:nnn{xsavebox}{name~in~use}{
+  The~name~`#1'~is~already~in~use~\msg_line_context:.\\
+  Select~a~different~box~name.
+}
+\cs_new_protected_nopar:Nn\xsb_check_box_name:n{
+  \bool_if:nTF{
+    \cs_if_exist_p:c{the#1} && !\tl_if_exist_p:c{xsb_name_#1}
+  }{
+    \msg_error:nnx{xsavebox}{name~in~use}{#1}
+  }{
+    \tl_clear_new:c{xsb_name_#1}
+  }
+}
+
 \cs_new_protected:Nn\xsb_xlrbox:{
   \group_begin:
   \xsb_push_props: %new, empty properties dict
@@ -257,13 +266,13 @@
   \group_begin:
   \xsb_push_props: %new, empty properties dict
   \xsb_beginLTR:
-  \hbox_set:Nw\l_xsb_box\color at begingroup
+  \hbox_set:Nw\l_xsb_box
   \ignorespaces
 }
 
 \cs_new_protected_nopar:Nn\xsb_endxlrbox_star:n{
   \unskip
-  \color at endgroup\hbox_set_end:
+  \hbox_set_end:
   \xsb_process_box:nnnN{#1}{\width}{c}\l_xsb_box
   \xsb_endLTR:
   \group_end:



More information about the tex-live-commits mailing list