summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-24 21:07:51 +0000
committerKarl Berry <karl@freefriends.org>2019-06-24 21:07:51 +0000
commitf8ad442a7d57151fa1590e5ba8e711d88f612a43 (patch)
treebea31202b5530494bdb31ecc29041789d2dcd2bd
parent7ae3838c4a35bf3529476a302b0973afff165b59 (diff)
xsavebox (24jun19)
git-svn-id: svn://tug.org/texlive/trunk@51448 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/xsavebox/ChangeLog4
-rw-r--r--Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdfbin369004 -> 373171 bytes
-rw-r--r--Master/texmf-dist/source/latex/xsavebox/xsavebox.tex9
-rw-r--r--Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty78
4 files changed, 68 insertions, 23 deletions
diff --git a/Master/texmf-dist/doc/latex/xsavebox/ChangeLog b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
index 82f99da90fc..73f75458398 100644
--- a/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
+++ b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
@@ -1,3 +1,7 @@
+2019-06-24
+ * v0.13
+ * fix: dvipdfmx driver option fixed to work with current expl3
+
2018-07-09
* v0.12
* fix: non-vanishing Re-run message
diff --git a/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
index 960b7b02e17..f17f280e266 100644
--- a/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
+++ b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
index 5b8f3bac871..1739f1f072d 100644
--- a/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
+++ b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
@@ -16,7 +16,7 @@
\usepackage[tt=false]{libertine} %override beramono (doesn't look like tt font)
\usepackage[libertine]{newtxmath}
\usepackage[T1]{fontenc}
-%\usepackage[protrusion,expansion]{microtype}
+\usepackage[protrusion,expansion]{microtype}
\usepackage{parskip}
\usepackage[bookmarksnumbered,linktocpage]{hyperref}
\usepackage[ocgcolorlinks]{ocgx2}
@@ -32,7 +32,7 @@
pdftitle={The xsavebox Package},
pdfsubject={Documentation},
pdfauthor={Alexander Grahn},
- pdfkeywords={PDF features, XObject, savebox, LaTeX, dvips, repeated content, repeated graphics, eps, PostScript, ps2pdf, XeLaTeX, pdfLaTeX, LuaLaTeX, dvipdfmx},
+ pdfkeywords={PDF features, XObject, savebox, LaTeX, dvips, repeated content, repeated graphics, eps, PostScript, ps2pdf, XeLaTeX, pdfLaTeX, LuaLaTeX, dvipdfmx, dvisvgmx},
citebordercolor={0 0 1},
filebordercolor={0 0 1},
linkbordercolor={0 0 1},
@@ -62,7 +62,7 @@
\author{Alexander Grahn\\[1ex]\url{https://gitlab.com/agrahn/xsavebox}}
\maketitle
\begin{abstract}
-\noindent This package defines commands for saving content that can be repeatedly placed into the document without replicating DVI/PDF code in the output file, allowing for smaller size of the final PDF file and improved content caching for faster display in certain PDF viewers. The user commands are modelled after the standard \LaTeX{} commands \verb+\savebox+, \verb+\sbox+, \verb+\usebox+ and the `\verb+lrbox+' environment. The package supports all common \TeX{} engines and back-ends, including `\verb+dvips+'.
+ \noindent This package defines commands for saving content that can be repeatedly placed into the document without replicating DVI/PDF code in the output file, allowing for smaller size of the final PDF file and improved content caching for faster display in certain PDF viewers. The user commands are modelled after the standard \LaTeX{} commands \verb+\savebox+, \verb+\sbox+, \verb+\usebox+ and the `\verb+lrbox+' environment. The package supports all common \TeX{} engines and back-ends, including `\verb+dvips+', `\verb+(x)dvipdfmx+' and `\verb+dvisvgm+'.
\end{abstract}
\section{Introduction}
@@ -78,9 +78,10 @@ All common \TeX{} engines and back-ends are supported, which are:
\item pdf\LaTeX, Lua\LaTeX,
\item \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller
\item \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+
+\item \pXepLaTeX{} $\rightarrow$ \verb+dvisvgm+
\end{itemize}
-To enable `\verb+dvipdfmx+', pass it as a document class option.
+To enable `\verb+dvipdfmx+' or `\verb+dvisvgm+', pass them as document class option.
It should be emphasized that \enquote{Form XObjects} is a PDF feature. Content saved and referenced using \enquote{Form XObjects} is only visible in the final PDF output, but not in intermediate formats of the work-flow if those are involved, namely DVI and PostScript. Of course, PostScript converted back from PDF displays the content correctly.
diff --git a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
index 21bc7116136..8114fbff442 100644
--- a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
+++ b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
@@ -45,12 +45,18 @@
%
% The Current Maintainer of this work is A. Grahn.
+%process non-detectable dvipdfmx driver for passing to expl3
+\RequirePackage{xkeyval}
+\DeclareOptionX{dvipdfmx}{%
+ \PassOptionsToPackage{driver=dvipdfmx}{expl3}
+}
+\DeclareOptionX*{}\ProcessOptionsX*\relax %allow anything as an option
+
\RequirePackage{xparse}
-\RequirePackage{pdfbase} %everything with `pbs_' prefix
\RequirePackage{l3keys2e}
-\def\g@xsb@version@tl{0.12}
-\def\g@xsb@date@tl{2018/07/09}
+\def\g@xsb@version@tl{0.13}
+\def\g@xsb@date@tl{2019/06/24}
\ProvidesExplPackage{xsavebox}{\g@xsb@date@tl}{\g@xsb@version@tl}
{saveboxes for repeating content without code replication}
@@ -60,10 +66,6 @@
Please~install~an~up~to~date~version~of~`#1'.\\
Loading~xsavebox~will~abort!
}
-\@ifpackagelater{pdfbase}{2017/03/23}{}{
- \msg_error:nnn{xsavebox}{support~outdated}{pdfbase.sty}
- \tex_endinput:D
-}
%re-run message
\msg_set:nnn{xsavebox}{rerun}{Rerun~to~get~internal~references~right!}
@@ -81,6 +83,7 @@
}
%package options
+\bool_new:N\g_xsb_dvisvgm_bool %`dvisvgm' driver option
\tl_gset:Nn\g_xsb_margin_tl{3pt}
\keys_define:nn{xsavebox}{
margin .code:n = {
@@ -88,13 +91,49 @@
\tl_gset:Nx\g_xsb_margin_tl{\dim_use:N\l_tmpa_dim}
},
+ xetex .code:n = {}, %dummy, we use engine test instead
+
+ dvipdfmx .choice:,
+ dvipdfmx / true .code:n = {
+ \bool_gset_false:N\g_xsb_dvisvgm_bool
+ \PassOptionsToPackage{dvipdfmx}{pdfbase}
+ },
+ dvipdfmx / false .code:n = {},
+ dvipdfmx .default:n = {true},
+
+ dvisvgm .choice:,
+ dvisvgm / true .code:n = {
+ \bool_gset_true:N\g_xsb_dvisvgm_bool
+ \PassOptionsToPackage{dvisvgm}{pdfbase}
+ },
+ dvisvgm / false .code:n = {\bool_gset_false:N\g_xsb_dvisvgm_bool},
+ dvisvgm .default:n = {true},
+
unknown .code:n = {
\msg_error:nnx{xsavebox}{unknown~package~option}{\l_keys_key_tl}
}
}
-
\ProcessKeysOptions{xsavebox}
+\sys_if_output_pdf:T{\bool_gset_false:N\g_xsb_dvisvgm_bool}
+
+\RequirePackage{pdfbase}
+\@ifpackagelater{pdfbase}{2017/03/23}{}{
+ \msg_error:nnn{xsavebox}{support~outdated}{pdfbase.sty}
+ \tex_endinput:D
+}
+\cs_gset_eq:NN\xsb@newkey\pbs@newkey
+\cs_gset_eq:NN\xsb_pdfxform:nnnnn\pbs_pdfxform:nnnnn
+\cs_gset_eq:NN\xsb_pdflastxform:\pbs_pdflastxform:
+\cs_gset_eq:NN\xsb_pdfrefxform:n\pbs_pdfrefxform:n
+
+\bool_if:NTF\g_xsb_dvisvgm_bool{
+ \tl_gset:Nn\g_xsb_margin_tl{0pt}
+ \cs_new_protected_nopar:Nn\xsb_updatebbox:nnn{\special{dvisvgm:bbox~#1~#2~#3}}
+}{
+ \cs_new_protected_nopar:Nn\xsb_updatebbox:nnn{}
+}
+
\int_new:N\g_xsb_id_int
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -140,7 +179,7 @@
}
%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}{
- \str_if_eq_x:nnTF{#4}{s}{
+ \str_if_eq:eeTF{#4}{s}{
%sqeezing content correctly
\IfBooleanTF{#1}{
%for colour injection
@@ -208,7 +247,7 @@
\cs_new_protected_nopar:Nn\xsb_endxlrbox:n{
\unskip
\group_end:\hbox_set_end:
- \sbox\l_xsb_box{\hbox_unpack_clear:N\l_xsb_box}
+ \sbox\l_xsb_box{\hbox_unpack_drop:N\l_xsb_box}
\xsb_process_box:nnnN{#1}{\width}{c}\l_xsb_box
\xsb_endLTR:
\group_end:
@@ -245,7 +284,7 @@
%temporarily (for distilling) push the box bounds somewhat; glyphs tend to
%be bigger than their bounding boxes
\hbox_set_to_wd:Nnn#4{\width+\g_xsb_margin_tl+\g_xsb_margin_tl}{
- \hss\hbox_unpack_clear:N#4\hss
+ \hss\hbox_unpack_drop:N#4\hss
}
\box_set_ht:Nn#4{\height+\g_xsb_margin_tl}
\box_set_dp:Nn#4{\depth+\g_xsb_margin_tl}
@@ -260,33 +299,34 @@
\xsb_pop_props_to:N\l_tmpa_tl
%distill box to Form XObject, if used (ref'ed)
\bool_if:cT{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{
- \pbs_pdfxform:nnnnn{1}{0}{\l_tmpa_tl}{
+ \xsb_pdfxform:nnnnn{1}{0}{\l_tmpa_tl}{
\cs_if_exist_use:N\ocgbase_insert_oc:}{#4}
}
%for tracking box usage
\iow_now:Nx\@mainaux{
- \token_to_str:N\pbs@newkey{xsb@\int_use:N\g_xsb_id_int}{false}
+ \token_to_str:N\xsb@newkey{xsb@\int_use:N\g_xsb_id_int}{false}
}
%define command for inserting the m-boxed XObject reference
\cs_gset_protected:cpx{the#1}{
\exp_not:N\tl_if_exist:cF{xsb_\int_use:N\g_xsb_id_int}{
%mark box as `used'
\exp_not:N\iow_now:Nx\@mainaux{
- \token_to_str:N\pbs@newkey{xsb@\int_use:N\g_xsb_id_int}{true}
+ \token_to_str:N\xsb@newkey{xsb@\int_use:N\g_xsb_id_int}{true}
}
\exp_not:N\tl_new:c{xsb_\int_use:N\g_xsb_id_int}
- }
+ }
\exp_not:N\bool_if:cF{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{
\exp_not:N\xsb_rerun_msg:
}
\exp_not:N\xsb_beginLTR:
+ \xsb_updatebbox:nnn{\l_xsb_new_wd_tl}{\l_xsb_ht_tl}{\l_xsb_dp_tl}
\exp_not:N\makebox[\l_xsb_new_wd_tl][#3]{
\exp_not:N\hbox_to_wd:nn{\l_xsb_wd_tl}{
\exp_not:N\vrule~width~\c_zero_dim~height~\l_xsb_ht_tl~
depth~\l_xsb_dp_tl
\exp_not:N\skip_horizontal:n{-\g_xsb_margin_tl}
\bool_if:cT{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}{
- \exp_not:N\pbs_pdfrefxform:n{\pbs_pdflastxform:}
+ \exp_not:N\xsb_pdfrefxform:n{\xsb_pdflastxform:}
}
\hss
}
@@ -302,12 +342,12 @@
%environment for setting LTR typesetting direction with e-TeX based engines
\cs_new_protected:Nn\xsb_beginLTR:{
\cs_if_exist:NT\TeXXeTstate{
- \int_compare:nT{\TeXXeTstate>\c_zero}{\beginL}
+ \int_compare:nT{\TeXXeTstate>\c_zero_int}{\beginL}
}
}
\cs_new_protected:Nn\xsb_endLTR:{
\cs_if_exist:NT\TeXXeTstate{
- \int_compare:nT{\TeXXeTstate>\c_zero}{\endL}
+ \int_compare:nT{\TeXXeTstate>\c_zero_int}{\endL}
}
}
@@ -326,7 +366,7 @@
\cs_new_protected: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>>}}
+ \str_if_eq:eeF{\l_tmpa_tl}{}{\tl_set:Nx#1{/Properties<<\l_tmpa_tl>>}}
}
}