diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-17 21:36:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-17 21:36:31 +0000 |
commit | 7660473b987f1512007c1455fb1009f37e2bd8d5 (patch) | |
tree | 669c1daa2513c9d586e0fa3956006c8486939acc /Master/texmf-dist | |
parent | e33fc7da87a62f72327720abe39033ef04b6a265 (diff) |
xsavebox (17may17)
git-svn-id: svn://tug.org/texlive/trunk@43531 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/xsavebox/ChangeLog | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsavebox/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf | bin | 278085 -> 342847 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/xsavebox/xsavebox.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty | 82 |
5 files changed, 81 insertions, 12 deletions
diff --git a/Master/texmf-dist/doc/latex/xsavebox/ChangeLog b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog index 04c16850796..6953503062a 100644 --- a/Master/texmf-dist/doc/latex/xsavebox/ChangeLog +++ b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog @@ -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) diff --git a/Master/texmf-dist/doc/latex/xsavebox/README b/Master/texmf-dist/doc/latex/xsavebox/README index 1bf60ee890f..85851a4f652 100644 --- a/Master/texmf-dist/doc/latex/xsavebox/README +++ b/Master/texmf-dist/doc/latex/xsavebox/README @@ -39,7 +39,7 @@ The user commands are: <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). diff --git a/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf Binary files differindex 4b5d5e0e74c..b2733a73979 100644 --- a/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf +++ b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf diff --git a/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex index 29915a78fcc..a44294d282d 100644 --- a/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex +++ b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex @@ -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} diff --git a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty index 7d86868fb2d..b5c95635045 100644 --- a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty +++ b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty @@ -49,8 +49,8 @@ \RequirePackage{pdfbase} %everything with `pbs_' prefix \RequirePackage{l3keys2e} -\def\g@xsb@version@tl{0.4} -\def\g@xsb@date@tl{2017/02/03} +\def\g@xsb@version@tl{0.5} +\def\g@xsb@date@tl{2017/03/16} \ProvidesExplPackage{xsavebox}{\g@xsb@date@tl}{\g@xsb@version@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@begingroup#5\color@endgroup} %raw + \hbox_set:Nn\l_xsb_raw_box{ %raw content + \color@begingroup\l_xsb_content_grouped_tl\color@endgroup + } \hbox_set:Nn\l_xsb_box{ %content re-aligned - \makebox[#3][#4]{\color@begingroup#5\color@endgroup} + \makebox[#3][#4]{ + \color@begingroup\l_xsb_content_grouped_tl\color@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,16 +139,32 @@ } \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_box }{ + \IfBooleanTF{#1}{ + \hbox_set:Nn\l_xsb_raw_box{ %raw content + \color@begingroup#5\color@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@begingroup#5\color@endgroup + } + } + }{ + \savebox\l_xsb_box[#3][#4]{#5} %re-aligned + } \xsb_process_box:nnnN{#2}{\width}{c}\l_xsb_box } \xsb_endLTR: \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@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} |