texlive[43531] Master/texmf-dist: xsavebox (17may17)

commits+karl at tug.org commits+karl at tug.org
Fri Mar 17 22:36:32 CET 2017


Revision: 43531
          http://tug.org/svn/texlive?view=revision&revision=43531
Author:   karl
Date:     2017-03-17 22:36:31 +0100 (Fri, 17 Mar 2017)
Log Message:
-----------
xsavebox (17may17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
    trunk/Master/texmf-dist/doc/latex/xsavebox/README
    trunk/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
    trunk/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
    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	2017-03-17 21:36:21 UTC (rev 43530)
+++ trunk/Master/texmf-dist/doc/latex/xsavebox/ChangeLog	2017-03-17 21:36:31 UTC (rev 43531)
@@ -1,3 +1,8 @@
+2017-03-16
+	* v0.5
+	* fix: compatibility issues with ocgx2 package; error when using \long
+	arguments for \xsavebox
+
 2017-02-03
 	* v0.4
 	* fix: RTL related (luaTeX)

Modified: trunk/Master/texmf-dist/doc/latex/xsavebox/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsavebox/README	2017-03-17 21:36:21 UTC (rev 43530)
+++ trunk/Master/texmf-dist/doc/latex/xsavebox/README	2017-03-17 21:36:31 UTC (rev 43531)
@@ -39,7 +39,7 @@
 
      <name> is an identifier (not a command!) composed of arbitrary
      non-active characters, including spaces and numbers. A command for
-     declaration of <name> does not exist.
+     the declaration of <name> does not exist.
 
      Starred `*' variants allow for colour injection (pdfLaTeX/LuaLaTeX
      only).

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

Modified: trunk/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex	2017-03-17 21:36:21 UTC (rev 43530)
+++ trunk/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex	2017-03-17 21:36:31 UTC (rev 43531)
@@ -12,7 +12,9 @@
 \usepackage{graphicx}
 \graphicspath{{files/}}
 \usepackage{color}
-\usepackage{lmodern}
+%\usepackage{lmodern}
+  \usepackage[tt=false]{libertine} %override beramono (doesn't look like tt font)
+  \usepackage[libertine]{newtxmath}
 \usepackage[T1]{fontenc}
 %\usepackage[protrusion,expansion]{microtype}
 \usepackage{parskip}

Modified: trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty	2017-03-17 21:36:21 UTC (rev 43530)
+++ trunk/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty	2017-03-17 21:36:31 UTC (rev 43531)
@@ -49,8 +49,8 @@
 \RequirePackage{pdfbase} %everything with `pbs_' prefix
 \RequirePackage{l3keys2e}
 
-\def\g at xsb@version at tl{0.4}
-\def\g at xsb@date at tl{2017/02/03}
+\def\g at xsb@version at tl{0.5}
+\def\g at xsb@date at tl{2017/03/16}
 \ProvidesExplPackage{xsavebox}{\g at xsb@date at tl}{\g at xsb@version at tl}
 {saveboxes for repeating content without code replication}
 
@@ -95,19 +95,30 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % saving content
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\DeclareDocumentCommand\xsavebox{smO{\width}O{c}m}{
+\DeclareDocumentCommand\xsavebox{smO{\width}O{c}+m}{
   \group_begin:
+  \tl_set:Nn\l_xsb_content_grouped_tl{
+    \group_begin:
+      \cs_set:Nn\ocgxii_beginocg:nnnn{}\cs_set:Nn\ocgxii_endocg:{}
+      #5
+    \group_end:
+  }
+  \xsb_push_props: %new, empty properties dict
   \xsb_beginLTR:
   \IfBooleanTF{#1}{
     %later colour injection possible (pdfTeX, LuaTeX)
-    \hbox_set:Nn\l_xsb_raw_box{\color at begingroup#5\color at endgroup} %raw
+    \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_box{ %content re-aligned
-      \makebox[#3][#4]{\color at begingroup#5\color at endgroup}
+      \makebox[#3][#4]{
+        \color at begingroup\l_xsb_content_grouped_tl\color at endgroup
+      }
     }
   }{
     %the LaTeX way (no colour injection)
-    \sbox\l_xsb_raw_box{#5} %raw content
-    \savebox\l_xsb_box[#3][#4]{#5} %re-aligned
+    \sbox\l_xsb_raw_box{\l_xsb_content_grouped_tl} %raw content
+    \savebox\l_xsb_box[#3][#4]{\l_xsb_content_grouped_tl} %re-aligned
   }
   %process one of \l_xsb_raw_box or \l_xsb_box
   \dim_compare:nTF{\box_wd:N\l_xsb_raw_box>\box_wd:N\l_xsb_box}{
@@ -128,9 +139,25 @@
       }
       \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_box
     }{
+      \IfBooleanTF{#1}{
+        \hbox_set:Nn\l_xsb_raw_box{ %raw content
+          \color at begingroup#5\color at endgroup
+        }
+      }{
+        \sbox\l_xsb_raw_box{#5} %raw content
+      }
       \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_raw_box
     }
   }{
+    \IfBooleanTF{#1}{
+      \hbox_set:Nn\l_xsb_box{ %content re-aligned
+        \makebox[#3][#4]{
+          \color at begingroup#5\color at endgroup
+        }
+      }
+    }{
+      \savebox\l_xsb_box[#3][#4]{#5} %re-aligned
+    }
     \xsb_process_box:nnnN{#2}{\width}{c}\l_xsb_box
   }
   \xsb_endLTR:
@@ -137,7 +164,7 @@
   \group_end:
 }
 
-\DeclareDocumentCommand\xsbox{mm}{\xsavebox{#1}{#2}}
+\DeclareDocumentCommand\xsbox{m+m}{\xsavebox{#1}{#2}}
 
 \DeclareDocumentEnvironment{xlrbox}{m}{
   \xsb_xlrbox:
@@ -154,6 +181,7 @@
 
 \cs_new_nopar:Nn\xsb_xlrbox:{
   \group_begin:
+  \xsb_push_props: %new, empty properties dict
   \xsb_beginLTR:
   \hbox_set:Nn\l_xsb_box\bgroup\bgroup
   \ignorespaces
@@ -170,6 +198,7 @@
 
 \cs_new_nopar:Nn\xsb_xlrbox_star:{
   \group_begin:
+  \xsb_push_props: %new, empty properties dict
   \xsb_beginLTR:
   \hbox_set:Nn\l_xsb_box\bgroup\color at begingroup
   \ignorespaces
@@ -203,7 +232,9 @@
   \box_set_ht:Nn#4{\height+\g_xsb_margin_tl}
   \box_set_dp:Nn#4{\depth+\g_xsb_margin_tl}
   %distill box to Form XObject
-  \pbs_pdfxform:nnn{1}{0}{#4}
+  \xsb_pop_props_to:N\l_tmpa_tl
+  \pbs_pdfxform:nnnnn{1}{0}{\l_tmpa_tl}{
+    \cs_if_exist_use:N\ocgbase_insert_oc:}{#4}
   %define command for inserting the m-boxed XObject reference
   \tl_gset:cx{the#1}{
     \exp_not:N\xsb_beginLTR:
@@ -222,7 +253,7 @@
 \box_new:N\l_xsb_box     %for saving the re-aligned content
 \box_new:N\l_xsb_raw_box %for saving the raw content
 
-%environment for setting LTR typesetting direction with e-TeX based engines 
+%environment for setting LTR typesetting direction with e-TeX based engines
 \cs_new:Nn\xsb_beginLTR:{
   \cs_if_exist:NT\TeXXeTstate{
     \int_compare:nT{\TeXXeTstate>\c_zero}{\beginL}
@@ -233,3 +264,34 @@
     \int_compare:nT{\TeXXeTstate>\c_zero}{\endL}
   }
 }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%for nested xsavebox/xlrbox cmds/envs, maintain a stack of /Properties
+%dictionaries, mostly used for marked-content property lists, e. g. OCGs;
+%(see PDF Reference)
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\seq_new:N\g_xsb_props_seq
+
+%push new, empty properties dictionary on the stack (to be used by THIS pkg)
+\cs_new:Nn\xsb_push_props:{\seq_gpush:Nn\g_xsb_props_seq{}}
+
+%pop current properties dict from stack and place its contents as a
+%/Properties << <prop dict> >> entry into the macro argument
+\cs_new:Nn\xsb_pop_props_to:N{
+  \seq_gpop:NNT\g_xsb_props_seq\l_tmpa_tl{
+    \tl_trim_spaces:N\l_tmpa_tl
+    \str_if_eq_x:nnF{\l_tmpa_tl}{}{\tl_set:Nx#1{/Properties<<\l_tmpa_tl>>}}
+  }
+}
+
+%add property (usually /key/val entry) to current properties dict;
+%this command is meant to be used by OTHER packages
+\cs_new:Nn\xsb_addto_props:n{
+  \seq_gpop:NNT\g_xsb_props_seq\l_tmpa_tl{
+    \tl_put_right:Nn\l_tmpa_tl{#1~}
+    \seq_gpush:Nx\g_xsb_props_seq{\l_tmpa_tl}
+  }
+}
+
+%get stack size; meant to be used by OTHER packages
+\cs_new:Nn\xsb_count_props:{\seq_count:N\g_xsb_props_seq}



More information about the tex-live-commits mailing list