summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-25 22:40:22 +0000
committerKarl Berry <karl@freefriends.org>2016-02-25 22:40:22 +0000
commit561ad89d0840ad3b9ddb197efec1739e5089f1b6 (patch)
treecffe22aac21aedf3c717d43de9798c5b09d2733e /Master/texmf-dist
parente609261d18e7ce4dd1708dcc6d4679b22ba2d814 (diff)
xsavebox (25feb16)
git-svn-id: svn://tug.org/texlive/trunk@39866 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/xsavebox/ChangeLog2
-rw-r--r--Master/texmf-dist/doc/latex/xsavebox/README64
-rw-r--r--Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdfbin0 -> 275274 bytes
-rw-r--r--Master/texmf-dist/source/latex/xsavebox/files/mailto.pngbin0 -> 962 bytes
-rw-r--r--Master/texmf-dist/source/latex/xsavebox/xsavebox.tex187
-rw-r--r--Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty210
6 files changed, 463 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsavebox/ChangeLog b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
new file mode 100644
index 00000000000..af04ecf527b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsavebox/ChangeLog
@@ -0,0 +1,2 @@
+2016-02-25
+ * initial release (v0.1) to CTAN
diff --git a/Master/texmf-dist/doc/latex/xsavebox/README b/Master/texmf-dist/doc/latex/xsavebox/README
new file mode 100644
index 00000000000..1bf60ee890f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsavebox/README
@@ -0,0 +1,64 @@
+ ============================
+ The xsavebox LaTeX Package
+ ============================
+
+
+Author:
+
+Alexander Grahn
+
+
+Description:
+
+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 file size of the final PDF and improved content
+caching for faster display in certain PDF viewers. The method makes use of
+`Form XObjects' defined in the PDF specification.
+
+The user commands are modelled after the standard LaTeX commands \savebox,
+\sbox, \usebox and the `lrbox' environment.
+
+All common TeX engines and back-ends are supported:
+
+ * pdfLaTeX, LuaLaTeX
+ * LaTeX --> dvips --> ps2pdf/Distiller
+ * (Xe)LaTeX --> (x)dvipdfmx
+
+The user commands are:
+
+ * content saving:
+
+ \xsavebox{<name>}[<width>][<position>]{...}
+ \xsavebox*{<name>}[<width>][<position>]{...}
+
+ \xsbox{<name>}{...}
+
+ \begin{xlrbox}{<name>}...\end{xlrbox}
+ \begin{xlrbox*}{<name>}...\end{xlrbox*}
+
+ <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.
+
+ Starred `*' variants allow for colour injection (pdfLaTeX/LuaLaTeX
+ only).
+
+ * content insertion (referencing):
+
+ \xusebox{<name>}
+ \the<name>
+
+ The second, short form is useable if <name> is composed of [a-zA-Z].
+
+
+The package was written in the LaTeX3 syntax.
+
+
+License:
+
+This material is subject to the LaTeX Project Public License. See
+
+ http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+
+for the details of that license.
diff --git a/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
new file mode 100644
index 00000000000..7969d6d31b2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsavebox/xsavebox.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/xsavebox/files/mailto.png b/Master/texmf-dist/source/latex/xsavebox/files/mailto.png
new file mode 100644
index 00000000000..12831c2410b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/xsavebox/files/mailto.png
Binary files differ
diff --git a/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
new file mode 100644
index 00000000000..ea35dcc8039
--- /dev/null
+++ b/Master/texmf-dist/source/latex/xsavebox/xsavebox.tex
@@ -0,0 +1,187 @@
+% Copyright 2007--\today Alexander Grahn
+%
+% This material is subject to the LaTeX Project Public License. See
+% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+% for the details of that license.
+%
+\documentclass[a4paper]{article}
+\frenchspacing
+\usepackage[UKenglish]{babel}
+\usepackage{xsavebox}
+\usepackage{csquotes}
+\usepackage{graphicx}
+\graphicspath{{files/}}
+\usepackage{color}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage[protrusion,expansion]{microtype}
+\usepackage{parskip}
+\usepackage[bookmarksnumbered,linktocpage]{hyperref}
+\usepackage{fancyvrb}
+\clubpenalty=10000
+\widowpenalty=10000
+\displaywidowpenalty=10000
+\renewcommand{\textfraction}{0.0}
+\renewcommand{\topfraction}{1.0}
+\renewcommand{\bottomfraction}{1.0}
+
+\hypersetup{
+ 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},
+ citebordercolor={0 0 1},
+ filebordercolor={0 0 1},
+ linkbordercolor={0 0 1},
+ menubordercolor={0 0 1},
+ pagebordercolor={0 0 1},
+ urlbordercolor={0 0 1},
+% pdfpagelayout=SinglePage
+}
+
+%\usepackage[scaled=0.85]{luximono}
+
+\def\XeLaTeX{X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}}\kern-.125em\LaTeX}
+\def\XeTeX{X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}}\kern-.125em\TeX}
+\def\pXepLaTeX{(X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}})\kern-.125em\LaTeX}
+
+\def\parsedate#1/#2/#3\relax{
+ \def\year{#1}
+ \def\month{#2}
+ \def\day{#3}
+}
+
+\begin{document}
+\makeatletter
+\title{The {\sffamily xsavebox} Package, v\g@xsb@version@tl}
+\expandafter\parsedate\g@xsb@date@tl\relax %set current date to package date
+\makeatother
+\author{Alexander Grahn\\[1ex]\includegraphics[height=2.7ex]{mailto}}
+\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+'.
+\end{abstract}
+
+\section{Introduction}
+Whenever the standard \LaTeX{} command \verb+\usebox{+\emph{save-box}\verb+}+ is issued to insert a previously defined \emph{save-box} more than once, the typeset content stored therein is written as DVI or PDF code into the output file again. The redundant code adds to the overall file size and may impair the page caching facilities built into some PDF viewers.
+
+The PDF file format defines a powerful mechanism for packing readily typeset content once into self-contained entities, so-called \enquote{XObjects}, that can be referenced at other places within the PDF document.
+
+The `\verb+xsavebox+' package makes this PDF feature accessible on the \LaTeX{} level as a set of user commands which look similar to and are used in a similar way as the well-known \emph{save-box} related \LaTeX{} commands.
+
+All common \TeX{} engines and back-ends are supported, which are:
+\begin{itemize}
+%\item $\varepsilon$-\TeX
+\item pdf\LaTeX, Lua\LaTeX,
+\item \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller
+\item \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+
+\end{itemize}
+
+To enable `\verb+dvipdfmx+', pass it as a document class option.
+
+It should be emphasized that \enquote{XObjects} is a PDF feature. Content saved and referenced using \enquote{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.
+
+\section{User commands}
+\subsection*{Content saving}
+\vspace{-1\baselineskip}
+\hrulefill\\[-1.6\baselineskip]
+\begin{Verbatim}
+\xsbox{<xsbox name>}{<content>}
+\xsavebox{<xsbox name>}[<width>][<position>]{<content>}
+\xsavebox*{<xsbox name>}[<width>][<position>]{<content>}
+
+\begin{xlrbox}{<xsbox name>}
+ <content>
+\end{xlrbox}
+
+\begin{xlrbox*}{<xsbox name>}
+ <content>
+\end{xlrbox*}
+\end{Verbatim}
+\vspace{-1\baselineskip}
+\hrulefill\\[-1\baselineskip]
+
+The main difference of these commands as compared to their standard \LaTeX{} counterparts without the leading `\verb+x+' is the way of naming boxes. The label \verb+<xsbox name>+ is an identifier that may be composed of arbitrary non-active characters, including spaces and numbers. A command for declaring a box register \verb+<xsbox name>+ does not exist.
+
+The \verb+[<width>]+ and \verb+[<position>]+ options have the same meaning as with \verb+\savebox+ and \verb+\makebox+. As usual, the additional length commands
+\begin{Verbatim}
+ \width
+ \height
+ \depth
+ \totalheight
+\end{Verbatim}
+are defined for use in the \verb+[<width>]+ option and refer to the original dimensions of \verb+<content>+. The value of \verb+<position>+ may assume one of `\verb+l+', `\verb+r+', `\verb+c+' or `\verb+s+'. The default is `\verb+c+' for text centred in the box.
+
+\verb+<content>+ is typeset in LR-mode. Longer text to be typeset in paragraph mode must be put into a \verb+\parbox+ or `\verb+minipage+'.
+
+The starred (`\verb+*+') versions of the commands allow for later colour injection into the boxes at the place of their referencing. The colour which is active at the time of building the box is not saved with the content. This feature only works with pdf\LaTeX{} and Lua\LaTeX.
+
+Note that
+\begin{Verbatim}
+ \xsbox{image for frequent use}{\includegraphics{example}}
+\end{Verbatim}
+is useful only in the \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+ work-flow, as all other engines and back-ends already take care of preventing multiple graphics file inclusion.
+
+Verbatim content can only be saved using the `\verb+xlrbox[*]+' environment.
+
+With \LaTeX{} in DVI mode and \XeLaTeX, box \emph{saving} commands should not be placed on a line of their own with empty lines above and below. For technical reasons this will produce an empty paragraph. Always place them at the beginning or at the end of a paragraph in the input file. Also, box saving commands cannot be placed in the document preamble with \LaTeX{} (DVI) and \XeLaTeX{}.
+
+\subsection*{Referencing saved content}
+Previously saved content can be inserted with\\[-1.6\baselineskip]
+
+\hrulefill\\[-1.6\baselineskip]
+\begin{Verbatim}
+\xusebox{<xsbox name>}
+\end{Verbatim}
+\vspace{-1ex}
+or
+\vspace{-1ex}
+\begin{Verbatim}
+\the<xsbox name>
+\end{Verbatim}
+\vspace{-1\baselineskip}
+\hrulefill\\[-1\baselineskip]
+
+The second, shorthand form can be used if \verb+<xsbox name>+ is composed exclusively of letters (`\verb+a+`--`\verb+z+', `\verb+A+`--`\verb+Z+'). For example, a box named `\verb+MyFirstExample+' could be referenced as
+\begin{Verbatim}
+ \theMyFirstExample
+\end{Verbatim}
+but a box named `\verb+My 1st Example ;-)+' would require
+\begin{Verbatim}
+ \xusebox{My 1st Example ;-)}
+\end{Verbatim}
+
+The referencing commands \verb+\xusebox{<xsbox name>}+ and \verb+\the<xsbox name>+ can again be placed inside the \verb+<content>+ body of box saving commands. There is no upper limit of nesting levels.
+
+\verb+\xusebox{<xsbox name>}+ and \verb+\the<xsbox name>+ behave exacly like common \TeX{} boxes. Therefore, they can be scaled, rotated and resized using the corresponding commands from the `\verb+graphicx+' package.
+
+\section{Example}
+An example with colour injection (pdf\LaTeX/Lua\LaTeX-only) follows:
+
+\begin{xlrbox*}{SavedPar}
+ \begin{minipage}[b]{1in}
+ silly boxed paragraph that no one will ever use
+ \end{minipage}
+\end{xlrbox*}
+Here is a \fbox{\color{blue}\theSavedPar} for anything.
+
+The same \fbox{\color{green}\rotatebox{90}{\theSavedPar}} was inserted again but with a different colour and rotated by 90 degree.
+
+\begin{Verbatim}
+\usepackage{xsavebox}
+\usepackage{color}
+\usepackage{graphicx}
+...
+\begin{xlrbox*}{SavedPar}% `*' --> no colour at the time of saving
+ \begin{minipage}[b]{1in}
+ silly boxed paragraph that no one will ever use
+ \end{minipage}
+\end{xlrbox*}
+%colours injected into \theSavedPar
+Here is a \fbox{\color{blue}\theSavedPar} for anything.
+
+The same \fbox{\color{green}\rotatebox{90}{\theSavedPar}} was
+inserted again but with a different colour and rotated by 90 degree.
+\end{Verbatim}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
new file mode 100644
index 00000000000..cbbd3b25f76
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xsavebox/xsavebox.sty
@@ -0,0 +1,210 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% xsavebox.sty
+%
+% Copyright 2016--\today, Alexander Grahn
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Provides commands for saving and repeating any content (typeset text, external
+% and inline [TikZ/PGF, PSTricks] graphics) similar to standard LaTeX's
+% \savebox, \sbox, \usebox commands and the `lrbox' environment, but without
+% code replication for smaller PDF output size
+%
+% content saving:
+%
+% (starred `*' variants allow for colour injection [pdflatex/lualatex only])
+%
+% \xsavebox{<name>}[<width>][<position>]{...}
+% \xsavebox*{<name>}[<width>][<position>]{...}
+%
+% \xsbox{<name>}{...}
+%
+% \begin{xlrbox}{<name>}...\end{xlrbox}
+% \begin{xlrbox*}{<name>}...\end{xlrbox*}
+%
+% content insertion:
+%
+% \xusebox{<name>}
+% \the<name> %short form of \xusebox{<name>} for <name> composed of [a-zA-Z]
+%
+% Supports all known engines and backends including
+% pdflatex, latex+dvips+ps2pdf, xelatex, latex+dvipdfmx, lualatex.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is A. Grahn.
+
+\RequirePackage{xparse}
+\RequirePackage{pdfbase} %everything with `pbs_' prefix
+
+\def\g@xsb@version@tl{0.1}
+\def\g@xsb@date@tl{2016/02/25}
+\ProvidesExplPackage{xsavebox}{\g@xsb@date@tl}{\g@xsb@version@tl}
+{saveboxes for repeating content without code replication}
+
+\msg_set:nnnn{xsavebox}{support~outdated}{
+ Support~package~`#1'~too~old.
+}{
+ Please~install~an~up~to~date~version~of~`#1'.\\
+ Loading~xsavebox~will~abort!
+}
+\@ifpackagelater{pdfbase}{2016/02/25}{}{
+ \msg_error:nnn{xsavebox}{support~outdated}{pdfbase}
+ \tex_endinput:D
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% content insertion (referencing, actually)
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareDocumentCommand\xusebox{m}{\tl_use:c{the#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% saving content
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareDocumentCommand\xsavebox{smO{\width}O{c}m}{
+ \group_begin:
+ \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_box{ %content re-aligned
+ \makebox[#3][#4]{\color@begingroup#5\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
+ }
+ %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}{
+ %sqeezing content correctly
+ \IfBooleanTF{#1}{
+ %for colour injection
+ \hbox_set:Nn\l_xsb_box{
+ \makebox[\box_wd:N\l_xsb_raw_box][l]{
+ \makebox[#3][s]{\color@begingroup#5\color@endgroup}
+ }
+ }
+ }{
+ %no colour injection
+ \savebox\l_xsb_box[\box_wd:N\l_xsb_raw_box][l]{
+ \makebox[#3][s]{#5}
+ }
+ }
+ \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_box
+ }{
+ \xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_raw_box
+ }
+ }{
+ \xsb_process_box:nN{#2}\l_xsb_box
+ }
+ \group_end:
+}
+
+\DeclareDocumentCommand\xsbox{mm}{\xsavebox{#1}{#2}}
+
+\DeclareDocumentEnvironment{xlrbox}{m}{
+ \xsb_xlrbox:
+}{
+ \xsb_endxlrbox:n{#1}
+}
+
+\DeclareDocumentEnvironment{xlrbox*}{m}{
+ \xsb_xlrbox_star:
+}{
+ \xsb_endxlrbox_star:n{#1}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_nopar:Nn\xsb_xlrbox:{
+ \group_begin:
+ \hbox_set:Nn\l_xsb_box\bgroup\bgroup
+ \ignorespaces
+}
+
+\cs_new_nopar:Nn\xsb_endxlrbox:n{
+ \unskip
+ \egroup\egroup
+ \sbox\l_xsb_box{\hbox_unpack_clear:N\l_xsb_box}
+ \xsb_process_box:nN{#1}\l_xsb_box
+ \group_end:
+}
+
+\cs_new_nopar:Nn\xsb_xlrbox_star:{
+ \group_begin:
+ \hbox_set:Nn\l_xsb_box\bgroup\color@begingroup
+ \ignorespaces
+}
+
+\cs_new_nopar:Nn\xsb_endxlrbox_star:n{
+ \unskip
+ \color@endgroup\egroup
+ \xsb_process_box:nN{#1}\l_xsb_box
+ \group_end:
+}
+
+\cs_new_nopar:Nn\xsb_process_box:nN{ %process a readily resized (new width) box
+ %measure box
+ \tl_set:Nx\l_xsb_wd_tl{\dim_use:N\box_wd:N#2}
+ \tl_set:Nx\l_xsb_ht_tl{\dim_use:N\box_ht:N#2}
+ \tl_set:Nx\l_xsb_dp_tl{\dim_use:N\box_dp:N#2}
+ %push the box bounds somewhat to get everything while distilling, as
+ %glyphs tend to be larger than their bounding boxes
+ \hbox_set_to_wd:Nnn#2{\l_xsb_wd_tl+6pt}{\hss\hbox_unpack_clear:N#2\hss}
+ \box_set_ht:Nn#2{\l_xsb_ht_tl+3pt}
+ \box_set_dp:Nn#2{\l_xsb_dp_tl+3pt}
+ %distill box into PDF Form XObject
+ \pbs_pdfxform:nn{0}{#2}%
+ %define command for inserting the h-boxed XObject reference
+ \tl_gset:cx{the#1}{
+ \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{\dim_eval:n{-3pt}}
+ \exp_not:N\pbs_pdfrefxform:n{\pbs_pdflastxform:}\hss
+ }
+ }
+}
+
+\cs_new_nopar:Nn\xsb_process_box:nnnN{ %first distill, then put XObject ref
+ %measure natural dimensions into mbox of user defined size
+ \cs_set_nopar:Npn\width {\box_wd:N#4}
+ \cs_set_nopar:Npn\height{\box_ht:N#4}
+ \cs_set_nopar:Npn\depth {\box_dp:N#4}
+ \cs_set_nopar:Npn\totalheight{\dimexpr\height+\depth\relax}
+ \tl_set:Nx\l_xsb_wd_tl{\dim_use:N\width}
+ \tl_set:Nx\l_xsb_ht_tl{\dim_use:N\height}
+ \tl_set:Nx\l_xsb_dp_tl{\dim_use:N\depth}
+ %evaluate width argument (allowing for calc-type expressions)
+ \setlength\l_tmpa_dim{#2}
+ \tl_set:Nx\l_xsb_new_wd_tl{\dim_use:N\l_tmpa_dim}
+ \hbox_set_to_wd:Nnn#4{\width+6pt}{\hss\hbox_unpack_clear:N#4\hss}
+ \box_set_ht:Nn#4{\height+3pt}
+ \box_set_dp:Nn#4{\depth+3pt}
+ \pbs_pdfxform:nn{0}{#4}%
+ %define command for inserting the m-boxed XObject reference
+ \tl_gset:cx{the#1}{
+ \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{\dim_eval:n{-3pt}}
+ \exp_not:N\pbs_pdfrefxform:n{\pbs_pdflastxform:}\hss
+ }
+ }
+ }
+}
+
+\box_new:N\l_xsb_box %for saving the re-aligned content
+\box_new:N\l_xsb_raw_box %for saving the raw content