summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-16 23:09:50 +0000
committerKarl Berry <karl@freefriends.org>2012-05-16 23:09:50 +0000
commit5b130c1b3fb6521ac46fd1693c41b50073e53b3c (patch)
treec3ad3bc751b0bcb459e5c5dfa65276d24ae76351 /Master/texmf-dist
parent7a5a358a5c53a22bbfb2fd761f69849b9d5237de (diff)
adjustbox 1.0 (16may12)
git-svn-id: svn://tug.org/texlive/trunk@26452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/adjustbox/README38
-rw-r--r--Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdfbin0 -> 152771 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdfbin283694 -> 280660 bytes
-rw-r--r--Master/texmf-dist/doc/latex/adjustbox/trimclip.pdfbin0 -> 317094 bytes
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx413
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx3413
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/adjustbox.ins21
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/trimclip.dtx1944
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty106
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty144
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def30
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty1124
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjxetex.def46
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def (renamed from Master/texmf-dist/tex/latex/adjustbox/adjdvips.def)17
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def39
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def (renamed from Master/texmf-dist/tex/latex/adjustbox/adjpgf.def)17
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def41
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/trimclip.sty260
18 files changed, 4928 insertions, 2725 deletions
diff --git a/Master/texmf-dist/doc/latex/adjustbox/README b/Master/texmf-dist/doc/latex/adjustbox/README
index 9fae3a001e6..fd435f47739 100644
--- a/Master/texmf-dist/doc/latex/adjustbox/README
+++ b/Master/texmf-dist/doc/latex/adjustbox/README
@@ -1,22 +1,26 @@
-LaTeX package 'adjustbox'
-~~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2011 by Martin Scharrer <martin@scharrer-online.de>
-WWW: https://bitbucket.org/martin_scharrer/adjustbox (incl. bug tracker)
+LaTeX bundle adjustbox
+=========================
+Copyright (c) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+WWW: <https://bitbucket.org/martin_scharrer/adjustbox> (incl. bug tracker)
-This package provides several macros to adjust boxed content.
-One purpose is to supplement the standard 'graphics' package, which defines the macros
-\resizebox, \scalebox and \rotatebox, with the macros \trimbox and \clipbox.
-The main feature is the general \adjustbox macro which extends the key=value
-interface of \includegraphics from the 'graphicx' package, and applies it to general text
-content.
-Additional provided box macros are \lapbox, \marginbox, \minsizebox, \maxsizebox and \phantombox.
+This bundle contains the the adjustbox package and its auxiliary packages trimclip and adjcalc.
+The initial purpose of adjustbox was to supplement the standard graphics/x package,
+which defines the macros \resizebox, \scalebox and \rotatebox, with the macros \trimbox and \clipbox.
+An additional \marginbox macro is also provided.
+These macros are now placed in the dedicated package trimclip which is loaded by adjustbox.
+The package comes with clipping driver files are provided for pdftex (incl. LuaLaTeX), dvips and xetex. A
+fall-back driver which uses the pgf package is still included.
+The driver files got written by Joseph Wright (LaTeX3 project) and the package author.
-All macros use the authors other package 'collectbox' to read the content as box and not as
+The main feature of adjustbox is the general \adjustbox macro which extends the key=value
+interface of \includegraphics from the graphicx package, and applies it to general text
+content. It also provides further text/box modifications keys, macros and envionments.
+
+Both adjustbox and trimclip use the adjcalc package to allow for algebraic expressions for all length
+arguments. The adjcalc package can use either e-TeX, the calc package or the pgfmath package.
+
+All macros use the authors other package collectbox to read the content as box and not as
macro argument. This allows for all forms of content including special material like verbatim content.
-A special feature of 'collectbox' is used to provide matching environments with the identical names as the
+A special feature of collectbox is used to provide matching environments with the identical names as the
macros.
-The clipping operation is output driver dependend. At the moment the package provides
-native support for 'pdflatex'. For other output drivers the 'pgf' package is used as a general
-fall-back for all clipping operations.
-
diff --git a/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf b/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf
new file mode 100644
index 00000000000..a45d87dcb59
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf
index 0a5c1a2f528..df4ac76b7ca 100644
--- a/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf
+++ b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf b/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf
new file mode 100644
index 00000000000..4fe41a2ee2e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx b/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx
new file mode 100644
index 00000000000..912802fc1bf
--- /dev/null
+++ b/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx
@@ -0,0 +1,413 @@
+% \iffalse meta-comment
+%<=*COPYRIGHT>
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files adjcalc.dtx, adjustbox.ins
+%% and the derived file adjcalc.sty.
+%% It is part of the larger adjustbox bundle.
+%%
+%<=/COPYRIGHT>
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{adjcalc.dtx}[%
+%<=*DATE>
+ 2012/05/16
+%<=/DATE>
+%<=*VERSION>
+ v1.1
+%<=/VERSION>
+ DTX file for the adjcalc package]
+\documentclass[a4paper]{ydoc}[2011/11/16]
+\usepackage{amsmath}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{fourier}
+\usepackage{newverbs}
+\MakeSpecialShortVerb\qverb\"
+%\AtBeginDocument{\MakeShortMacroArgs\`\relax}
+%\AtEndDocument{\DeleteShortVerb\`}
+\GetFileInfo{adjcalc.dtx}
+\usepackage{adjcalc}[\filedate]
+\usepackage{tikz}
+\normalmarginpar
+
+
+%\EnableCrossrefs
+%\CodelineIndex
+%\RecordChanges
+\OnlyDescription
+\begin{document}
+ \DocInput{\jobname.dtx}
+ \PrintChanges
+ %\newpage\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{0}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v1.0}{2011/11/16}{First version after extraction from \pkg{adjustbox} package.}
+% \changes{v1.1}{2012/05/16}{Better separation from the \pkg{adjustbox} package. Added own manual.}
+%
+% \GetFileInfo{adjcalc.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
+% \bundle{adjustbox}
+% \author{Martin Scharrer}
+% \email{martin@scharrer-online.de}
+% \ydocpdfsettings
+% \maketitle
+%
+% \begin{abstract}
+% This package provides macros to assign or to add algebraic expressions to \LaTeX lengths and counters.
+% It either uses $\epsilon$-\TeX, the \pkg{calc} package or the \pkg{pgfmath} package internally to achieve this.
+% This package is part of the \pkg{adjustbox} bundle and was originally part of the \pkg{adjustbox} package before
+% it was extracted to a dedicated package.
+% \end{abstract}
+%
+% \section{Introduction}
+% \LaTeX\ lengths and counters can be set using \Macro\setlength and \Macro\setcounter,
+% and values can be added to these using \Macro\addtoclength and \Macro\addtocounter, respectively.
+% By default these macros await a single length or integer value to be assigned or added.
+% However, often it is beneficial to use a short algebraic expression, like a sum of two values, instead.
+% The \pkg{calc} package was created for this and redefines the above macros to parse the given expression.
+% Another possibility is to use $\epsilon$-\TeX's \Macro\dimexpr or \Macro\glueexpr which also allows for
+% several algebraic operations and is more efficient than the higher-level \pkg{calc} package.
+% Finally PGF/TikZ provides a large math engine with the \pkg{pgfmath} package. It allows even
+% for complicated functions like $\log$ or $\sin$. However, \pkg{pgfmath} is rather large, especially because
+% with PGF v2.10 it cannot be loaded on its own due to a bug, which forces the whole \pkg{pgf} package to be loaded.
+%
+% Package authors which like to write macros which allow algebraic expressions for its length arguments
+% now face the dilemma which math interface they should use. Either they exclude users which do not have an
+% $\epsilon$-TeX distribution (even if they are very rare) or require to load a large package.
+% This was the case with the \pkg{adjustbox} package and therefore own wrapper macros were used instead which
+% will use one of the different math engine mentioned above.
+% Because this functionality was deemed useful for other packages of the same and other authors it was
+% extracted into the dedicated package \pkg{adjcalc}. The idea is that the user can choose the used math engine
+% using package options.
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Package Options}\label{sec:options} ^^A (((
+% The following options define the way length values are processed by the provided macros.
+% The first group can be either used as package options and as local setting using \Macro\adjcalcset or as keys
+% for \Macro\adjustbox or the \env{adjustbox} environment (but not for \Macro\includegraphics even if the \opt{export}
+% option of \pkg{adjustbox} was used).
+% The only difference between using them as package options or keys is that as package option they also load required packages.
+% Therefore all keys used in the document should be used as package options first or the required packages must be loaded
+% manually.
+%
+% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
+% \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values. This allows for additions,
+% subtractions as well as multiplications and devision by a numeric factor. See the official \pkg{etex\_man} document
+% for more details. This setting is the default if $\epsilon$-\TeX\ is detected (which should be the case with all
+% modern \LaTeX\ distributions).
+% \oitem{calc} Uses the \pkg{calc} package to parse length values. It supports all operations mentioned for \opt{etex} and
+% also some other operation like \Macro\widthof{<text>}.
+% See the \pkg{calc} package manual for more details.
+% This is the default setting if $\epsilon$-TeX is not detected.
+% \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values. It supports all basic
+% numeric operations and also advanced mathematical functions.
+% See the \pkg{pgf} manual for more details.
+% Because the \pkg{pgfmath} package can't be loaded
+% independently in the current version (v2.10) the whole \pkg{pgf} package will be loaded.
+% \oitem{overwrite} This option will overwrite the standard macros with the macros of this package.
+% This e.g.\ sets \Macro\setlength to be identical to \Macro\adjsetlength.
+% Any package option used after \opt{overwrite} will still take affect before the redefinition,
+% i.e.\ the order in which \opt{overwrite} is used is not meaningful.
+% \oitem{defaultunit}\MacroArgs!{\hspace*{-1ex}}!'='<unit>\relax
+% This sets the default unit used for macros and keys which allow for unit-less values,
+% e.g.\ the \Key{trim} key of \Macro\adjustbox or the \Macro\trimbox macro of the \pkg{trimclip} package.
+% The standard default unit is the same as for \Macro\includegraphics: "bp" (big points, PostScript points).
+% However, for \LaTeX\ material \TeX\ normal unit "pt" (\TeX\ points) are better suited and will avoid rounding
+% errors which otherwise get introduced by the internal conversion.
+% The default unit is only used if the particular value is only a single number without unit,
+% but not if any mathematical operations are used.
+% If the special value |none| is used no default unit is applied and the internal check if the value is a single number
+% is by-passed. This gives a small speed bonus and can be used to avoid potential issues with complex values.
+% At this moment this setting will disable the default unit feature for the rest of the current group (i.e.\ all
+% further \Macro\adjustbox keys or globally if used as a package option) and further usages of this option will
+% have no affect. This might change in future versions of this package.
+% \end{description}
+%
+% \noindent
+% The following option can only be used as package option:
+% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
+% \oitem{none} Disables the features of this package and makes all macros use the normal \LaTeX\ equivalents,
+% e.g.\ \Macro\adjsetlength will expand to \Macro\setlength, etc.
+% This option also disables any previous set option as well as any future use of \opt{overwrite}.
+% \end{description}
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \section{Macros}
+%
+% \DescribeMacro\adjcalcset{<key=value, \ldots>}
+% This configuration macro allows to change the above mentioned options during the document.
+% Any changes are only locally to the current group/environment.
+% Please see the descriptions of the options for any limitations.
+%
+%
+% \DescribeMacro\adjsetlength{<\textbackslash lengthmacro>}{<length expression>}
+% \DescribeMacro\adjaddtolength{<\textbackslash lengthmacro>}{<length expression>}
+% \DescribeMacro\adjsetcounter{<counter name>}{<integer expression>}
+% \DescribeMacro\adjaddtocounter{<counter name>}{<integer expression>}
+% These macros can be used to set and add to \LaTeX\ length registers and counters like with the normal
+% macros \Macro\setlength, \Macro\addtolength, \Macro\setcounter and \Macro\addtocounter.
+% However, these macros allow the use of algebraic expressions, like sums and multiplications, while
+% the standard macros only await a single value.
+%
+%
+% \DescribeMacro\adjsetlengthdefault{<\textbackslash lengthmacro>}{<length expression with or without unit>}
+% This macro set the length macro but does also support length values without an explicit unit.
+% If no unit is used the default unit set by the \opt{defaultunit} option is used. The initial default unit
+% is `|bp|' (big points, i.e.\ PostScript/PDF points, 72bp=1inch).
+%
+%
+% \StopEventually{}
+% \clearpage
+% \section{Implementation}
+%
+% \iffalse
+%<*adjcalc.sty>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesPackage{adjcalc}[%
+%<!DATE>
+%<!VERSION>
+%<*DRIVER>
+ 2099/01/01 develop
+%</DRIVER>
+ Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
+%
+%
+% Use e-TeX by default if available, otherwise the \pkg{calc} package.
+% \begin{macrocode}
+\def\adjcalc@atend{%
+\begingroup
+\expandafter\ifx\csname glueexpr\endcsname\relax
+ \endgroup
+ \RequirePackage{calc}%
+ \adjcalc@calc
+ \def\adjcalc@etex{\PackageError{adjcalc}{e-TeX not available for current compiler!}}%
+\else
+ \endgroup
+ \adjcalc@etex
+\fi
+}
+% \end{macrocode}
+%
+% Initial definitions for the package options. This macros are later redefined because the same keys
+% can be used as macro options.
+% \begin{macrocode}
+\def\adjcalc@pgfmath{\AtEndOfPackage{\RequirePackage{pgf}}\def\adjcalc@atend{\adjcalc@pgfmath}}
+\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
+\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
+\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
+% \end{macrocode}
+%
+% The initial default unit is `|bp|' like for \pkg{graphicx}.
+% \begin{macrocode}
+\def\adjcalc@defaultunit{bp}%
+% \end{macrocode}
+%
+%
+% Options:
+% \begin{macrocode}
+\DeclareOptionX<adjcalc>{pgfmath}{\adjcalc@pgfmath}
+\DeclareOptionX<adjcalc>{etex}{\adjcalc@etex}
+\DeclareOptionX<adjcalc>{calc}{\adjcalc@calc}
+\DeclareOptionX<adjcalc>{none}{%
+ \let\adjcalc@atend\relax
+ \let\adjcalc@overwrite\relax
+ \def\adjsetlength{\setlength}%
+ \def\adjaddtolength{\addtolength}%
+ \def\adjsetcounter{\setcounter}%
+ \def\adjaddtocounter{\addtocounter}%
+}
+\DeclareOptionX<adjcalc>{overwrite}{\adjcalc@overwrite}
+\DeclareOptionX<adjcalc>{defaultunit}[bp]{%
+ \begingroup
+ \def\@tempa{#1}%
+ \def\@tempb{none}%
+ \ifx\@tempa\@tempb% 'none':
+ \endgroup
+ \def\adjsetlengthdefault{\adjsetlength}%
+ \else
+ \ifx\@tempb\adjcalc@defaultunit
+ \endgroup
+ % was 'none' before
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+ \else
+ \endgroup
+ \fi
+ \fi
+ \def\adjcalc@defaultunit{#1}%
+}
+\ProcessOptionsX*<adjcalc>
+\disable@keys{adjcalc}{none}
+% \end{macrocode}
+%
+%
+% \begin{macro}{\adjcalcset}
+% User level settings macro.
+% \begin{macrocode}
+\def\adjcalcset{%
+ \setkeys{adjcalc}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjcalc@etex}
+% \begin{macrocode}
+\def\adjcalc@etex{%
+ \protected\def\adjsetlength##1##2{%
+ ##1=\glueexpr(##2)\relax
+ }%
+ \protected\def\adjaddtolength##1##2{%
+ \advance##1 by \glueexpr(##2)\relax
+ }%
+ \protected\def\adjsetcounter##1##2{%
+ \@ifundefined{c@##1}%
+ {\@nocounterr{##1}}%
+ {\global\csname c@##1\endcsname\numexpr(##2)\relax}%
+ }%
+ \protected\def\adjaddtocounter##1##2{%
+ \@ifundefined{c@##1}%
+ {\@nocounterr{##1}}%
+ {\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
+ }%
+ \def\adjsetlengthdefault@##1##2{%
+ \@defaultunits##1=\glueexpr##2 \adjcalc@defaultunit\relax\@nnil
+ }%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\newif\if@adjcalc@needsdefault
+% \end{macrocode}
+%
+%
+% \begin{macro}{\adjcalc@calc}
+% This uses the underlying (re-)definitions of the normal macros (\Macro\setlength, ...) done by the \pkg{calc} package.
+% This allows to locally redefine \Macro\setlength to call \Macro\adjsetlength, etc., without causing an infinite loop.
+% \begin{macrocode}
+\def\adjcalc@calc{%
+ \DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
+ \DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
+ \DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
+ \DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
+ \def\adjsetlengthdefault@##1##2{%
+ \begingroup
+ \def\calc@post@scan####1!{%
+ \def\@tempa{####1}%
+ \ifx\@tempa\@empty
+ \endgroup% to end calc processing
+ % is number only
+ \global\@adjcalc@needsdefaulttrue
+ \else
+ \endgroup% to end calc processing
+ % full expression
+ \global\@adjcalc@needsdefaultfalse
+ \fi
+ }%
+ \calc@assign@skip{##1}{##2 \adjcalc@defaultunit}%
+ \endgroup
+ \if@adjcalc@needsdefault
+ ##1=##2 \adjcalc@defaultunit\relax
+ \else
+ \calc@assign@skip{##1}{##2}%
+ \fi
+ }%
+ \def\adjcalc@checkdefault##1\@nnil##2##3{%
+ \ifx\relax##1\relax\else
+ \calc@assign@skip{##2}{##3}%
+ \fi
+ }%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjcalc@pgfmath}
+% \begin{macrocode}
+\def\adjcalc@pgfmath{%
+ \DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
+ \DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
+ \DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
+ \DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
+ \def\adjsetlengthdefault@##1##2{%
+ \edef\pgfmathresultunitscale{1\adjcalc@defaultunit}%
+ \let\pgfmathpostparse\pgfmathscaleresult
+ \pgfmathparse{##2}%
+ ##1=\pgfmathresult pt\relax
+ }%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjcalc@overwrite}
+% \begin{macrocode}
+\def\adjcalc@overwrite{%
+ \let\setlength\adjsetlength
+ \let\addtolength\adjaddtolength
+ \let\setcounter\adjsetcounter
+ \let\addtocounter\adjaddtocounter
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Execute at-end code.
+% \begin{macrocode}
+\adjcalc@atend
+% \end{macrocode}
+% \iffalse
+%</adjcalc.sty>
+% \fi
+%
+% \Finale
+% \endinput
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
index 0f200d23afd..5c5eb67e5c7 100644
--- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
+++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%<=*COPYRIGHT>
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% 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.
@@ -20,14 +20,16 @@
%<=/COPYRIGHT>
% \fi
%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% ^^A DRIVER (((
% \iffalse
%<*driver>
\ProvidesFile{adjustbox.dtx}[%
%<=*DATE>
- 2011/11/14
+ 2012/05/16
%<=/DATE>
%<=*VERSION>
- v0.8
+ v0.9
%<=/VERSION>
DTX file for the adjustbox package]
\documentclass[a4paper]{ydoc}[2011/08/11]
@@ -42,7 +44,6 @@
\GetFileInfo{adjustbox.dtx}
\usepackage{adjustbox}[\filedate]
\usepackage{tikz}
-\normalmarginpar
\renewenvironment{example}[1][Example:]{%
\subsubsection*{#1}%
@@ -142,7 +143,9 @@
\end{document}
%</driver>
% \fi
-%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% ^^A Title page (((
% \CheckSum{0}
%
% \CharacterTable
@@ -190,6 +193,9 @@
% Added \stackbox and \Key{stack} key and \env{stackbox} environment (similar to \cs{shortstack})
% Added check for \pkg{xcolor} package.
% }
+% \changes{v0.9}{2012/05/16}{
+%
+% }
%
% \GetFileInfo{adjustbox.dtx}
%
@@ -197,6 +203,7 @@
%
% \author{Martin Scharrer}
% \email{martin@scharrer-online.de}
+% \repository{https://bitbucket.org/martin_scharrer/adjustbox}
% \ydocpdfsettings
% \maketitle
%
@@ -206,171 +213,162 @@
% \makeatother
%
% \begin{abstract}
-% This package got inspired by the \pkg{graphics/x} package and extends it sets of macros and generalises its key=value syntax for graphics to arbitray \TeX\ material.
-% Its main feature is the \Macro\adjustbox macro and the corresponding \env{adjustbox} environment which allow to adjust arbitrary \TeX\ material
-% in a multitude of ways, similar like \Macro\includegraphics does it for image files. In addition to this a wide set of dedicated macros are provided to modify a box.
-% This startet with the two macros \Macro\trimbox and \Macro\clipbox which are missing in \pkg{graphics} but was extended over time.
-%
-% The macros use the \pkg{collectbox} package to allow for verbatim content. Equivalent environments are also provided.
-% The trim operation is now implemented in \TeX\ and the clip operation uses |pdftex| primitives if available.
-% Otherwise the \pkg{pgf} package is used for clipping, which supports both DVI/PS and PDF output.
-% \\
-% \textcolor{yellow}{This package is still a little new and its implementation might not be fully stable yet.}
+% This package allows to adjust general \LATeX\ material in several ways using a key=value interface.
+% It got inspired by the interface of \Macro\includegraphics from the \pkg{graphicx} package.
+% This package also loads the \pkg{trimclip} package which code was once included in this package.
% \end{abstract}
%
-% \section{Introduction}
-% The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro \Macro\includegraphics[<options>]{<file name>} which can
-% be used to include graphic files. Several options can be used to scale, resize, rotate, trim and/or clip the graphic.
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Introduction} ^^A (((
+% The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro
+% \Macro\includegraphics[<options>]{<file name>} which can be used to include graphic files. Several options can be used
+% to scale, resize, rotate, trim and/or clip the graphic.
% The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding
% operation on \LATeX{} material, which is subsequently placed inside a \Macro\hbox.
% However no macros are provided to trim or clip \LATeX{} material, most likely because this operations
-% are not done by \TeX{} but by the output format, i.e. using PostScript (PS) or PDF operations.
+% are not done by \TeX{} but by the output format, i.e.\ using PostScript (PS) or PDF operations.
%
% This package started by providing the missing macros \Macro\clipbox and \Macro\trimbox.
-% Then a general \Macro\adjustbox macro which allows to combine many operations using a key=value syntax was added and further extended until it represented the main feature of this package.
-% Newly added keys are also provided as dedicated macros and corresponding environments.
-%
-% \subsection{Driver dependent implementation}
-% Certain operations, like clipping, depend on the output driver used, because they must be implemented as part of the output format, e.g. PDF instructions for a PDF output file.
-% The trim operation is now implemented as driver independent \TeX\ code.
-% The clip operation now uses |pdftex| primitives if possible, which are taken from the |pdftex| driver file of \pkg{graphics}.
-% For other output formats a \env{pgfpicture} environment from the \pkg{pgf} package is used,
-% which supports both PS and PDF output and comes which is own clipping drivers.
-% All \LaTeX\ compilers should be supported, but |pdflatex| is the main target of the author.
-%
-% \subsection{Dependencies}
-% The \pkg{adjustbox} package requires the author's other package \pkg{collectbox}, as well as the packages \pkg{xkeyval}, \pkg{graphicx} and \pkg{ifpdf}.
-% The \pkg{varwidth} package is automatically loaded if installed, otherwise the \Key{varwidth} and \Key{stack} keys are disables as well as \Macro\stackbox/\env{stackbox}.
-% For features which use colors the \pkg{xcolor} package must also be loaded manually (the \pkg{color} package is fine, too).
-% The experimental |split| and |pagebreak| features also require the \pkg{storebox} package.
-%
-% \section{Package Option}\label{sec:options}
-% Following v0.5 from 2011/08/13 this package accepts the following package options. Some of them can also be used as
-% optional keys for macros.
+% Then a general \Macro\adjustbox macro which allows to combine many operations using a key=value syntax was added and
+% further extended until it represented the main feature of this package. Newly added keys are also provided as
+% dedicated macros and corresponding environments.
+% The \Macro\clipbox and \Macro\trimbox macros were then moved together with the required output driver code to a
+% dedicated package \pkg{trimclip}. This allows documents and other packages to use these basic features without
+% loading the full \pkg{adjustbox} package.
+%
+%
+% ^^A )))2
+% \subsection{Dependencies} ^^A (((2
+% The \pkg{adjustbox} package and its \pkg{trimclip} sub-package require the author's other packages
+% \pkg{adjcalc} (bundled with \pkg{adjustbox}) and \pkg{collectbox}, as
+% well as the packages \pkg{xkeyval}, \pkg{graphicx} and \pkg{ifpdf}. The \pkg{varwidth} package is automatically
+% loaded if installed, otherwise the \Key{varwidth} and \Key{stack} keys are disables as well as
+% \Macro\stackbox and the \env{stackbox} environment. For features which use colors the \pkg{xcolor} package must also be loaded manually
+% (the \pkg{color} package is fine, too). The experimental |split| and |pagebreak| features also require the
+% \pkg{storebox} package to be loaded manually.
+%
+% ^^A )))2
+% \subsection{Verbatim Support}\label{sec:verbatim} ^^A (((2
+% The macros provided by \pkg{adjustbox} and \pkg{trimclip} read the content as a horizontal \TeX{} box and not as an
+% macro argument in order to support verbatim content.
+% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
+% \begin{macroquote}
+% \adjustbox{key=value,\ldots}\AlsoMacro\bgroup~<content>\AlsoMacro\egroup
+% \end{macroquote}
+% Special care is taken to allow the \meta{content} to be a single macro (except \Macro\bgroup) without any braces:
+% \begin{macroquote}
+% \adjustbox{key=value,\ldots}\AlsoMacro\somemacro
+% \end{macroquote}
+% This is to support the habit of some \LaTeX{} users to drop the braces for single token arguments.
+% All environments support verbatim content.
+% Note that the plain\TeX{} syntax for environments (\Macro\adjustbox\ldots\Macro\endadjustbox) can not be used
+% because it will trigger \Macro\adjustbox as a macro. However, the braces around the content can be replaced
+% by \Macro\bgroup and \Macro\egroup.
+%
+% ^^A )))2
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Package Options}\label{sec:options} ^^A (((
+% This package accepts the following options:
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
-% \oitem{minimal} Only define the minimal set of macros, i.e.\ \Macro\trimbox, \Macro\clipbox and \Macro\adjustbox as
-% with previous versions before v0.5.
-% \oitem{export} Export the now keys of \Macro\adjustbox also to \Macro\includegraphics so that they can be used for
-% images as well. This option is meaningless if \opt{minimal} was used.
-% \oitem{pgf} Uses the \pkg{pgf} package for all clip operations. This overrides all automatically detected drivers.
-% At the moment only a |pdftex| driver is provided, all other compilers and output formats use this option already.
-% \oitem{PGF} Uses the \pkg{pgf} package for clip operations and configures the macros to parse lengths using
-% \pkg{pgfmath} (compare with the \opt{pgf} option below).
+% \oitem{export} Exports most keys of \Macro\adjustbox to \Macro\includegraphics so that they can be used with this
+% macro as well.
+% \oitem{Export} Sets \Macro\includegraphics to be identical to \Macro\adjincludegraphics, which also allows the usage
+% of all \Macro\adjustbox keys.
+% \oitem{pgf} This option is passed to \pkg{trimclip} and makes it to use the \pkg{pgf} package for all clip operations.
+% This overrides all automatically detected drivers.
+% \oitem{PGF} This option will pass the \opt{pgf} to \pkg{trimclip} and enable the \opt{pgfmath} option of
+% \pkg{adjcalc}, i.e.\ the \pkg{pgf}
+% package is used for clip operations and the \pkg{pgfmath} pacakge is used to parse length arguments.
+% \oitem{minimal} Only load a minimal set of code, i.e.\ \pkg{trimclip} and \Macro\adjustbox/\env{adjustbox}
+% but no additional keys and macros.
% \end{description}
%
+% \noindent
% The following options define the way length values are processed by the provided macros.
-% They can be used either as package options and as keys for \Macro\adjustbox\relax (but not for \Macro\includegraphics
-% even if the \opt{export} option was used) to change the settings locally.
-% The only difference between these two usages is that they also load required packages when used as package options.
-% Therefore all keys used in the document should be loaded as package options first or the required packages must be loaded
-% manually. (It is also possible to disable the advanced parsing of lengths using the \opt{none} option, but this is not recommended.)
+% They are passed to the \Macro\adjcalcset macro of the \pkg{adjcalc} package and load any required packages.
+% These options can also be used as local keys on \Macro\adjustbox. See the \pkg{adjcalc} manual for more details on
+% them.
%
% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
-% \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values. This allows for additions,
-% subtractions as well as multiplications and devision by a numeric factor. See the official \pkg{etex\_man} document
-% for more details. This setting is the default if $\epsilon$-\TeX\ is detected (which should be the case with all
-% modern \LaTeX\ distributions).
-% \oitem{calc} Uses the \pkg{calc} package to parse length values. It supports all operations mentioned for \opt{etex} and
-% also some other operation like \Macro\widthof{<text>}.
-% See the \pkg{calc} package manual for more details.
-% This is the default setting if $\epsilon$-TeX is not detected.
-% \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values. It supports all basic
-% numeric operations and also advanced mathematical functions.
-% See the \pkg{pgf} manual for more details.
-% Because the \pkg{pgfmath} package can't be loaded
-% independently in the current version (v2.10) the whole \pkg{pgf} package will be loaded.
+% \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values.
+% \oitem{calc} Uses the \pkg{calc} package to parse length values.
+% \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values.
+% \oitem{defaultunit}\MacroArgs!{\hspace*{-1ex}}!'='<unit>\relax
+% This sets the default unit used for values which accept length without units, e.g.\ \Key{trim}.
% \end{description}
%
-% One further option exists which can also be used as optional key for \Macro\adjustbox\relax (but not for
-% \Macro\includegraphics):
-% \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
-% \oitem{defaultunit}\MacroArgs'='<unit>\relax
-% This sets the default unit used for the values of \Macro\trimbox, \Macro\clipbox and \Macro\marginbox
-% including there starred versions
-% as well as all related keys like \Key{trim}, \Key{viewport}, \Key{margin}, \Key{trim}, \Key{viewport}, \Key{Clip} and \Key{Clip*}.
-% The standard default unit is the same as for \Macro\includegraphics: "bp" (big points, PostScript points).
-% However, for \LaTeX\ material \TeX\ normal unit "pt" (\TeX\ points) are better suited and will avoid rounding
-% errors which otherwise get introduced by the internal conversion.
-% The default unit is only used if the particular value is only a single number without unit,
-% but not if any mathematical operations are used.
-% If the special value |none| is used no default unit is applied and the internal check if the value is a single number
-% is by-passed. This gives a small speed bonus and can be used to avoid potential issues with complex values.
-% At this moment this setting will disable the default unit feature for the rest of the current group (i.e.\ all
-% further \Macro\adjustbox keys or globally if used as a package option) and further usages of this option will
-% have no affect. This might change in future versions of this package.
-% \end{description}
-%
-% \subsection{Verbatim Support}\label{sec:verbatim}
-% The macros read the content as a horizontal \TeX{} box and not as an macro argument in order to support verbatim content.
-% This functionality is now provided as dedicated package \pkg{collectbox} which can also be used independently.
-% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
-% \begin{macroquote}
-% \trimbox{1 2 3 4}\AlsoMacro\bgroup~<content>\AlsoMacro\egroup
-% \end{macroquote}
-% Special care is taken to allow the \meta{text} to be a single macro (except \Macro\bgroup) without any braces:
-% \begin{macroquote}
-% \clipbox{1 2 3 4}\AlsoMacro\somemacro
-% \end{macroquote}
-% This is to support the questionable habit of some \LaTeX{} users to drop the braces for single token arguments.
-% All environments support verbatim content.
-%
-% \section{Usage}
-% This sections explains the existing features of this package.
-% Most features are available as matching macro, environment and key.
+% \noindent
+% In addition, all driver options of the \pkg{trimclip} package are also accepted and passed to it.
+% All unknown options are passed to the \pkg{graphicx} package, which might pass them down to the \pkg{graphics}
+% package.
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Main macros}^^A (((
+% The following macros and environments represent the main functionality of this package.
% Special care is taken so that the macros and the environments can have the same name.
% For starred environments the star can be either part of the name or an optional argument.
-% Also the plain\TeX{} syntax for environments (|\foobar ... \endfoobar|) can not be used
-% because it will trigger \Macro\foobar as a macro.
%
-% \subsection{Adjust Box Content}
+% \subsection{Adjust Box Content} ^^A (((2
% \vskip-\lastskip
-% \DescribeMacro\adjustbox{<key/value pairs>}{<content>}
-% The \Macro\adjustbox macro is the general form of all box modifying macros mentioned in the introduction.
-% It can be thought as an extended \Macro\includegraphics for \LATeX{} material.
-% It supports the same \meta{key/value pairs} and many more. However, they are provided as a mandatory not as an optional argument.
-% An \Macro\adjustbox without options would not make sense and can be replaced by a simple \Macro\mbox.
+% \DescribeMacro\adjustbox{<key=value, \ldots>}{<content>}
+% The \Macro\adjustbox macro allows the modification of general \LATeX\ content using a key=value syntax.
+% This can be seen as an extension of the \Macro\includegraphics macro from images to any \LATeX{} material.
+% The macro supports the all \Macro\includegraphics keys and many more.
+% However, they are provided as a mandatory not as an optional argument, because an \Macro\adjustbox without options
+% would not make sense and can be replaced by a simple \Macro\mbox.
+% As already stated the content is read as a box, not as a macro argument, therefore verbatim or other special
+% content is supported and the braces can also be replaced by \Macro\bgroup and \Macro\egroup.
% There is no starred version of this macro.
-% ^^ASee also \autoref{tab:alternatives} for a comparison of \Macro\adjustbox
-% ^^Awith the other macros.
%
% \DescribeEnv[<content>]{adjustbox}{<key=value, \ldots>}
-% The environment version of \Macro\adjustbox.
+% The environment version of \Macro\adjustbox. A difference to the macro is that it includes \Macro\noindent
+% to suppress paragraph indention.
%
-% \subsubsection*{Adjust Images}
-% \DescribeMacro\adjustimage{<key/value pairs>}{<image filename>}
+% \Needspace*{5\baselineskip}
+% \subsection{Adjust Images}
+% \vskip-\lastskip
+% \DescribeMacro\adjustimage{<key=value, \ldots>}{<image filename>}
% This macro can be used as an extension of \Macro\includegraphics.
-% While \Macro\adjustbox is based on the same interface as \Macro\includegraphics it provides more keys and allows global keys
-% set by \Macro\adjustboxset. Most keys can be exported to \Macro\includegraphics using the \opt{export} option, but there is no support
-% for global keys\footnote{However some keys, but not all, can be set globally using \Macro\setkeys{Gin}{<includegraphic key/value pairs>}}.
-% Therefore it can make sense to use \Macro\adjustbox{<key/value pairs>}{\AlsoMacro\includegraphics{<filename>}}.
-% The \Macro\adjustimage macro is a wrapper for this. However, it does not use \Macro\includegraphics directly, but an internal macro, to allow the redefinition
-% of it.
-% This does not require the \opt{export} option and therefore helps to avoid option clashes
+% While \Macro\adjustbox is based on the same interface as \Macro\includegraphics it provides more keys and allows
+% global keys set by \Macro\adjustboxset. Most keys can be exported to \Macro\includegraphics using the \opt{export}
+% option, but there is no support for global keys\footnote{However some keys, but not all, can be set globally using
+% \Macro\setkeys{Gin}{<includegraphic key=value pairs>}}. Therefore it can make sense to use
+% \Macro\adjustbox{<key/value pairs>}{\AlsoMacro\includegraphics{<filename>}}, which is the definition of
+% \Macro\adjustimage.
+% However, it does not use \Macro\includegraphics directly, but an internal macro, to allow the redefinition of
+% \Macro\includegraphics.
+% This macro does not require the \opt{export} option and therefore helps to avoid option clashes
% if \pkg{adjustbox} is loaded at several places.
%
%
% \DescribeMacro\adjincludegraphics[<key/value pairs>]{<image filename>}
-% Like \Macro\adjustimage but in the same format as \Macro\includegraphics.
-% This macro allows to use all features of \Macro\adjustbox on images, however any `|[ ]|' inside the optional argument must be wrapped in `|{ }|' to mask them.
-% It is possible to redefine \Macro\includegraphics to use/be \Macro\adjincludegraphics and this is done by
+% Like \Macro\adjustimage but in the same format as \Macro\includegraphics, i.e.\ with an optional argument. This macro
+% allows to use all features of \Macro\adjustbox on images, however special care must be taken if the values include
+% `|[ ]|'. In this case either the whole value or the while optional argument must be wrapped in `|{ }|':
+% \Macro\adjincludegraphics['key='{[..]},...]{..} or \\\Macro\adjincludegraphics[{key=[..],...}]{..}. \\
+% It is possible to redefine \Macro\includegraphics to \Macro\adjincludegraphics and this is done by
% the \opt{Export} option (not to be confused with the \opt{export} option).
%
-% \subsubsection{Setting keys globally}
%
+% \subsection{Setting keys globally} ^^A (((2
+% \vskip-\lastskip
% \DescribeMacro\adjustboxset{<global keys to be executed \emph{before} local keys>}
% \DescribeMacro\adjustboxset*{<global keys to be executed \emph{after} local keys>}
-% Using these two macros all keys can be set globally, i.e.\ for all future \Macro\adjustbox macros and \env{adjustbox} environments.
-% Note that these settings are actually \emph{local} to the current \TeX\ group and only really global if used in the preamble or outside any group.
-% The normal macro will place all given keys before the keys used in first argument of \Macro\adjustbox\ / \env{adjustbox},
-% while the starred version will place them afterwards.
+% Using these two macros all keys can be set globally, i.e.\ for all future \Macro\adjustbox macros and \env{adjustbox}
+% environments. Note that these settings are actually \emph{local} to the current \TeX\ group and only really global if
+% used in the preamble or outside any group. The normal macro will place all given keys before the keys used in first
+% argument of \Macro\adjustbox\ / \env{adjustbox}, while the starred version will place them afterwards.
%
-% If these macros are used several times there keys are accumulated. This happens in the given order for the normal version and in reversed order for the starred version,
-% i.e.\ the keys of further \Macro\adjustboxset or \Macro\adjustboxset* are always added so they face inwards.
-% If used without any keys but an empty argument, all keys previously set with the same macro are removed (from the current \TeX\ scope).
-% This means \Macro\adjustboxset{} clears all keys set be previously usages of \Macro\adjustboxset{<keys>} and \Macro\adjustboxset*{} clears all set by \Macro\adjustboxset*{<keys>}.
-% Such resets are again local to the current \TeX\ group.
+% If these macros are used several times there keys are accumulated. This happens in the given order for the normal
+% version and in reversed order for the starred version, i.e.\ the keys of further \Macro\adjustboxset or
+% \Macro\adjustboxset* are always added so they face inwards. If used without any keys but an empty argument, all keys
+% previously set with the same macro are removed (from the current \TeX\ scope). This means \Macro\adjustboxset{}
+% clears all keys set be previously usages of \Macro\adjustboxset{<keys>} and \Macro\adjustboxset*{} clears all set by
+% \Macro\adjustboxset*{<keys>}. Such resets are again local to the current \TeX\ group.
%
%
% \begin{examples}
@@ -400,167 +398,184 @@
% \end{codequote}
% \end{examples}
%
-% \subsubsection{Argument Values}\label{sec:argval}
-% All\marginpar{Parsing} length values given in the arguments of all macros and keys provided by this package are parsed by and advanced version of
-% \Macro\setlength (called \Macro\adjsetlength) which uses either $\epsilon$-\TeX\ expressions (default), the \pkg{calc} package (default fall-back)
-% or the \Macro\pgfmathparse of the \pkg{pgf} package.
-% This allows for arithmetic expressions in these arguments. See the package options in \autoref{sec:options} to learn how to change the used length parser.
-% Note that early versions of this package used \Macro\pgfmathparse by default. Older documents therefore might need now use the \opt{pgfmath} option to compile correctly.
+% ^^A )))2
+% \subsection{Argument Values}\label{sec:argval} ^^A (((2
+% All length values given in the arguments of all macros and keys provided by this package are parsed
+% by and advanced version of \Macro\setlength\relax (called \Macro\adjsetlength) which uses either $\epsilon$-\TeX\
+% expressions (default), the \pkg{calc} package (default fall-back) or the \Macro\pgfmathparse of the \pkg{pgf} package.
+% This allows for arithmetic expressions in these arguments. See the package options in \autoref{sec:options} to learn
+% how to change the used length parser. Note that early versions of this package used \Macro\pgfmathparse by default.
+% Older documents therefore might need now use the \opt{pgfmath} option to compile correctly.
%
-% Note\marginpar{Space=Separator} that the four values for \Macro\trimbox and \Macro\clipbox as well as for the \Key{trim} and \Key{viewport} option of \Macro\adjustbox
-% are separated by spaces. If the expression of any of this values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces "{ }".
+% Note that the four values for \Macro\trimbox and \Macro\clipbox as well as for the
+% \Key{trim} and \Key{viewport} option of \Macro\adjustbox are separated by spaces. If the expression of any of this
+% values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces "{ }".
%
%
% \DescribeMacros
% \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
% \endDescribeMacros
-% These \LaTeX{} lengths hold the current dimensions of the content and can be used as part all length arguments.
-% When the size of the content is changed by a key these lengths will be adjusted to hold the new size for all further keys.
-% The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for \Macro\includegraphics.
+% These \LaTeX{} lengths hold the current dimensions of the content and can be used as part all length arguments. When
+% the size of the content is changed by a key these lengths will be adjusted to hold the new size for all further keys.
+% The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for
+% \Macro\includegraphics.
%
% \DescribeMacros
% \hbox{\Macro\Width~~~\Macro\Height~~~\Macro\Depth~~~\Macro\Totalheight}%
% \endDescribeMacros
-% These \LaTeX{} lengths hold the original dimension of original unchanged content and are not modified.
-% They are useful if the size of the content is modified by several keys, but further keys should still work relative to the original content.
+% These \LaTeX{} lengths hold the original dimension of original unchanged content and are not modified. They are
+% useful if the size of the content is modified by several keys, but further keys should still work relative to the
+% original content.
%
% \subsubsection*{Default unit}
-% If no unit is provided for of the bounding box coordinates (llx, lly, urx, ury) in the trim and clip features then PostScript points
-% (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour
-% of the \Key{trim} and \Key{viewport} options of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx} converts all values, independent if a unit is provided or not,
-% internally to bp, because graphics where traditionally stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt.
-% Because the \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion to bp got disabled for them to
-% avoid unnecessary rounding errors. Since v0.5 the default unit can be changed using the |defaultunit|\MacroArgs'='<unit>\relax
-% key (which is also usable as global package option).
-%
-%
-%
-%
-% \subsection{Trimming and Clipping}
-% Material can be trimmed (the official size is made smaller, so the remaining material
-% laps over the official boundaries) and clipped (overlapping material is not displayed).
-% The original keys provided by \pkg{graphicx} are also mentioned here for comparison.
-%
-%
-% \DescribeMacro\trimbox{<llx>~<lly>~<urx>~<ury>}{<content>}
-% \DescribeMacro\trimbox{<all sites>}{<content>}
-% \DescribeMacro\trimbox{<left/right>~<top/bottom>}{<content>}
-% \DescribeMacro\trimbox*{<llx>~<lly>~<urx>~<ury>}{<content>}
-% The macro \Macro\trimbox trims the given amount from the lower left (ll) and the upper right (ur) corner of
-% the box. This means that the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and
-% \meta{urx} and \meta{ury} from the right and top of the box, respectively.
-% If only one value is given it will be used for all four sites.
-% If only two values are given the first one will be used for the left and right side (llx, urx) and the second for the bottom and top side (lly, ury).
-%
-% If the starred version is used the four coordinates are taken as the \Key{viewport} instead, i.e. the box
-% is trimmed to the rectangle described by the coordinates. In this case using all four values must be specified.
-%
-%
-% \DescribeEnv[<content>]{trimbox}{<1, 2 or 4 trim values>}
-% \vspace{-\baselineskip}
-% \DescribeEnv[<content>]{trimbox*}{<llx>~<lly>~<urx>~<ury>}
-% The \env{trimbox} and \env{trimbox*} environments do the same as the corresponding macros.
+% If no unit is provided for of the bounding box coordinates (llx, lly, urx, ury) in the trim and clip features then
+% PostScript points (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour of
+% the \Key{trim} and \Key{viewport} options of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx}
+% converts all values, independent if a unit is provided or not, internally to bp, because graphics where traditionally
+% stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt. Because the
+% \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion
+% to bp got disabled for them to avoid unnecessary rounding errors. Since v0.5 the default unit can be changed using the
+% |defaultunit|\MacroArgs'='<unit>\relax key (which is also usable as global package option).
+%
+% ^^A )))2
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Adjustbox Keys} ^^A (((
+% This packages provides the following \Macro\adjustbox keys with matching macros and environments.
+%
+% \subsection{Trimming and Clipping} ^^A (((2
+% The following keys allow content to be trimmed (i.e.\ the official size is made smaller, so the remaining material
+% laps over the official boundaries) or clipped (overlapping material is not displayed).
+% These keys come in different variants, where the lower-case keys represent the behavior of
+% the corresponding \Macro\includegraphics keys. The corresponding macros (\Macro\trimbox, \Macro\clipbox, etc.)
+% and environments (\env{trimbox}, \env{clipbox}, etc.) are included in the
+% accompanying \pkg{trimclip} package and are explained in its manual.
%
% \DescribeKey{trim}'='<llx>~<lly>~<urx>~<ury>
% \DescribeKey{trim}'='<all sites>
% \DescribeKey{trim}'='<left/right>~<top/bottom>
-% This key represents the original \Key{trim} key of \Macro\includegraphics.
-% It always trims the original content independent from its position.
+% This key represents the original \Key{trim} key of \Macro\includegraphics but accepts its value in different forms.
+% Unlike most other keys it always acts on the original content independent in which order it is used with other keys.
+% The key trims the given amounts from the lower left (ll) and the upper right (ur) corner of the box. This means that
+% the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and \meta{urx} and \meta{ury} from the
+% right and top of the box, respectively.
+% If only one value is given it will be used for all four sites.
+% If only two values are given the first one will be used for the left and right side (llx, urx) and the second for the
+% bottom and top side (lly, ury).
%
% \DescribeKey{viewport}'='<llx>~<lly>~<urx>~<ury>
% This key represents the original \Key{viewport} key of \Macro\includegraphics.
% It always trims the original content to the given view port independent from its position.
%
+% \DescribeKey{clip}
+% \DescribeKey{clip}'=true|false'
+% This boolean key represents the original \Key{clip} key of \Macro\includegraphics.
+% It is intended to be used to make \Key{trim} or \Key{viewport} clip the trimmed material.
+% Note that the material will still be part of the output file but is simply not shown.
+% It might be exported from the output file using special tools, so using it to censor classified information is a
+% bad idea.
+%
+%
% \DescribeKey{Trim}'='<llx>~<lly>~<urx>~<ury>
% \DescribeKey{Trim}'='<all sites>
% \DescribeKey{Trim}'='<left/right>~<top/bottom>
% \DescribeKey{Viewport}'='<llx>~<lly>~<urx>~<ury>
-% The normal \Key{trim} and \Key{viewport} keys
-% as described earlier are applied on the original content before any resizing
-% or other effects. This is because for \Macro\includegraphics the trimming is done by the internal graphic driver,
+% The normal \Key{trim} and \Key{viewport} keys are applied on the original content before any resizing or (most) other
+% keys take effect. This is because for \Macro\includegraphics the trimming is done by the internal graphic driver,
% while the effects can be applied later (but can also be driver dependent).
-% If the \Key{trim} and \Key{viewport} keys are used multiple times the last values will be used for the trimming, i.e. the content is only
-% trimmed once. The upper case variants \Key{trim} and \Key{viewport} will wrap the content internally in a \Macro\trimbox or \Macro\trimbox*\relax
-% macro which can be applied multiple times, e.g.\ before and after the content is rotated.
-% These two keys awaits the same format as the original keys. However, the \Key{clip} key has no effect on them.
-%
-%
-% \DescribeMacro\clipbox{<all sites>}{<content>}
-% \DescribeMacro\clipbox{<left/right>~<top/bottom>}{<content>}
-% \DescribeMacro\clipbox{<llx>~<lly>~<urx>~<ury>}{<content>}
-% \DescribeMacro\clipbox*{<llx>~<lly>~<urx>~<ury>}{<content>}
-% The \Macro\clipbox macro works like the \Macro\trimbox and trims the given amounts from the \meta{text}.
-% However, in addition the trimmed material is also clipped, i.e. it is not shown in the final document.
-% Note that the material will still be part of the output file but is simply not shown.
-% It might be exported using special tools, so using \Macro\clipbox\relax (or \Macro\includegraphics[clip,trim=...])
-% to censor classified information would be a bad idea.
-% The starred version will again use the given coordinates as \Key{viewport}.
+% If the \Key{trim} and \Key{viewport} keys are used multiple times only the last values will be used for the trimming,
+% i.e. the content is only trimmed once. The upper case variants \Key{Trim} and \Key{Viewport} will wrap the content
+% internally in a \Macro\trimbox or \Macro\trimbox*\relax macro which can be applied multiple times, e.g.\ before and
+% after the content is rotated. These two keys awaits the same format as the original keys. However, the \Key{clip} key
+% has no effect on them.
%
-% \DescribeEnv[<content>]{clipbox}{<1, 2 or 4 trim values>}
-% \vspace{-\baselineskip}
-% \DescribeEnv[<content>]{clipbox*}{<llx>~<lly>~<urx>~<ury>}
-% The environment versions of \Macro\clipbox and \Macro\clipbox*. The same rules as for the trimming environments apply.
-%
-%
-% \DescribeKey{clip}
-% This boolean key represents the original \Key{clip} key of \Macro\includegraphics.
-% It is intended to be used to make \Key{trim} or \Key{viewport} clip the trimmed material.
%
% \DescribeKey{Clip}'='<llx>~<lly>~<urx>~<ury>
% \DescribeKey{Clip}'='<all sites>
% \DescribeKey{Clip}'='<left/right>~<top/bottom>
% \DescribeKey{Clip*}'='<llx>~<lly>~<urx>~<ury>
-% As stated above the \Key{clip} boolean key
-% which will make the default \Key{trim} and \Key{viewport} keys clip the trimmed content, has no effect
-% on the \Key{trim} and \Key{viewport} keys. Instead \Key{Clip} and \Key{Clip*} are provided which wrap the content internally in a \Macro\clipbox or
-% \Macro\clipbox*\relax macro. They can be used several times.
+% The \Key{Clip} key will clip the given amounts from the current content and can be used several times if required.
+% The starred version will use the given coordinates as \Key{viewport}.
+% These keys work by wrapping the content internally in a \Macro\clipbox or \Macro\clipbox*\relax macro.
%
%
-% \subsection{Margins}
%
-% \DescribeMacro\marginbox{<all sites>}{<content>}
-% \DescribeMacro\marginbox{<left/right>~<top/bottom>}{<content>}
-% \DescribeMacro\marginbox{<llx>~<lly>~<urx>~<ury>}{<content>}
-% \Descsep
-% \DescribeEnv[<content>]{marginbox*}{<1, 2 or 4 margin values>}
-% \Descsep
+% ^^A )))2
+% \subsection{Margins and Vertical Spacing} ^^A (((2
+% \vspace{-\baselineskip}
+%
% \DescribeKey{margin}'='<all sites>
% \DescribeKey{margin}'='<left/right>~<top/bottom>
% \DescribeKey{margin}'='<llx>~<lly>~<urx>~<ury>
-% This feature can be used to add a margin (white space) around the content. It can be seen as the opposite of \Macro\trim.
+% This key can be used to add a margin (white space) around the content. It can be seen as the opposite of \Key{Trim}.
% The original baseline of the content is preserved because \meta{lly} is added to the depth.
-% It is also available as \env{marginbox} environment and also usable as \Key{margin} option (see below).
+% It is also available under the alternative name \Key{padding}, which can be used to more visually distinguish an inner
+% margin from an outer margin e.g.\ if a frame is added.
%
% \begin{example}
% \begin{examplecode}
-% Before \fbox{\marginbox{1ex 2ex 3ex 4ex}{Text}} After
+% Before \adjustbox{padding=1ex 2ex 3ex 4ex,frame,margin=1ex 2ex 3ex 4ex}{Text} After
% \end{examplecode}
% \end{example}
%
-%
-% \DescribeMacro\marginbox'*'{<all sites>}{<content>}
-% \DescribeMacro\marginbox'*'{<left/right>~<top/bottom>}{<content>}
-% \DescribeMacro\marginbox'*'{<llx>~<lly>~<urx>~<ury>}{<content>}
-% \Descsep
-% \DescribeEnv[<content>]{marginbox}{<1, 2 or 4 margin values>}
-% \Descsep
% \DescribeKey{margin*}'='<all sites>
% \DescribeKey{margin*}'='<left/right>~<top/bottom>
% \DescribeKey{margin*}'='<llx>~<lly>~<urx>~<ury>
-% This starred version is almost identical to the normal \Macro\marginbox, but also raises the content by the \MacroArgs<lly>
-% amount, so that the original depth instead of the original baseline is preserved.
-% Note that while \Macro\marginbox is basically the opposite of \Macro\trim, \Macro\marginbox* is not the opposite of \Macro\trim*.
-% Instead it also takes the same values as the normal value and not view port values like \Macro\trim*.
+% This starred version is almost identical to the normal \Key{margin} key, but also raises the content by the \MacroArgs<lly>
+% amount, so that the original depth is preserved instead of the original baseline.
+% Note that while \Key{margin} is basically the opposite of \Key{Trim}, \Key{margin*} is not the opposite of \Key{Trim*}.
+% Instead it also takes the same values as the unstarred key and not viewport values like \Key{Trim*}.
+% An alternative name of \Key{margin*} is \Key{padding*}.
%
% \begin{example}
% \begin{examplecode}
-% Before \fbox{\marginbox*{1ex 2ex 3ex 4ex}{Text}} After
+% Before \adjustbox{padding*=1ex 2ex 3ex 4ex,frame,margin*=1ex 2ex 3ex 4ex}{Text} After
% \end{examplecode}
% \end{example}
%
%
+% \DescribeKey{vspace}'='<above/below>
+% \DescribeKey{vspace}'='<above>~<below>
+% The \Key{vspace} key adds a vertical space before and after the content.
+% This is done by adding paragraph breaks and \Macro\vspace macros, which will yield better spacing between
+% paragraphs then when using the \Key{margin} key.
+% However \Key{vspace} forces vertical mode around the content. Adding further keys after \Key{vspace} will force
+% restricted horizontal mode again and the vertical space will be ignored. For this situation the \Key{margin} key is
+% better suited.
+%
+% \DescribeKey{vspace*}'='<above/below>
+% \DescribeKey{vspace*}'='<above>~<below>
+% Identical to \Key{vspace} but uses \Macro\vspace'*' instead.
+% The difference is that the vertical space is not ignored at page breaks, but its full amount is always forced.
+%
+%
+% ^^A )))2
+% \subsection{Minimum and Maximum Size} ^^A (((2
+% The following keys allow to set a minimum or maximum size.
+% The content will be scaled down or up if required.
+%
+%
+% \DescribeKey{min width}'='<width>
+% \DescribeKey{max width}'='<width>
+% \DescribeKey{min height}'='<height>
+% \DescribeKey{max height}'='<height>
+% \DescribeKey{min totalheight}'='<total height>
+% \DescribeKey{max totalheight}'='<total height>
+% These keys allow to set the minimum and maximum width, height or totalheight of the content.
+% The current size of the content is measured and the content is resized if the constraint is not already met,
+% otherwise the content is unchanged. Multiple usages of these keys are checked one after each other, and therefore
+% it is possible that a later one is undoing the size changes of an earlier one.
+% A good example is \Key{max width}'='\AlsoMacro\textwidth which will limit large content to the text width but will not affect smaller
+% content.
+%
+% \DescribeKey{min size}'='{<width>}{<height>}
+% \DescribeKey{max size}'='{<width>}{<height>}
+% \DescribeKey{min totalsize}'='{<width>}{<total height>}
+% \DescribeKey{max totalsize}'='{<width>}{<total height>}
+% These keys allow to specify the minimum or maximum width and (total)height of the content together,
+% which is more efficient than using the width and (total)height keys described earlier.
+%
%
-% \subsection{Minimum and Maximum Size}
%
% \DescribeMacro\minsizebox{<width>}{<height>}{<content>}
% \DescribeMacro\minsizebox'*'{<width>}{<totalheight>}{<content>}
@@ -570,7 +585,7 @@
% If required the content is scaled up so that the width and height is equal or larger than the given values, but does not change
% the aspect ratio.
% The star variant uses the total height instead of only the height.
-% This macro is used internally for the \Key{min width}, \Key{min height}, \Key{min totalheight} and \Key{min totalsize} options.
+% This macro is used internally for the \Key{min width}, \Key{min height}, \Key{min totalheight} and \Key{min totalsize} keys.
%
% \begin{examples}
% \begin{examplecode}
@@ -591,7 +606,6 @@
% \end{examples}
%
%
-%
% \DescribeMacro\maxsizebox{<width>}{<height>}{<content>}
% \DescribeMacro\maxsizebox'*'{<width>}{<totalheight>}{<content>}
% This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is larger
@@ -600,7 +614,7 @@
% If required the content is scaled down so that the width and height is equal or smaller than the given values, but does not change
% the aspect ratio.
% The star variant uses the total height instead of only the height.
-% This macro is used internally for the \Key{max width}, \Key{max height}, \Key{max totalheight} and \Key{max totalsize} options.
+% This macro is used internally for the \Key{max width}, \Key{max height}, \Key{max totalheight} and \Key{max totalsize} keys.
%
% \begin{examples}
% \begin{examplecode}
@@ -621,36 +635,10 @@
% \end{examples}
%
%
-% \DescribeKey{min width}'='<width>
-% \DescribeKey{max width}'='<width>
-% \DescribeKey{min height}'='<height>
-% \DescribeKey{max height}'='<height>
-% \DescribeKey{min totalheight}'='<total height>
-% \DescribeKey{max totalheight}'='<total height>
-% These keys allow to set the minimum and maximum width, height or totalheight of the content.
-% The current size of the content is measured and the content is resized if the constraint is not already met,
-% otherwise the content is unchanged. Multiple usages of these keys are checked one after each other, and therefore
-% it is possible that a later one is undoing the size changes of an earlier one.
-% A good example is \Key{max width}'='\AlsoMacro\textwidth which will limit large content to the text width but will not affect smaller
-% content.
-%
-% \DescribeKey{min size}'='{<width>}{<height>}
-% \DescribeKey{max size}'='{<width>}{<height>}
-% \DescribeKey{min totalsize}'='{<width>}{<total height>}
-% \DescribeKey{max totalsize}'='{<width>}{<total height>}
-% These keys allow to specify the minimum or maximum width and (total)height of the content together,
-% which is more efficient than using the width and (total)height keys described earlier.
-%
-%
-% \subsubsection{Scaling}
-%
-% \DescribeMacro\scalebox{<h-factor>}[<v-factor>]{<content>}
-% With only the mandatory argument the content is evenly scaled accordantly to the given factor. With the optional argument
-% a different vertical scaling factor can be given.
-% This macro is provided by the loaded \pkg{graphicx} package and only mentioned here for the sake of completeness.
-% The content is read as normal macro argument and therefore can't hold verbatim or similar special material.
-% An alternative which boxes the content directly is provided by the author's other package \pkg{realboxes} as \Macro\Scalebox and
-% as \env{Scalebox} environment.
+% ^^A )))2
+% \Needspace*{8\baselineskip}
+% \subsection{Scaling} ^^A (((2
+% \vspace{-\baselineskip}
%
% \DescribeKey{scale}'='<factor>
% \DescribeKey{scale}'='{<h-factor>}{<v-factor>}
@@ -666,18 +654,11 @@
% \end{examplecode}
% \end{examples}
%
-% \DescribeMacro\reflectbox{<content>}
-% Reflects the content like \Macro\scalebox{-1}[1] would do.
-% This macro is provided by the loaded \pkg{graphicx} package and only mentioned here for the sake of completeness.
-% The content is read as normal macro argument and therefore can't hold verbatim or similar special material.
-% An alternative which boxes the content directly is provided by the author's other package \pkg{realboxes} as \Macro\Reflectbox and
-% as \env{Reflectbox} environment.
%
% \DescribeKey{reflect}
-% This reflects the content by using \Macro\reflectbox internally, which is identical to \Macro\scalebox{-1}[1],
+% This key reflects the content by using \Macro\reflectbox internally, which is identical to \Macro\scalebox{-1}[1],
% i.e.\ this key is identical to \Key{scale}'='{-1}{1}.
%
-%
% \begin{examples}
% \begin{examplecode}
% \adjustbox{reflect}{Some text!}
@@ -685,7 +666,15 @@
% \end{examples}
%
%
-% \subsubsection{Frame}
+% \DescribeMacro\scalebox{<h-factor>}[<v-factor>]{<content>}
+% \DescribeMacro\reflectbox{<content>}
+% These macros is provided by the loaded \pkg{graphicx} package and only mentioned here for the sake of completeness.
+% See the |grfguide| for more details.
+%
+%
+% ^^A )))2
+% \subsection{Frame} ^^A (((2
+% The following keys can be used to draw frames around the content.
%
% \DescribeKey{fbox}
% \DescribeKey{fbox}'='<rule width>
@@ -703,19 +692,17 @@
% \adjustbox{fbox=1pt}{With 1pt rule width}
% \end{examplecode}
% \begin{examplecode}
-% \adjustbox{fbox=1pt 2pt}
-% {With 1pt rule width and 2pt separation}
+% \adjustbox{fbox=1pt 2pt}{With 1pt rule width and 2pt separation}
% \end{examplecode}
% \begin{examplecode}
-% \adjustbox{fbox={\fboxrule} 1pt}
-% {With normal rule width and 1pt separation}
+% \adjustbox{fbox={\fboxrule} 1pt}{With normal rule width and 1pt separation}
% \end{examplecode}
% \begin{examplecode}
-% \adjustbox{fbox=1pt 1pt 1pt}
-% {With 1pt for rule width, separation and outer margin}
+% \adjustbox{fbox=1pt 1pt 1pt}{With 1pt for rule width, separation and outer margin}
% \end{examplecode}
% \end{examples}
%
+%
% \DescribeKey{frame}
% \DescribeKey{frame}'='<rule width>
% \DescribeKey{frame}'='<rule width>~<sep>
@@ -730,6 +717,7 @@
% \end{examplecode}
% \end{examples}
%
+%
% \DescribeKey{cfbox}'='<color>
% \DescribeKey{cfbox}'='<color>~<rule width>
% \DescribeKey{cfbox}'='<color>~<rule width>~<sep>
@@ -738,11 +726,11 @@
% The \pkg{xcolor} package must be loaded manually in order for this key to work.
% \begin{example}
% \begin{examplecode}
-% \adjustbox{cfbox=blue 1pt}
-% {Like a blue \cs{fbox} with \cs{fboxrule}=1pt}
+% \adjustbox{cfbox=blue 1pt}{Like a blue \cs{fbox} with \cs{fboxrule}=1pt}
% \end{examplecode}
% \end{example}
%
+%
% \DescribeKey{cframe}'='<color>
% \DescribeKey{cframe}'='<color>~<rule width>
% \DescribeKey{cframe}'='<color>~<rule width>~<sep>
@@ -757,7 +745,9 @@
% \end{example}
%
%
-% \subsection{Vertical Alignment}
+% ^^A )))2
+% \subsection{Vertical Alignment} ^^A (((2
+% The following keys can be used to adjust the vertical alignment and size of the content.
%
% \DescribeKey{valign}'='<letter>
% This key allows to vertically align the content to the top, middle and bottom. The uppercase letters |T|, |M| and |B|
@@ -882,7 +872,9 @@
% \end{example}
%
%
-% \subsection{Horizontal Alignment}
+% ^^A )))2
+% \subsection{Horizontal Alignment} ^^A (((2
+% The following keys can be used to adjust the horizontal alignment and size of the content.
%
% \DescribeKey{center}
% \DescribeKey{center}'='<width>
@@ -957,10 +949,56 @@
% If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning.
%
%
-% \subsection{Lapping}
+% \subsection*{Lapping} ^^A (((3
% The following features can be used to make the content lap over its left or right boundary. This is basically the same
% as trimming, but provides a different, more dedicated interface.
%
+%
+% \DescribeKey{lap}'='<lap amount>
+% \DescribeKey{lap}'='{<length>}{<lap amount>}
+% This key will make the content lap over the surrounding elements to the right or left by the given amount..
+% A positive amount will make the content lap over to the right
+% and a negative one to the left. The optional \meta{length} argument allows to set the final width.
+% If not used the resulting width will be the original width minus the absolute lap amount.
+% This key internally uses \Macro\lapbox{<lap amount>}{\ldots} and \Macro\lapbox[<length>]{<lap amount>}{\ldots}, respectively.
+%
+% \begin{examples}
+% \begin{examplecode}
+% \adjustbox{lap=.5\width}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{lap=-.5\width}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{lap=\width}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{lap=-\width}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{lap={\width}{\width}}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{lap={\width}{-\width}}{Some content}
+% \end{examplecode}
+% \end{examples}
+%
+%
+% \DescribeKey{rlap}
+% \DescribeKey{llap}
+% This makes the content to be officially 0pt wide and lap over to the right or left, respectively, like the \LaTeX\ macros \Macro\rlap and \Macro\llap do.
+% These are shortcuts for \Key{lap}'='\AlsoMacro\width and \Key{lap}'=-'\AlsoMacro\width, respectively. The values for these keys are ignored and should not be used.
+%
+% \begin{examples}
+% \begin{examplecode}
+% \adjustbox{rlap}{Some content}
+% \end{examplecode}
+% \begin{examplecode}
+% \adjustbox{llap}{Some content}
+% \end{examplecode}
+% \end{examples}
+%
+%
% \DescribeMacro\lapbox[<width>]{<lap amount>}{<content>}
% This macro is a generalisation of the \LaTeX\ core macros \Macro\rlap{<content>} and \Macro\llap{<content>} which lap the
% text to the right or left without taking any official space. The \Macro\lapbox macro can be used to only partially lap
@@ -1016,52 +1054,10 @@
% \end{examples}
%
%
-% \DescribeKey{lap}'='<lap amount>
-% \DescribeKey{lap}'='{<length>}{<lap amount>}
-% This wraps the content into a
-% \Macro\lapbox{<lap amount>}{\ldots} and
-% \Macro\lapbox[<length>]{<lap amount>}{\ldots}, respectively. Positive \meta{amounts} lap the content to the right
-% and negative to the left. The optional \meta{length} argument allows to set the final width.
-%
-% \begin{examples}
-% \begin{examplecode}
-% \adjustbox{lap=.5\width}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{lap=-.5\width}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{lap=\width}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{lap=-\width}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{lap={\width}{\width}}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{lap={\width}{-\width}}{Some content}
-% \end{examplecode}
-% \end{examples}
-%
-% \DescribeKey{rlap}
-% \DescribeKey{llap}
-% This makes the content to be officially 0pt wide and lap over to the right or left, respectively, like the \LaTeX\ macros \Macro\rlap and \Macro\llap do.
-% These are shortcuts for \Key{lap}'='\AlsoMacro\width and \Key{lap}'=-'\AlsoMacro\width, respectively. The values for these keys are ignored and should not be used.
-%
-%
-% \begin{examples}
-% \begin{examplecode}
-% \adjustbox{rlap}{Some content}
-% \end{examplecode}
-% \begin{examplecode}
-% \adjustbox{llap}{Some content}
-% \end{examplecode}
-% \end{examples}
-%
-%
-%
-% \subsubsection{Background}
+% ^^A )))3
+% ^^A )))2
+% \subsection{Background} ^^A (((2
+% \vspace{-\baselineskip}
%
% \DescribeKey{bgcolor}'='<color>
% \DescribeKey{bgcolor}'='{<model>}{<color>}
@@ -1106,7 +1102,13 @@
% \DescribeMacro{\bgimagebox}[<key=value pairs>]{<image filename>}
% Standalone version of the \Key{bgimage} key. Also available as \env{bgimagebox} environment.
%
-% \subsubsection{Pixel size}
+%
+% ^^A )))2
+% \subsection{Density / Pixel size} ^^A (((2
+% The following keys allow to adjust the effective length of |pdftex| special |px| (pixel) unit.
+% This can be required for images which do not have the correct DPI meta-data included.
+%
+%
% \DescribeKey{dpi}'='<number (dots per inch)>
% The \Key{dpi} key provides a simple interface to set the pixel size to the given DPI (dots per inch) value.
% For |pdflatex| the length unit |px| can be used to specify pixels. However, the equivalent dimension (length) of one pixel must be
@@ -1138,7 +1140,8 @@
% \end{example}
%
%
-% \subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner}
+% ^^A )))2
+% \subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner} ^^A (((2
% The following keys set the way the content is processed before it is stored it in a box.
% These keys will overwrite each other and only the latest used key will take effect.
% Because they affect the inner content directly their order relative to other, normal keys is not meaningful.
@@ -1264,7 +1267,10 @@
% \end{examplecode}
% \end{example}
%
-% \subsection{Adding own Code or Environments}
+% ^^A )))2
+% \Needspace*{8\baselineskip}
+% \subsection{Adding own Code or Environments} ^^A (((2
+% \vspace{-\baselineskip}
%
% \DescribeKey{env}'='<environment name>
% \DescribeKey{env}'='{<environment name>}<environment options>
@@ -1294,7 +1300,18 @@
% Only previously used special keys for modifying the boxing of the content will have an effect yet. % All other keys are not yet processed.
%
%
-% \section{Other}
+% ^^A )))2
+% \subsection{Change or discard content} ^^A (((2
+% \vspace{-\baselineskip}
+%
+% \DescribeKey{phantom}
+% \DescribeKey{phantom}'=h'
+% \DescribeKey{phantom}'=v'
+% This key replaces the content with an empty phantom box of the same dimension.
+% If the "h" or "v" value is used the box will only have the same horizontal size or vertical sizes (height and depth)
+% while using zero for the other dimension(s). For this the standard \LaTeX\ macros \Macro\phantom, \Macro\hphantom and
+% \Macro\vphantom are used internally.
+%
%
% \DescribeMacro\phantombox{<width>}{<height>}{<depth>}
% This macro produces an empty box with the given width, height and depth.
@@ -1307,8 +1324,56 @@
% \end{example}
%
%
-% \StopEventually{}
-% \subsection{Experimental Keys}
+% \DescribeKey{gobble}
+% \DescribeKey{discard}
+% These two keys are aliases and will discard the content after it was fully processed. Any keys used after one of this
+% keys will operate on an empty content. These keys can be used in combination of the \Key{gstore ...} keys to only
+% measure but not typeset some content.
+%
+% \DescribeKey{content}'='<new content>
+% This key discards the current content completely after it was fully processed and all earlier keys were applied
+% and sets the content to the given \meta{new content}. This can be used to implement some draft box or censoring
+% features.
+%
+% \newlength\somelengtha
+% \newlength\somelengthb
+% \begin{example}
+% \begin{examplecode}
+% \adjustbox{frame,rotate=-30,gstore sizes=\somelengtha{}{}\somelengthb,
+% content={Censored!},rotate=30,totalheight=\somelengtha,width=\somelengthb,frame}
+% {The real content}
+% \end{examplecode}
+% \end{example}
+%
+%
+%
+% ^^A )))2
+% \subsection{Store box content } ^^A (((2
+%
+% \DescribeKey{gstore}'='<\textbackslash boxregister>
+% \DescribeKey{gstore*}'='<\textbackslash boxregister>
+% These keys globally store the current content into the given box register.
+% With the normal version the content is still preserved and can be further adjusted.
+% With the starred version the content will be consumed and further keys will be applied to an empty content.
+%
+% \DescribeKey{gstore width}'='<\textbackslash lengthregister>
+% \DescribeKey{gstore height}'='<\textbackslash lengthregister>
+% \DescribeKey{gstore depth}'='<\textbackslash lengthregister>
+% \DescribeKey{gstore totalheight}'='<\textbackslash lengthregister>
+% These key globally store the width, height, depth and totalheight into a length register, respectively.
+% The content will not be altered by these keys. There are no starred versions like for \Key{gstore}.
+% If the content should only be measured but not typeset the \Key{gobble}/\Key{discard} key can be used afterwards.
+%
+% \DescribeKey{gstore sizes}'='<\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister>
+% Stores all four size values (width, height, depth and totalheight) of the content in the given length registers.
+% This key should be used if more than one dimension should be stored, because it is much more efficient than using
+% multiple of the above keys.
+% If a dimension is not required it can be replaced by an empty argument, i.e.\ `|{}|'.
+% Trailing dimensions can be skipped altogether if they are not required.
+%
+%
+% ^^A )))2
+% \subsection{Experimental Keys} ^^A (((2
% The following features are experimental and may not work correctly yet.
% At the moment the \pkg{storebox} package must be loaded manually for this keys.
%
@@ -1343,18 +1408,21 @@
%
%
%
+% ^^A )))2
+% \StopEventually{}
%
% \clearpage
-% \section{Implementation}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Implementation} ^^A (((
% \setcounter{lstnumber}{1}
%
-%
% \iffalse
%<*adjustbox.sty>
% \fi
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsection{Package header, options and dependencies}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Package header, options and dependencies} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{macrocode}
%<!COPYRIGHT>
\ProvidesPackage{adjustbox}[%
@@ -1366,45 +1434,70 @@
Adjusting TeX boxes (trim, clip, ...)]
% \end{macrocode}
%
+% Load the packages required for the options.
% \begin{macrocode}
\RequirePackage{xkeyval}
+\RequirePackage{adjcalc}
+% \end{macrocode}
%
-\def\adjbox@defaultunit{bp}
-\DeclareOptionX<adjbox>{defaultunit}{%
- \def\adjbox@defaultunit{#1}%
- \begingroup
- \def\@tempa{none}%
- \expandafter\endgroup
- \ifx\@tempa\adjbox@defaultunit
- \def\adjbox@default{\adjsetlength}%
- \fi
+% Declare normal options.
+% \begin{macrocode}
+\def\adjbox@fam{adjbox}
+\DeclareOptionX<Adjbox>{export}{\def\adjbox@fam{Gin}}
+\DeclareOptionX<Adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
+\DeclareOptionX<Adjbox>{patch}{%
+ \PackageWarning{adjustbox}{%
+ The 'patch' option is now deprecated.\MessageBreak
+ Use the new \string\adjustimage\space or \string\adjincludegraphics\space macros instead%
+ \@gobble
+ }%
}
+\DeclareOptionX<Adjbox>{minimal}{\let\adjustbox@minimal\endinput}
+% \end{macrocode}
%
-\def\adjbox@fam{adjbox}
-\DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}}
-\DeclareOptionX<adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
-\DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}}
-\DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput}
+% Declare the options which must be passed to \pkg{adjcalc} in a special form,
+% because they require extra packages. This must be this way because \pkg{adjcalc}
+% is already loaded.
+% \begin{macrocode}
+\DeclareOptionX<Adjbox>{pgfmath}{\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+\DeclareOptionX<Adjbox>{calc}{\AtEndOfPackage{\RequirePackage{calc}\adjcalcset{calc}}}
+\DeclareOptionX<Adjbox>{etex}{\AtEndOfPackage{\adjcalcset{etex}}}
+\DeclareOptionX<Adjbox>{defaultunit}{\AtEndOfPackage{\adjcalcset{defaultunit={#1}}}}
+% \end{macrocode}
%
-\def\adjbox@driver{adj\Gin@driver}
-\DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}}
-\DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}}
+% Handle the special \opt{pgf} and \opt{PGF} options.
+% \begin{macrocode}
+\DeclareOptionX<Adjbox>{pgf}{\PassOptionsToPackage{pgf}{trimclip}}
+\DeclareOptionX<Adjbox>{PGF}{\PassOptionsToPackage{pgf}{trimclip}\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+% \end{macrocode}
%
-\let\adjbox@maybeend\relax
-\input{adjcalc.sty}
-\disable@keys{adjbox}{patch,export,PGF,minimal}
+% Pass all driver options to \pkg{trimclip} and all unknown options to \pkg{graphicx}.
+% \begin{macrocode}
+\DeclareOptionX*{%
+ \IfFileExists{tc-\CurrentOption.def}{%
+ \PassOptionsToPackage\CurrentOption{trimclip}%
+ }{%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
% \end{macrocode}
%
+% Process all options.
% \begin{macrocode}
-\RequirePackage{graphicx}[1999/02/16]
-\RequirePackage{collectbox}[2011/08/22]
+\ProcessOptionsX*<Adjbox>\relax
% \end{macrocode}
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsection{Basic commands}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Load the required packages.
+% \begin{macrocode}
+\RequirePackage{trimclip}
+\RequirePackage{graphicx}[1999/02/16]
+\RequirePackage{collectbox}[2012/05/13]
+% \end{macrocode}
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Basic commands} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{macro}{\adjustboxset}
% \begin{macrocode}
@@ -1455,165 +1548,6 @@
% \end{macro}
%
%
-% \begin{key}{adjbox}{viewport}
-% \begin{macrocode}
-\define@key{adjbox}{viewport}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjbox@@viewport
- \adjustbox@@@trimclip
- }%
-}
-% \end{macrocode}
-% \end{key}
-%
-%
-% \begin{key}{adjbox}{trim}
-% \begin{macrocode}
-\define@key{adjbox}{trim}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjustbox@@@trimclip
- }%
-}
-% \end{macrocode}
-% \end{key}
-%
-%
-% \begin{macro}{\adjustbox@@@trimclip}
-% \begin{macrocode}
-\def\adjustbox@@@trimclip{%
- \ifGin@clip
- \expandafter\@clipbox
- \else
- \expandafter\@trimbox
- \fi
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\adjbox@parse@v}
-% \begin{macrocode}
-\def\adjbox@parse@v#1{%
- \adjbox@parse@@v#1 {} {} {} \\%
-}
-\def\adjbox@parse@@v#1 #2 #3 #4 #5\\{%
- \adjbox@default\adjbox@tllx{#1}%
- \ifx\@nnil#2\@nnil
- \adjbox@tlly\adjbox@tllx
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@tlly{#2}%
- \ifx\@nnil#3\@nnil
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@turx{#3}%
- \adjbox@default\adjbox@tury{#4}%
- \fi
- \fi
-}%
-%%\newdimen\adjbox@llx
-%%\newdimen\adjbox@lly
-%%\newdimen\adjbox@urx
-%%\newdimen\adjbox@ury
-\newdimen\adjbox@tllx
-\newdimen\adjbox@tlly
-\newdimen\adjbox@turx
-\newdimen\adjbox@tury
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\adjbox@@viewport}
-% Turns viewport coordinates into trim coordinates.
-% \begin{macrocode}
-\def\adjbox@@viewport{%
- %\advance\adjbox@tllx by -\z@
- \advance\adjbox@tlly by \dp\collectedbox
- \advance\adjbox@turx by -\wd\collectedbox
- \advance\adjbox@tury by -\ht\collectedbox
- \adjbox@turx=-\adjbox@turx
- \adjbox@tury=-\adjbox@tury
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\trimbox}
-% \begin{macrocode}
-\newcommand\trimbox{%
- \collectboxcheckenv{trimbox}%
- \@ifstar
- \trimbox@s
- \trimbox@
-}
-\def\trimbox@#1{%
- \collectbox{\trimbox@@\@trimbox{#1}}%
-}
-\def\trimbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@trimbox}{#1}}%
-}
-\def\trimbox@@#1#2{%
- \adjbox@parse@v{#2}%
- #1%
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{environment}{trimbox*}
-% \begin{macrocode}
-\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
- \@collectboxisenv{trimbox*}%
- \trimbox@s
-}
-% \end{macrocode}
-% \end{environment}
-%
-%
-% \begin{macro}{\clipbox}
-% \begin{macrocode}
-\newcommand\clipbox{%
- \collectboxcheckenv{clipbox}%
- \@ifstar
- \clipbox@s
- \clipbox@
-}
-\def\clipbox@#1{%
- \collectbox{\trimbox@@\@clipbox{#1}}%
-}
-\def\clipbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@clipbox}{#1}}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{environment}{clipbox*}
-% \begin{macrocode}
-\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
- \@collectboxisenv{clipbox*}%
- \clipbox@s
-}
-% \end{macrocode}
-% \end{environment}
-%
%
% \begin{macro}{\adjustbox}
% Now processes the keys before the box is read to allow for parbox or similar modes.
@@ -1626,7 +1560,14 @@
% The typesetting of the content is finally done by executing the token register.
% \begin{macrocode}
\newcommand\adjustbox[1]{%
+ \begingroup
+ \edef\adjbox@line{\the\inputlineno}%
+ \let\collectbox@mode\relax
+ \let\collectbox@noindent\relax
\collectboxcheckenv{adjustbox}%
+ \ifcollectboxenv\else
+ \let\adjustbox@noindent\relax
+ \fi
\begingroup
\adjbox@setkeys{#1}%
\expandafter\expandafter\expandafter
@@ -1648,6 +1589,7 @@
\def\adjbox@setkeys{%
\setkeys*{ADJBOX}%
}
+\let\adjustbox@noindent\noindent
% \end{macrocode}
% \end{environment}
%
@@ -1669,9 +1611,11 @@
\@tempswatrue
\toks@{{\adjustbox@content}}%
\def\setlength{\adjsetlength}%
- \setkeys{adjbox,Gin}{#1}%
+ \setkeys{adjbox,Gin,adjcalc}{#1}%
\adjbox@esetsize
+ \adjustbox@noindent
\the\toks@
+ \endgroup
}
% \end{macrocode}
% \end{macro}
@@ -1753,240 +1697,92 @@
% \end{macro}
%
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsubsection{Low-level trim and clip boxes}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% \begin{macro}{\@trimbox}[5]{<tllx>}{<tlly>}{<turx>}{<tury>}{<box register>
-% Removes the four length for the left, bottom, right and top from the official size of the box register.
-% \begin{macrocode}
-\def\@trimbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip-\@tempdima
- \adjsetlength\@tempdima{\dp#5 - (#2)}%
- \adjsetlength\@tempdimb{\wd#5 - (#3)}%
- \adjsetlength\@tempdimc{\ht#5 - (#4)}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \ifdim\dp#5<\z@
- \raise\dp#5%
- \else
- \ifdim\ht#5<\z@
- \lower\ht#5%
- \fi\fi
- \box#5%
- }%
- \ifdim\dp#5<\z@ \dp#5=\z@ \fi
- \ifdim\wd#5<\z@ \wd#5=\z@ \fi
- \ifdim\ht#5<\z@ \ht#5=\z@ \fi
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@clipbox}
-% Clips the box using the given trim amounts.
-% For this the box is first trimmed and then clipped to its official size using a driver dependent macro.
+% End input of file if the \opt{minimal} option was used.
% \begin{macrocode}
-\def\@clipbox#1#2#3#4#5{%
- \@trimbox{#1}{#2}{#3}{#4}{#5}%
- \@cliptoboxdim{#5}%
-}
+{\csname adjustbox@minimal\endcsname}
% \end{macrocode}
-% \end{macro}
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsection{Driver}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% The clipping support is output driver dependent. The driver selected by \pkg{graphics} is used and a definition file
-% is used if its exists. Otherwise either the default \texttt{pdftex} implementation or the \pkg{pgf} fall-back driver
-% is used.
-% \begin{macrocode}
-\InputIfFileExists{\adjbox@driver}{%
- \PackageInfo{adjustbox}{Using driver '\adjbox@driver'.}%
-}{%
- \input{adjpgf.def}%
- \PackageInfo{adjustbox}{Using fall-back PGF driver.}
-}
-% \end{macrocode}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Internal code adding macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-%
-% Stop here if 'minimal' option was used.
-% \begin{macrocode}
-\adjbox@maybeend
-% \end{macrocode}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsection{More box commands}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% \begin{macro}{\phantombox}[3]{width}{height}{depth}
-% Produces an empty box with the given width, height and depth.
+% \begin{macro}{\adjbox@Gin@add}
% \begin{macrocode}
-\newcommand*\phantombox[3]{%
- \begingroup
- \adjsetlength\@tempdima{#1}%
- \adjsetlength\@tempdimb{#2}%
- \adjsetlength\@tempdimc{#3}%
- \setbox\collectedbox\hbox{}%
- \wd\collectedbox\@tempdima
- \ht\collectedbox\@tempdimb
- \dp\collectedbox\@tempdimc
- \leavevmode
- \box\collectedbox
- \endgroup
+\def\adjbox@Gin@add#1{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\minsizebox}
-% \begin{macrocode}
-\newcommand*\minsizebox{%
- \collectboxcheckenv{minsizebox}%
- \@ifstar{\@minsizebox\totalheight}{\@minsizebox\height}%
+\def\adjbox@Gin@Add{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjbox@Gin@add
}
% \end{macrocode}
% \end{macro}
%
-% \begin{environment}{minsizebox*}
-% \begin{macrocode}
-\expandafter\newcommand\expandafter*\csname minsizebox*\endcsname{%
- \@collectboxisenv{minsizebox*}%
- \@minsizebox\totalheight
-}
-% \end{macrocode}
-% \end{environment}
%
-%
-% \begin{macro}{\@minsizebox}
+% \begin{macro}{\adjbox@Gin@sizeadd}
+% Checks if key-value is actually two arguments. If not it is doubled.
+% E.g.: \verb+min size=\A+ is the same as \verb+min size={\A}{\A}+
% \begin{macrocode}
-\newcommand*\@minsizebox[3]{%
- \@collectbox{\@minmaxsizebox>#1{#2}{#3}}%
+\def\adjbox@Gin@sizeadd#1#2#3\relax{%
+ \ifx\@nnil#3\@nnil
+ \adjbox@Gin@add{#1{#2}{#2}}%
+ \else
+ \adjbox@Gin@add{#1{#2}{#3}}%
+ \fi
}
% \end{macrocode}
% \end{macro}
%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Keys for trimming, clipping, viewport and margin} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \begin{macro}{\maxsizebox}
-% \begin{macrocode}
-\newcommand*\maxsizebox{%
- \collectboxcheckenv{maxsizebox}%
- \@ifstar{\@maxsizebox\totalheight}{\@maxsizebox\height}%
-}
-% \end{macrocode}
-% \end{macro}
%
-% \begin{environment}{maxsizebox*}
+% \begin{key}{adjbox}{viewport}
% \begin{macrocode}
-\expandafter\newcommand\expandafter*\csname maxsizebox*\endcsname{%
- \@collectboxisenv{maxsizebox*}%
- \@maxsizebox\totalheight
+\define@key{adjbox}{viewport}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipvpbox
+ \else
+ \expandafter\@viewportbox
+ \fi
+ }{#1}%
+ }%
}
% \end{macrocode}
-% \end{environment}
+% \end{key}
%
%
-% \begin{macro}{\@maxsizebox}
+% \begin{key}{adjbox}{Viewport}
% \begin{macrocode}
-\newcommand*\@maxsizebox[3]{%
- \@collectbox{\@minmaxsizebox<#1{#2}{#3}}%
+\define@key\adjbox@fam{Viewport}{%
+ \adjbox@Gin@Add{\trimbox@s{#1}}%
}
% \end{macrocode}
-% \end{macro}
-%
+% \end{key}
%
-% \begin{macro}{\@minmaxsizebox}[4]{Compare sign \texttt{<} or \texttt{>}}{\cs{height} or \cs{totalheight}}{width}{height}
-% Used for all min/max-size boxes including the starred version. The first two arguments determine the style.
%
-% The width and height values are expanded to allow for \Macro\ifdim or similar conditionals.
-% \begin{macrocode}
-\newcommand*\@minmaxsizebox[4]{%
- \edef\@tempa{#3}%
- \edef\@tempb{#4}%
- \ifcase0%
-% \end{macrocode}
-% Do nothing if both values are `|!|', otherwise use case 1 if the height is to large/small (|#1|)
-% than the \Macro\height or \Macro\totalheight (|#2|).
-% \begin{macrocode}
- \ifx\@tempa\Gin@exclamation
- \ifx\@tempb\Gin@exclamation
- \else
- \ifdim\@tempb#1#2%
- 1%
- \fi
- \fi
- \else
-% \end{macrocode}
-% If the width is given, but not the height, use case 2 if the width is to large/small (|#1|) than the native \Macro\width.
-% \begin{macrocode}
- \ifx\@tempb\Gin@exclamation
- \ifdim\@tempa#1\width
- 2%
- \fi
- \else
-% \end{macrocode}
-% If both values are given.
-% Use case 0-3 depending if the width and/or height is to large/small.
+% \begin{key}{adjbox}{trim}
% \begin{macrocode}
- \ifdim\@tempa#1\width
- \ifdim\@tempb#1#2%
- 3%
- \else
- 2%
- \fi
+\define@key{adjbox}{trim}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipbox
\else
- \ifdim\@tempb#1#2%
- 1%
- \fi
+ \expandafter\@trimbox
\fi
- \fi
- \fi
-% \end{macrocode}
-% Case 0: no scaling is needed. Insert content unchanged.
-% \begin{macrocode}
- \relax% 0
- \BOXCONTENT
-% \end{macrocode}
-% Case 1: height needs scaling. Calculate factor and scale the content with it.
-% \begin{macrocode}
- \or
- \adjsetlength\@tempdima\@tempb
- \Gscale@div\@tempa\@tempdima#2%
- \Gscale@box\@tempa[\@tempa]\BOXCONTENT
-% \end{macrocode}
-% Case 2: width needs scaling. Calculate factor and scale the content with it.
-% \begin{macrocode}
- \or
- \adjsetlength\@tempdima\@tempa
- \Gscale@div\@tempa\@tempdima\width
- \Gscale@box\@tempa[\@tempa]\BOXCONTENT
-% \end{macrocode}
-% Case 3: both width and height need scaling.
-% Both scale factors are calculated and the more extreme value is used.
-% \begin{macrocode}
- \or
- \adjsetlength\@tempdima\@tempa
- \Gscale@div\@tempa\@tempdima\width
- \adjsetlength\@tempdima\@tempb
- \Gscale@div\@tempb\@tempdima#2%
- \ifdim\@tempa\p@#1\@tempb\p@
- \let\@tempb\@tempa
- \else
- \let\@tempa\@tempb
- \fi
- \Gscale@box\@tempa[\@tempb]\BOXCONTENT
- \fi
+ }{#1}%
+ }%
}
% \end{macrocode}
-% \end{macro}
-%
-%
+% \end{key}
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsection{New \cs{includegraphics} and \cs{adjustbox} options}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{Trim}
% \begin{macrocode}
@@ -1996,13 +1792,6 @@
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{Viewport}
-% \begin{macrocode}
-\define@key\adjbox@fam{Viewport}{%
- \adjbox@Gin@Add{\trimbox@s{#1}}%
-}
-% \end{macrocode}
-% \end{key}
%
% \begin{key}{adjbox}{Clip}
% \begin{macrocode}
@@ -2012,6 +1801,7 @@
% \end{macrocode}
% \end{key}
%
+%
% \begin{key}{adjbox}{Clip*}
% \begin{macrocode}
\define@key\adjbox@fam{Clip*}{%
@@ -2021,159 +1811,46 @@
% \end{key}
%
%
-% \begin{key}{adjbox}{frame}
-% As 0--3 arguments: rule width, (inner) separation and margin.
+% \begin{key}{adjbox}{margin}
% \begin{macrocode}
-\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
- \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
+\define@key\adjbox@fam{margin}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{fbox}
-% Same as \Key{frame} but with different default separation.
+% \begin{key}{adjbox}{margin*}
% \begin{macrocode}
-\define@key\adjbox@fam{fbox}[{{\fboxrule}}]{%
- \adjbox@frame{}#1 {} {} {} \relax\relax\@nnil
+\define@key\adjbox@fam{margin*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{macro}{\adjbox@frame}
-% \begin{macrocode}
-\def\adjbox@frame#1#2 #3 #4 #5\relax{%
- \adjbox@Gin@Add{%
- \@collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
- }%
- \remove@to@nnil
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{key}{adjbox}{cframe}
+% \begin{key}{adjbox}{padding}
+% Alias for \Key{margin}.
% \begin{macrocode}
-\define@key\adjbox@fam{cframe}{%
- \adjbox@checkcolor
- \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil
+\define@key\adjbox@fam{padding}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{cfbox}
+% \begin{key}{adjbox}{padding*}
+% Alias for \Key{margin*}.
% \begin{macrocode}
-\define@key\adjbox@fam{cfbox}{%
- \adjbox@checkcolor
- \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil
+\define@key\adjbox@fam{padding*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
}
% \end{macrocode}
% \end{key}
%
-% \begin{macro}{\adjbox@cframe}
-% \begin{macrocode}
-\def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{%
- \adjbox@Gin@Add{%
- \@collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
- }%
- \remove@to@nnil
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\adjbox@checkcolor}
-% \begin{macrocode}
-\def\adjbox@checkcolor{%
- \ifcase0%
- \expandafter\ifx\csname ver@xcolor.sty\endcsname\relax
- \expandafter\ifx\csname ver@color.sty\endcsname\relax
- \expandafter\ifx\csname ver@xxcolor.sty\endcsname\relax 1\fi\fi\fi
- \relax
- \global\let\adjbox@checkcolor\relax
- \else
- \PackageError{adjustbox}{Using a macro, envrionment or key with color\MessageBreak requires a color package to be loaded manually.\MessageBreak Recommended is 'xcolor' but 'color' is ok, too}{}.
- \fi
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\adjbox@@frame}[4]{content}{rule width}{separation}{margin}
-% \begin{macrocode}
-\def\adjbox@@frame#1#2#3#4{%
- \ifx\@nnil#2\@nnil\else
- \adjsetlength\fboxrule{#2}%
- \fi
- \ifx\@nnil#3\@nnil\else
- \adjsetlength\fboxsep{#3}%
- \fi
- \adjsetlength\adjbox@tllx{\fboxrule + \fboxsep}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
- \ifx\@nnil#4\@nnil\else
- \setbox\collectedbox
- \fi
- \hbox\bgroup\color@setgroup
- \BOXCONTENT
- \hskip-\width
- #1%
- \adjbox@boxframe\width\height\depth
- \color@endgroup\egroup
- \ifx\@nnil#4\@nnil\else
- \adjsetlength\adjbox@tllx{#4}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
- \BOXCONTENT
- \fi
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\adjbox@boxframe}
-% Tries to reuse the definition of the \pkg{xcolor} package.
-% If it isn't loaded its definition is defined here.
-%
-% This code was taken from the \pkg{xcolor} package under the free LPPL license.
-% \begin{macrocode}
-\let\adjbox@boxframe\boxframe
-\providecommand\adjbox@boxframe[3]{%
- \hbox{%
- \dimen@ #2%
- \advance \dimen@ #3\relax
- \lower #3\vbox {%
- \hrule \@height \fboxrule
- \@tempdima -0.5\fboxrule
- \ifodd\fboxrule
- \advance \@tempdima \m@ne sp
- \fi
- \kern \@tempdima
- \hbox {%
- \advance \dimen@ -\fboxrule
- \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
- \@tempdima #1%
- \advance \@tempdima -\tw@ \fboxrule
- \kern \@tempdima
- \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
- }%
- \kern -0.5\fboxrule
- \hrule \@height \fboxrule
- }%
- }%
-}
-% \end{macrocode}
-% \end{macro}
%
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Scaling and rotating keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{scale}
% \begin{macrocode}
@@ -2231,103 +1908,119 @@
% \end{key}
%
%
-% \begin{key}{adjbox}{lap}
-% \begin{macrocode}
-\define@key\adjbox@fam{lap}{%
- \@ifnextchar\bgroup{%
- \adjbox@lapbox
- }{%
- \adjbox@lapbox{#1}{}%
- }#1{}{}\@nnil
-}
-% \end{macrocode}
-% \end{key}
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Horizontal alignment keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \begin{macro}{\adjbox@lapbox}
+% \begin{macro}{\adjbox@halign}
% \begin{macrocode}
-\def\adjbox@lapbox#1#2#3\@nnil{%
- \ifx\@nnil#2\@nnil
- \adjbox@Gin@Add{\lapbox{#1}}%
- \else
- \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
- \fi
+\def\adjbox@halign#1#2#3{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjsetlength\@tempdima{#1}%
+ \edef\@tempa{\leavevmode\hb@xt@\the\@tempdima}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
}
% \end{macrocode}
% \end{macro}
%
-%
-% \begin{key}{adjbox}{rlap}
+% \begin{key}{adjbox}{center}
% \begin{macrocode}
-\define@key\adjbox@fam{rlap}[]{%
- \adjbox@Gin@Add{\lapbox{\width}}%
+\define@key\adjbox@fam{center}[\linewidth]{%
+ \adjbox@halign{#1}\hss\hss
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{llap}
+% \begin{key}{adjbox}{left}
% \begin{macrocode}
-\define@key\adjbox@fam{llap}[]{%
- \adjbox@Gin@Add{\lapbox{-\width}}%
+\define@key\adjbox@fam{left}[\linewidth]{%
+ \adjbox@halign{#1}\relax\hss
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{margin}
+% \begin{key}{adjbox}{right}
% \begin{macrocode}
-\define@key\adjbox@fam{margin}{%
- \adjbox@Gin@Add{\marginbox@{#1}}%
+\define@key\adjbox@fam{right}[\linewidth]{%
+ \adjbox@halign{#1}\hss\relax
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{margin*}
+% \begin{key}{adjbox}{outer}
% \begin{macrocode}
-\define@key\adjbox@fam{margin*}{%
- \adjbox@Gin@Add{\marginbox@s{#1}}%
+\define@key\adjbox@fam{outer}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\hss\relax}%
+ {\@tempa\relax\hss}%
+ \else
+ \@tempa\hss\hss
+ \fi
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{dpi}
+% \begin{key}{adjbox}{inner}
% \begin{macrocode}
-\define@key\adjbox@fam{dpi}{%
- \adjsetlength\pdfpxdimen{1in/(#1)}%
+\define@key\adjbox@fam{inner}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\relax\hss}%
+ {\@tempa\hss\relax}%
+ \else
+ \@tempa\hss\hss
+ \fi
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{pxdim}
+% \begin{macro}{\adjbox@ifoddpage}
% \begin{macrocode}
-\define@key\adjbox@fam{pxdim}{%
- \adjsetlength\pdfpxdimen{#1}%
+\def\adjbox@ifoddpage{%
+ \begingroup
+ \adjbox@checkoddpage
+ \expandafter\endgroup
+ \ifoddpage
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
}
% \end{macrocode}
-% \end{key}
+% \end{macro}
%
%
+% \begin{macro}{\adjbox@checkoddpage}
% \begin{macrocode}
-\define@key\adjbox@fam{execute}{%
- #1%
-}
+\def\adjbox@checkoddpage{%
+ \ifodd\c@page
+ \oddpagetrue
+ \else
+ \oddpagefalse
+ \fi
+}%
% \end{macrocode}
+% \end{macro}
%
% \begin{macrocode}
-\define@key\adjbox@fam{@debug}[]{%
- \showthe\toks@
-}
+\newif\ifoddpage
+\AtBeginDocument{%
+ \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
+ {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
+}%
% \end{macrocode}
%
-% \begin{macrocode}
-\define@key{ADJBOX}{Execute}{%
- #1%
-}
-% \end{macrocode}
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Vertical alignment keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{adjbox}{raise}
% \begin{macrocode}
@@ -2372,10 +2065,10 @@
% \begin{macrocode}
\def\adjbox@@raisebox#1#2#3{%
\ifx\@nnil#1\@nnil
- \setbox\@tempboxa\box\collectedbox
+ \setbox\@tempboxa\copy\collectedbox
\else
\adjsetlength\@tempdima{#1}%
- \sbox\@tempboxa{\raise\@tempdima\box\collectedbox}%
+ \setbox\@tempboxa\hbox{\raise\@tempdima\copy\collectedbox}%
\fi
\ifx\@nnil#2\@nnil\else
\adjsetlength\@tempdima{#2}%
@@ -2478,456 +2171,824 @@
% \end{macro}
%
%
-% \begin{key}{adjbox}{bgcolor}
-% Adds a colored box in the background.
-% |#1| are the argument to color, i.e. either \MacroArgs<color>
-% or \MacroArgs{<model>}{<color>}.
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Set vertical sizes} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{set height}
% \begin{macrocode}
-\define@key\adjbox@fam{bgcolor}{%
- \adjbox@checkcolor
- \@ifnextchar\bgroup{%
- \adjbox@bgcolor
- }{%
- \adjbox@bgcolor{}{#1}%
- }#1\@nnil
+\define@key\adjbox@fam{set height}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
}
% \end{macrocode}
% \end{key}
%
%
-% \begin{macro}{\adjbox@bgcolor}
-% Parses the two possible arguments and adds the background color macro
-% to the token register.
+% \begin{key}{adjbox}{set depth}
% \begin{macrocode}
-\def\adjbox@bgcolor#1#2#3\@nnil{%
- \ifx\@nnil#1\@nnil
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color{#2}}}}%
+\define@key\adjbox@fam{set depth}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{set vsize}
+% Uses the same code like \Key{raise} but with the raise value of 0pt,
+% i.e.\ only sets the height and depth.
+% \begin{macrocode}
+\define@key\adjbox@fam{set vsize}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
+}
+% \end{macrocode}
+% \end{key}
+%
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Vertical spacing} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{vspace}
+% \begin{macrocode}
+\define@key\adjbox@fam{vspace}{%
+ \adjbox@vskip#1 {} \@nnil{}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{vspace*}
+% \begin{macrocode}
+\define@key\adjbox@fam{vspace*}{%
+ \adjbox@vskip#1 {} \@nnil*%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{macro}{\adjbox@vskip}
+% \begin{macrocode}
+\def\adjbox@vskip#1 #2 #3\@nnil#4{%
+ \ifx\@nnil#2\@nnil
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#1}}%
\else
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#2}}%
\fi
}
% \end{macrocode}
% \end{macro}
%
-% \begin{key}{adjbox}{bgcolor*}
-% Adds a colored box in the background. It awaits a direct color macro,
-% which gives the user more flexibility.
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Minimum and maximum size keys and macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{min width}
% \begin{macrocode}
-\define@key\adjbox@fam{bgcolor*}{%
- \adjbox@checkcolor
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{#1}}}%
+\define@key\adjbox@fam{min width}{%
+ \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
}
% \end{macrocode}
% \end{key}
%
%
-% \begin{macro}{\adjbox@@bgcolor}
-% This places a colored box (vrule) with the same dimensions than
-% the content, then compensates for the horizontal shift and places
-% the content. This is simpler and more direct than using \Macro\rlap
-% or a box macro from the \pkg{xcolor} package.
+% \begin{key}{adjbox}{max width}
+% \begin{macrocode}
+\define@key\adjbox@fam{max width}{%
+ \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
+}
+% \end{macrocode}
+% \end{key}
%
-% The argument contains the color macro, e.g.\ \Macro\color{<color>}.
+%
+% \begin{key}{adjbox}{min height}
% \begin{macrocode}
-\def\adjbox@@bgcolor#1{%
- \mbox{%
- \hbox{%
- #1%
- \vrule\@width\width\@height\height\@depth\depth%
- }%
- \hskip-\width
- \BOXCONTENT
- }%
-}%
+\define@key\adjbox@fam{min height}{%
+ \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
+}
% \end{macrocode}
-% \end{macro}
+% \end{key}
%
%
-% \begin{key}{adjbox}{set height}
+% \begin{key}{adjbox}{max height}
% \begin{macrocode}
-\define@key\adjbox@fam{set height}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
+\define@key\adjbox@fam{max height}{%
+ \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
}
% \end{macrocode}
% \end{key}
%
%
-% \begin{key}{adjbox}{set depth}
+% \begin{key}{adjbox}{min totalheight}
% \begin{macrocode}
-\define@key\adjbox@fam{set depth}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
+\define@key\adjbox@fam{min totalheight}{%
+ \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{set vsize}
-% Uses the same code like \Key{raise} but with the raise value of 0pt,
-% i.e.\ only sets the height and depth.
+%
+% \begin{key}{adjbox}{max totalheight}
% \begin{macrocode}
-\define@key\adjbox@fam{set vsize}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
+\define@key\adjbox@fam{max totalheight}{%
+ \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
}
% \end{macrocode}
% \end{key}
%
%
+% \begin{key}{adjbox}{min size}
+% \begin{macrocode}
+\define@key\adjbox@fam{min size}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
+}
+% \end{macrocode}
+% \end{key}
+%
%
-% \begin{macro}{\adjbox@Gin@add}
+% \begin{key}{adjbox}{max size}
% \begin{macrocode}
-\def\adjbox@Gin@add#1{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
+\define@key\adjbox@fam{max size}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
}
-\def\adjbox@Gin@Add{%
- \Gin@esetsize
- \@tempswatrue
- \adjbox@Gin@add
+% \end{macrocode}
+% \end{key}
+%
+%
+% \begin{key}{adjbox}{min totalsize}
+% \begin{macrocode}
+\define@key\adjbox@fam{min totalsize}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+}
+% \end{macrocode}
+% \end{key}
+%
+%
+% \begin{key}{adjbox}{max totalsize}
+% \begin{macrocode}
+\define@key\adjbox@fam{max totalsize}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{warn width}
+% \begin{macrocode}
+\define@key\adjbox@fam{warn width}[\linewidth]{%
+ \adjust@addcode{\@collectbox{%
+ \@tempdima=#1\relax
+ \ifdim\width>\@tempdima
+ \advance\@tempdima by -\width
+ \@tempdima=-\@tempdima
+ \typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
+ \ifnum\adjbox@line=\inputlineno
+ line \adjbox@line
+ \else
+ lines \adjbox@line--\the\inputlineno
+ \fi
+ }%
+ \fi
+ \BOXCONTENT
+ }}{}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{macro}{\minsizebox}
+% \begin{macrocode}
+\newcommand*\minsizebox{%
+ \collectboxcheckenv{minsizebox}%
+ \@ifstar{\@minsizebox\totalheight}{\@minsizebox\height}%
}
% \end{macrocode}
% \end{macro}
%
+% \begin{environment}{minsizebox*}
+% \begin{macrocode}
+\expandafter\newcommand\expandafter*\csname minsizebox*\endcsname{%
+ \@collectboxisenv{minsizebox*}%
+ \@minsizebox\totalheight
+}
+% \end{macrocode}
+% \end{environment}
%
-% \begin{macro}{\adjbox@Gin@sizeadd}
-% Checks if key-value is actually two arguments. If not it is doubled.
-% E.g.: \verb+min size=\A+ is the same as \verb+min size={\A}{\A}+
+%
+% \begin{macro}{\@minsizebox}
% \begin{macrocode}
-\def\adjbox@Gin@sizeadd#1#2#3\relax{%
- \ifx\@nnil#3\@nnil
- \adjbox@Gin@add{#1{#2}{#2}}%
- \else
- \adjbox@Gin@add{#1{#2}{#3}}%
- \fi
+\newcommand*\@minsizebox[3]{%
+ \@collectbox{\@minmaxsizebox>#1{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
%
%
+% \begin{macro}{\maxsizebox}
+% \begin{macrocode}
+\newcommand*\maxsizebox{%
+ \collectboxcheckenv{maxsizebox}%
+ \@ifstar{\@maxsizebox\totalheight}{\@maxsizebox\height}%
+}
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\adjbox@halign}
+% \begin{environment}{maxsizebox*}
% \begin{macrocode}
-\def\adjbox@halign#1#2#3{%
- \Gin@esetsize
- \@tempswatrue
- \adjsetlength\@tempdima{#1}%
- \edef\@tempa{\hb@xt@\the\@tempdima}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
+\expandafter\newcommand\expandafter*\csname maxsizebox*\endcsname{%
+ \@collectboxisenv{maxsizebox*}%
+ \@maxsizebox\totalheight
+}
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{macro}{\@maxsizebox}
+% \begin{macrocode}
+\newcommand*\@maxsizebox[3]{%
+ \@collectbox{\@minmaxsizebox<#1{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{key}{adjbox}{center}
+%
+% \begin{macro}{\@minmaxsizebox}[4]{Compare sign \texttt{<} or \texttt{>}}{\cs{height} or \cs{totalheight}}{width}{height}
+% Used for all min/max-size boxes including the starred version. The first two arguments determine the style.
+%
+% The width and height values are expanded to allow for \Macro\ifdim or similar conditionals.
% \begin{macrocode}
-\define@key\adjbox@fam{center}[\linewidth]{%
- \adjbox@halign{#1}\hss\hss
+\newcommand*\@minmaxsizebox[4]{%
+ \edef\@tempa{#3}%
+ \edef\@tempb{#4}%
+ \ifcase0%
+% \end{macrocode}
+% Do nothing if both values are `|!|', otherwise use case 1 if the height is to large/small (|#1|)
+% than the \Macro\height or \Macro\totalheight (|#2|).
+% \begin{macrocode}
+ \ifx\@tempa\Gin@exclamation
+ \ifx\@tempb\Gin@exclamation
+ \else
+ \ifdim\@tempb#1#2%
+ 1%
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% If the width is given, but not the height, use case 2 if the width is to large/small (|#1|) than the native \Macro\width.
+% \begin{macrocode}
+ \ifx\@tempb\Gin@exclamation
+ \ifdim\@tempa#1\width
+ 2%
+ \fi
+ \else
+% \end{macrocode}
+% If both values are given.
+% Use case 0-3 depending if the width and/or height is to large/small.
+% \begin{macrocode}
+ \ifdim\@tempa#1\width
+ \ifdim\@tempb#1#2%
+ 3%
+ \else
+ 2%
+ \fi
+ \else
+ \ifdim\@tempb#1#2%
+ 1%
+ \fi
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% Case 0: no scaling is needed. Insert content unchanged.
+% \begin{macrocode}
+ \relax% 0
+ \BOXCONTENT
+% \end{macrocode}
+% Case 1: height needs scaling. Calculate factor and scale the content with it.
+% \begin{macrocode}
+ \or
+ \adjsetlength\@tempdima\@tempb
+ \Gscale@div\@tempa\@tempdima#2%
+ \Gscale@box\@tempa[\@tempa]\BOXCONTENT
+% \end{macrocode}
+% Case 2: width needs scaling. Calculate factor and scale the content with it.
+% \begin{macrocode}
+ \or
+ \adjsetlength\@tempdima\@tempa
+ \Gscale@div\@tempa\@tempdima\width
+ \Gscale@box\@tempa[\@tempa]\BOXCONTENT
+% \end{macrocode}
+% Case 3: both width and height need scaling.
+% Both scale factors are calculated and the more extreme value is used.
+% \begin{macrocode}
+ \or
+ \adjsetlength\@tempdima\@tempa
+ \Gscale@div\@tempa\@tempdima\width
+ \adjsetlength\@tempdima\@tempb
+ \Gscale@div\@tempb\@tempdima#2%
+ \ifdim\@tempa\p@#1\@tempb\p@
+ \let\@tempb\@tempa
+ \else
+ \let\@tempa\@tempb
+ \fi
+ \Gscale@box\@tempa[\@tempb]\BOXCONTENT
+ \fi
}
% \end{macrocode}
-% \end{key}
+% \end{macro}
%
-% \begin{key}{adjbox}{left}
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Frame keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+% \begin{key}{adjbox}{frame}
+% As 0--3 arguments: rule width, (inner) separation and margin.
% \begin{macrocode}
-\define@key\adjbox@fam{left}[\linewidth]{%
- \adjbox@halign{#1}\relax\hss
+\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
+ \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{right}
+%
+% \begin{key}{adjbox}{fbox}
+% Same as \Key{frame} but with different default separation.
% \begin{macrocode}
-\define@key\adjbox@fam{right}[\linewidth]{%
- \adjbox@halign{#1}\hss\relax
+\define@key\adjbox@fam{fbox}[{{\fboxrule}}]{%
+ \adjbox@frame{}#1 {} {} {} \relax\relax\@nnil
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{outer}
+%
+% \begin{macro}{\adjbox@frame}
% \begin{macrocode}
-\define@key\adjbox@fam{outer}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\hss\relax}%
- {\@tempa\relax\hss}%
- \else
- \@tempa\hss\hss
- \fi
+\def\adjbox@frame#1#2 #3 #4 #5\relax{%
+ \adjbox@Gin@Add{%
+ \@collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
+ }%
+ \remove@to@nnil
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{key}{adjbox}{cframe}
+% \begin{macrocode}
+\define@key\adjbox@fam{cframe}{%
+ \adjbox@checkcolor
+ \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{inner}
+% \begin{key}{adjbox}{cfbox}
% \begin{macrocode}
-\define@key\adjbox@fam{inner}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\relax\hss}%
- {\@tempa\hss\relax}%
- \else
- \@tempa\hss\hss
- \fi
+\define@key\adjbox@fam{cfbox}{%
+ \adjbox@checkcolor
+ \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil
}
% \end{macrocode}
% \end{key}
%
-% \begin{macro}{\adjbox@ifoddpage}
+% \begin{macro}{\adjbox@cframe}
% \begin{macrocode}
-\def\adjbox@ifoddpage{%
- \begingroup
- \adjbox@checkoddpage
- \expandafter\endgroup
- \ifoddpage
- \expandafter\@firstoftwo
+\def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{%
+ \adjbox@Gin@Add{%
+ \@collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
+ }%
+ \remove@to@nnil
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjbox@checkcolor}
+% \begin{macrocode}
+\def\adjbox@checkcolor{%
+ \ifcase0%
+ \expandafter\ifx\csname ver@xcolor.sty\endcsname\relax
+ \expandafter\ifx\csname ver@color.sty\endcsname\relax
+ \expandafter\ifx\csname ver@xxcolor.sty\endcsname\relax 1\fi\fi\fi
+ \relax
+ \global\let\adjbox@checkcolor\relax
\else
- \expandafter\@secondoftwo
+ \PackageError{adjustbox}{Using a macro, environment or key with color\MessageBreak
+ requires a color package to be loaded manually.\MessageBreak
+ Recommended is 'xcolor' but 'color' is ok, too}{}.
\fi
}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\adjbox@checkoddpage}
+% \begin{macro}{\adjbox@@frame}[4]{content}{rule width}{separation}{margin}
% \begin{macrocode}
-\def\adjbox@checkoddpage{%
- \ifodd\c@page
- \oddpagetrue
- \else
- \oddpagefalse
+\def\adjbox@@frame#1#2#3#4{%
+ \ifx\@nnil#2\@nnil\else
+ \adjsetlength\fboxrule{#2}%
\fi
-}%
+ \ifx\@nnil#3\@nnil\else
+ \adjsetlength\fboxsep{#3}%
+ \fi
+ \adjsetlength\tc@llx{\fboxrule + \fboxsep}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
+ \ifx\@nnil#4\@nnil\else
+ \setbox\collectedbox
+ \fi
+ \hbox\bgroup\color@setgroup
+ \BOXCONTENT
+ \hskip-\width
+ #1%
+ \adjbox@boxframe\width\height\depth
+ \color@endgroup\egroup
+ \ifx\@nnil#4\@nnil\else
+ \adjsetlength\tc@llx{#4}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
+ \BOXCONTENT
+ \fi
+}
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\adjbox@boxframe}[3]{width}{height}{depth}
+% Tries to reuse the definition of the \pkg{xcolor} package.
+% If it isn't loaded its definition is defined here.
+%
+% This code was taken from the \pkg{xcolor} package under the free LPPL license.
% \begin{macrocode}
-\newif\ifoddpage
-\AtBeginDocument{%
- \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
- {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
-}%
+\let\adjbox@boxframe\boxframe
+\providecommand\adjbox@boxframe[3]{%
+ \hbox{%
+ \dimen@ #2%
+ \advance \dimen@ #3\relax
+ \lower #3\vbox {%
+ \hrule \@height \fboxrule
+ \@tempdima -0.5\fboxrule
+ \ifodd\fboxrule
+ \advance \@tempdima \m@ne sp
+ \fi
+ \kern \@tempdima
+ \hbox {%
+ \advance \dimen@ -\fboxrule
+ \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
+ \@tempdima #1%
+ \advance \@tempdima -\tw@ \fboxrule
+ \kern \@tempdima
+ \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
+ }%
+ \kern -0.5\fboxrule
+ \hrule \@height \fboxrule
+ }%
+ }%
+}
% \end{macrocode}
+% \end{macro}
%
-% \begin{key}{adjbox}{min width}
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Density keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{dpi}
% \begin{macrocode}
-\define@key\adjbox@fam{min width}{%
- \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
+\define@key\adjbox@fam{dpi}{%
+ \adjsetlength\pdfpxdimen{1in/(#1)}%
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{max width}
+% \begin{key}{adjbox}{pxdim}
% \begin{macrocode}
-\define@key\adjbox@fam{max width}{%
- \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
+\define@key\adjbox@fam{pxdim}{%
+ \adjsetlength\pdfpxdimen{#1}%
}
% \end{macrocode}
% \end{key}
%
%
-% \begin{key}{adjbox}{min height}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Code keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
% \begin{macrocode}
-\define@key\adjbox@fam{min height}{%
- \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
+\define@key\adjbox@fam{execute}{%
+ #1%
}
% \end{macrocode}
-% \end{key}
%
+% \begin{macrocode}
+\define@key\adjbox@fam{@debug}[]{%
+ \showthe\toks@
+}
+% \end{macrocode}
%
-% \begin{key}{adjbox}{max height}
% \begin{macrocode}
-\define@key\adjbox@fam{max height}{%
- \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
+\define@key{ADJBOX}{Execute}{%
+ #1%
}
% \end{macrocode}
-% \end{key}
%
%
-% \begin{key}{adjbox}{min totalheight}
+% \begin{key}{adjbox}{addcode}
+% Adds code before and after the current boxed content.
+% Syntax:~\Key{addcode}'='{<code before>}{<code afterwards>}
% \begin{macrocode}
-\define@key\adjbox@fam{min totalheight}{%
- \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
+\define@key{adjbox}{Addcode}{%
+ \adjust@@addcode#1{}\@nnil%
+}
+\define@key{adjbox}{addcode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@@addcode#1{}\@nnil%
+}
+\long\def\adjust@@addcode#1#2#3\@nnil{%
+ \ifx\@nnil#3\@nnil
+ \adjust@addcode{#1}{#2}%
+ \else
+ \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
+ \fi
}
% \end{macrocode}
% \end{key}
%
-%
-% \begin{key}{adjbox}{max totalheight}
+% \begin{key}{adjbox}{precode}
% \begin{macrocode}
-\define@key\adjbox@fam{max totalheight}{%
- \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
+\define@key{adjbox}{precode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@addcode{#1}{}%
}
% \end{macrocode}
% \end{key}
%
+% \begin{key}{adjbox}{Precode}
+% Same as \Key{precode} but does not set the size yet.
+% \begin{macrocode}
+\define@key{adjbox}{Precode}{%
+ \adjust@addcode{#1}{}%
+}
+% \end{macrocode}
+% \end{key}
%
-% \begin{key}{adjbox}{min size}
+% \begin{key}{adjbox}{appcode}
% \begin{macrocode}
-\define@key\adjbox@fam{min size}{%
- \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
+\define@key{adjbox}{appcode}{%
+ \toks@\expandafter{\the\toks@#1}%
}
% \end{macrocode}
% \end{key}
%
+% \begin{macro}{\adjust@addcode}
+% \begin{macrocode}
+\long\def\adjust@addcode#1#2{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
+}%
+% \end{macrocode}
+% \end{macro}
+%
%
-% \begin{key}{adjbox}{max size}
+% \begin{key}{adjbox}{env}
+% Adds environment around boxed content
% \begin{macrocode}
-\define@key\adjbox@fam{max size}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
+\define@key\adjbox@fam{env}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@addenv
+ }{%
+ \adjbox@addenv{#1}\@nnil%
+ \remove@to@nnil
+ }#1\@nnil
}
% \end{macrocode}
% \end{key}
%
+% \begin{macro}{\adjust@addenv}
+% \begin{macrocode}
+\def\adjbox@addenv#1#2\@nnil{%
+ \def\@tempa{\begin{#1}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
+}%
+% \end{macrocode}
+% \end{macro}
+%
%
-% \begin{key}{adjbox}{min totalsize}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Background keys and macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{bgcolor}
+% Adds a colored box in the background.
+% |#1| are the argument to color, i.e. either \MacroArgs<color>
+% or \MacroArgs{<model>}{<color>}.
% \begin{macrocode}
-\define@key\adjbox@fam{min totalsize}{%
- \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+\define@key\adjbox@fam{bgcolor}{%
+ \adjbox@checkcolor
+ \@ifnextchar\bgroup{%
+ \adjbox@bgcolor
+ }{%
+ \adjbox@bgcolor{}{#1}%
+ }#1\@nnil
}
% \end{macrocode}
% \end{key}
%
%
-% \begin{key}{adjbox}{max totalsize}
+% \begin{macro}{\adjbox@bgcolor}
+% Parses the two possible arguments and adds the background color macro
+% to the token register.
% \begin{macrocode}
-\define@key\adjbox@fam{max totalsize}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+\def\adjbox@bgcolor#1#2#3\@nnil{%
+ \ifx\@nnil#1\@nnil
+ \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color{#2}}}}%
+ \else
+ \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{key}{adjbox}{bgcolor*}
+% Adds a colored box in the background. It awaits a direct color macro,
+% which gives the user more flexibility.
+% \begin{macrocode}
+\define@key\adjbox@fam{bgcolor*}{%
+ \adjbox@checkcolor
+ \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{#1}}}%
}
% \end{macrocode}
% \end{key}
%
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsubsection{Lap box}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \begin{macro}{\adjbox@@bgcolor}
+% This places a colored box (vrule) with the same dimensions than
+% the content, then compensates for the horizontal shift and places
+% the content. This is simpler and more direct than using \Macro\rlap
+% or a box macro from the \pkg{xcolor} package.
%
-% \begin{macro}{\lapbox}
+% The argument contains the color macro, e.g.\ \Macro\color{<color>}.
% \begin{macrocode}
-\newcommand*\lapbox[2][\width-\@tempdimb]{%
- \collectboxcheckenv{lapbox}%
- \@collectbox{\@lapbox{#1}{#2}}%
-}
+\def\adjbox@@bgcolor#1{%
+ \mbox{%
+ \hbox{%
+ #1%
+ \vrule\@width\width\@height\height\@depth\depth%
+ }%
+ \hskip-\width
+ \BOXCONTENT
+ }%
+}%
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@lapbox}
+%
+% \begin{macro}{\bgimagebox}
% \begin{macrocode}
-\def\@lapbox#1#2{%
- \adjsetlength\@tempdima{#2}%
- \ifdim\@tempdima<\z@
- \@tempdimb=-\@tempdima
- \else
- \@tempdimb=\@tempdima
- \fi
- \adjsetlength\@tempdimc{#1}%
- \ifdim\@tempdimc<\z@
- \@tempdimc=\z@
- \fi
- \leavevmode
- \ifdim\@tempdima<\z@
- \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\usebox\collectedbox\hss}\hskip\@tempdimc}%
- \else
- \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
- \fi
+\newcommand*\bgimagebox[2][]{%
+ \collectboxcheckenv{bgimagebox}%
+ \@collectbox{\@bgimagebox{#1}{#2}}%
}
% \end{macrocode}
% \end{macro}
%
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsubsection{Margin box}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% \begin{macro}{\marginbox}[1]{Margins as space separated values (like for 'trim')}
-% Collect box first.
+% \begin{macro}{\@bgimagebox}
% \begin{macrocode}
-\newcommand\marginbox{%
- \collectboxcheckenv{marginbox}%
- \@ifstar
- \marginbox@s
- \marginbox@
+\def\@bgimagebox#1#2{%
+ \mbox{%
+ \lower\depth\hbox{%
+ \edef\@tempa{\noexpand\adjustimage
+ {#1,width=\the\width,totalheight=\the\totalheight}%
+ {#2}%
+ }%
+ \@tempa
+ }%
+ \hskip-\width%
+ \BOXCONTENT
+ }%
}
-\def\marginbox@#1{%
- \@collectbox{\marginbox@@{#1}}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{key}{adjbox}{bgimage}
+% One or two arguments, the first optional one are further \Macro\includegraphics keys.
+% \begin{macrocode}
+\define@key{adjbox}{bgimage}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@bgimage
+ }{%
+ \adjbox@bgimage{}{#1}%
+ }#1\@nnil
}
-\def\marginbox@s#1{%
- \@collectbox{\marginbox@@s{#1}}%
+% \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\adjbox@bgimage}
+% \begin{macrocode}
+\def\adjbox@bgimage#1#2#3\@nnil{%
+ \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{environment}{marginbox*}[1]{Margins as space separated values (like for 'trim')}
+%
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Lapping keys and macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{lap}
% \begin{macrocode}
-\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
- \@collectboxisenv{marginbox*}%
- \marginbox@s
+\define@key\adjbox@fam{lap}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@lapbox
+ }{%
+ \adjbox@lapbox{#1}{}%
+ }#1{}{}\@nnil
}
% \end{macrocode}
-% \end{environment}
+% \end{key}
%
%
-% \begin{macro}{\marginbox@@}
-% (1) Parse margins (must be done here to allow the user to use the original box dimensions).
-% (2) Change box margins and (3) place the box.
+% \begin{macro}{\adjbox@lapbox}
% \begin{macrocode}
-\def\marginbox@@#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
+\def\adjbox@lapbox#1#2#3\@nnil{%
+ \ifx\@nnil#2\@nnil
+ \adjbox@Gin@Add{\lapbox{#1}}%
+ \else
+ \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
+ \fi
}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\marginbox@@s}
-% (1) Parse margins (must be done here to allow the user to use the original box dimensions).
-% (2) Change box margins and (3) raise the box by the bottom margin to preserve original depth.
+% \begin{key}{adjbox}{rlap}
% \begin{macrocode}
-\def\marginbox@@s#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \raise\adjbox@tlly\copy\collectedbox
+\define@key\adjbox@fam{rlap}[]{%
+ \adjbox@Gin@Add{\lapbox{\width}}%
}
% \end{macrocode}
-% \end{macro}
+% \end{key}
%
%
-% \begin{macro}{\@marginbox}
-% Adds the given margins to the depth, width and height.
-% The left margin is created by an horizontal skip.
-% This implementation assumes that the margins are positive and no special checks are added.
-% While negative margins will trim some margin off, this will not lead to correct results if this amounts
-% are larger than the existing dimensions. For this the \Macro\trimbox macro should be used.
+% \begin{key}{adjbox}{llap}
% \begin{macrocode}
-\def\@marginbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip\@tempdima
- \adjsetlength\@tempdima{\dp#5 + #2}%
- \adjsetlength\@tempdimb{\wd#5 + #3}%
- \adjsetlength\@tempdimc{\ht#5 + #4}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \box#5%
- }%
+\define@key\adjbox@fam{llap}[]{%
+ \adjbox@Gin@Add{\lapbox{-\width}}%
+}
+% \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\lapbox}
+% \begin{macrocode}
+\newcommand*\lapbox[2][\width-\@tempdimb]{%
+ \collectboxcheckenv{lapbox}%
+ \@collectbox{\@lapbox{#1}{#2}}%
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@lapbox}
+% \begin{macrocode}
+\def\@lapbox#1#2{%
+ \adjsetlength\@tempdima{#2}%
+ \ifdim\@tempdima<\z@
+ \@tempdimb=-\@tempdima
+ \else
+ \@tempdimb=\@tempdima
+ \fi
+ \adjsetlength\@tempdimc{#1}%
+ \ifdim\@tempdimc<\z@
+ \@tempdimc=\z@
+ \fi
+ \leavevmode
+ \ifdim\@tempdima<\z@
+ \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\usebox\collectedbox\hss}\hskip\@tempdimc}%
+ \else
+ \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
%
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \subsubsection{Minibox and other Environments Keys}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Keys for minibox and varwidth} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{key}{ADJBOX}{minipage}
% \begin{macrocode}
@@ -2967,6 +3028,8 @@
%
% \begin{macro}{\adjbox@@page}
% Sets collect-box command to use \env{minipage} or similar environment.
+%
+% The \Macro\setlength macro is change temporary for the \env{minipage} or \env{varwidth} environment.
% \begin{macrocode}
\def\adjbox@@page#1#2\@nnil{%
\def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{#1}#2\adjbox@reset}{##1}{\end{#1}}}%
@@ -2975,6 +3038,7 @@
% \end{macro}
%
% \begin{macro}{\adjbox@set}
+% Sets \Macro\setlength to \pkg{adjcalc} version.
% \begin{macrocode}
\def\adjbox@set{%
\let\adjbox@origsetlength\setlength
@@ -2985,6 +3049,7 @@
%
%
% \begin{macro}{\adjbox@reset}
+% Resets \Macro\setlength to normal version.
% \begin{macrocode}
\def\adjbox@reset{%
\let\setlength\adjbox@origsetlength
@@ -2993,23 +3058,40 @@
% \end{macro}
%
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Stackbox keys and macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
% \begin{macro}{\stackbox}
% \begin{macrocode}
\newcommand*\stackbox[1][c]{%
- \collectboxcheckenv{stackbox}%
- \@testopt{\@stackbox{#1}}{b}%
+ \collectboxcheckenv{stackbox}%
+ \@ifnextchar[%]
+ {\@stackbox{#1}}%
+ {\@@stackbox{#1}{b}[]}%
}
% \end{macrocode}
% \end{macro}
%
-%
% \begin{macro}{\@stackbox}
+% Read the third optional argument
+% \begin{macrocode}
+\def\@stackbox#1[#2]{%
+ \@testopt{\@@stackbox{#1}{#2}}{}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@@stackbox}
% The \env{varwidth} environment is used because it is much simpler to use than \env{tabular}.
% The horizontal alignment is done by the usual text align macros.
% \begin{macrocode}
-\def\@stackbox#1[#2]{%
+\def\@@stackbox#1#2[#3]{%
\collectbox@
- {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}
+ {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3}
\BOXCONTENT
{\end{varwidth}}%
}
@@ -3017,10 +3099,27 @@
% \end{macro}
%
%
+% \begin{macro}{\adjbox@halign@c}
+% \begin{macro}{\adjbox@halign@l}
+% \begin{macro}{\adjbox@halign@r}
+% \begin{macro}{\adjbox@halign@j}
+% Horizontal alignment macros.
+% \begin{macrocode}
+\def\adjbox@halign@c{\centering}
+\def\adjbox@halign@l{\raggedright}
+\def\adjbox@halign@r{\raggedleft}
+\def\adjbox@halign@j{\let\\\newline}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
% \begin{key}{ADJBOX}{stack}
% \begin{macrocode}
-\define@key{ADJBOX}{stack}[{}{}]{%
- \adjbox@stack#1{}{}\@nnil
+\define@key{ADJBOX}{stack}[{}{}{}]{%
+ \adjbox@stack#1{}{}{}\@nnil
}
% \end{macrocode}
% \end{key}
@@ -3028,14 +3127,14 @@
%
% \begin{macro}{\adjbox@stack}
% \begin{macrocode}
-\def\adjbox@stack#1#2#3\@nnil{%
+\def\adjbox@stack#1#2#3#4\@nnil{%
\ifx\@nnil#1\@nnil
- \adjbox@@stack{c}{b}%
+ \adjbox@@stack{c}{b}{}%
\else
\ifx\@nnil#2\@nnil
- \adjbox@@stack{#1}{b}%
+ \adjbox@@stack{#1}{b}{}%
\else
- \adjbox@@stack{#1}{#2}%
+ \adjbox@@stack{#1}{#2}{#3}%
\fi\fi
}
% \end{macrocode}
@@ -3044,29 +3143,18 @@
%
% \begin{macro}{\adjbox@@stack}
% \begin{macrocode}
-\def\adjbox@@stack#1#2{%
- \def\adjbox@collectbox##1{\collectbox@{\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}{##1}{\end{varwidth}}}%
+\def\adjbox@@stack#1#2#3{%
+ \def\adjbox@collectbox##1{%
+ \collectbox@{%
+ \begin{varwidth}[#2]{\linewidth}%
+ \csname adjbox@halign@#1\endcsname#3%
+ }{##1}{\end{varwidth}}%
+ }%
}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\adjbox@halign@c}
-% \begin{macro}{\adjbox@halign@l}
-% \begin{macro}{\adjbox@halign@r}
-% \begin{macro}{\adjbox@halign@j}
-% \begin{macrocode}
-\def\adjbox@halign@c{\centering}
-\def\adjbox@halign@l{\raggedright}
-\def\adjbox@halign@r{\raggedleft}
-\def\adjbox@halign@j{\let\\\newline}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
% Load the \pkg{varwidth} package if available or disable the dependent keys if not.
% \begin{macrocode}
\IfFileExists{varwidth.sty}
@@ -3081,6 +3169,13 @@
% \end{macrocode}
%
%
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{tabular and array keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
% \begin{key}{ADJBOX}{tabular}
% \begin{macrocode}
\define@key{ADJBOX}{tabular}{%
@@ -3144,6 +3239,13 @@
% \end{macro}
%
%
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Keys for inner environments and code} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
% \begin{key}{ADJBOX}{innerenv}
% \begin{macrocode}
\define@key{ADJBOX}{innerenv}{%
@@ -3205,145 +3307,268 @@
%
%
%
-% \begin{key}{ADJBOX}{env}
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Float keys} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{label}
% \begin{macrocode}
-\define@key{ADJBOX}{env}{%
- \@ifnextchar\bgroup{%
- \adjbox@addenv
+\define@key\adjbox@fam{label}{%
+ \def\adjbox@label{\label{#1}}%
+}
+\let\adjbox@label\@empty
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{caption}
+% \begin{macrocode}
+\define@key\adjbox@fam{caption}{%
+ \@ifnextchar{[}{%
+ \adjbox@def@caption
}{%
- \adjbox@addenv{#1}\@nnil%
- \remove@to@nnil
+ \adjbox@def@@caption
}#1\@nnil
}
+\def\adjbox@def@@caption#1\@nnil{%
+ \def\adjbox@caption{\caption{#1}}%
+}
+\def\adjbox@def@caption[#1]#2\@nnil{%
+ \def\adjbox@caption{\caption[#1]{#2}}%
+}
+\let\adjbox@caption\@empty
% \end{macrocode}
% \end{key}
%
%
-% \begin{macro}{\adjust@addenv}
+% \begin{key}{adjbox}{figure}
% \begin{macrocode}
-\def\adjbox@addenv#1#2\@nnil{%
- \def\@tempa{\begin{#1}#2}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
-}%
+\define@key\adjbox@fam{figure}[]{%
+ \Gin@esetsize
+ \@tempswafalse
+ \let\adjustbox@noindent\relax
+ \ifx\@nnil#1\@nnil
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{}%
+ \else
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{[#1]}%
+ \fi
+}
+\def\adjbox@figure#1#2{%
+ \def\@tempa{\begin{figure}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@#1\end{figure}}%
+}
% \end{macrocode}
-% \end{macro}
+% \end{key}
%
-% \begin{key}{adjbox}{addcode}
-% Adds code before and after the current boxed content.
-% Syntax:~\Key{addcode}'='{<code before>}{<code afterwards>}
+% \begin{key}{adjbox}{float}
% \begin{macrocode}
-\define@key{adjbox}{Addcode}{%
- \adjust@@addcode#1{}\@nnil%
+\define@key\adjbox@fam{float}{%
+ \let\adjustbox@noindent\relax
+ \@ifnextchar\bgroup{%
+ \adjbox@float
+ }{%
+ \adjbox@float{#1}\@nnil
+ \remove@to@nnil
+ }#1\@nnil
}
-\define@key{adjbox}{addcode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@@addcode#1{}\@nnil%
+\def\adjbox@float{%
+ \expandafter\expandafter
+ \expandafter\adjbox@@float\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}%
}
-\def\adjust@@addcode#1#2#3\@nnil{%
- \ifx\@nnil#3\@nnil
- \adjust@addcode{#1}{#2}%
- \else
- \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
- \fi
+\def\adjbox@@float#1#2#3\@nnil{%
+ \adjust@addcode{\begin{#2}#3}{#1\end{#2}}%
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{precode}
+% \begin{key}{adjbox}{nofloat}
% \begin{macrocode}
-\define@key{adjbox}{precode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@addcode{#1}{}%
+\define@key\adjbox@fam{nofloat}[figure]{%
+ \def\@tempa{\adjust@addcode{\adjnofloat{#1}}}%
+ \expandafter\expandafter\expandafter
+ \@tempa\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label\endadjnofloat}%
}
% \end{macrocode}
% \end{key}
%
-% \begin{key}{adjbox}{Precode}
-% Same as \Key{precode} but does not set the size yet.
+%
+% \begin{environment}{adjnofloat}
+% Environment used for non-floats.
% \begin{macrocode}
-\define@key{adjbox}{Precode}{%
- \adjust@addcode{#1}{}%
+\newenvironment{adjnofloat}[1]{%
+ \trivlist
+ \def\@captype{#1}%
+ \item\relax
+ \leavevmode
+}{%
+ \endtrivlist
}
% \end{macrocode}
-% \end{key}
+% \end{environment}
%
-% \begin{key}{adjbox}{appcode}
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Change or discard the content} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{phantom}
% \begin{macrocode}
-\define@key{adjbox}{appcode}{%
- \toks@\expandafter{\the\toks@#1}%
+\define@key\adjbox@fam{phantom}[]{%
+ \expandafter\ifx\csname #1phantom\endcsname\relax
+ \adjust@addcode{\phantom}{}%
+ \else
+ \expandafter\adjust@addcode\expandafter{\csname #1phantom\endcsname}{}%
+ \fi
}
% \end{macrocode}
% \end{key}
%
-% \begin{macro}{\adjust@addcode}
+% \begin{macro}{\phantombox}[3]{width}{height}{depth}
+% Produces an empty box with the given width, height and depth.
% \begin{macrocode}
-\def\adjust@addcode#1#2{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
-}%
+\newcommand*\phantombox[3]{%
+ \begingroup
+ \adjsetlength\@tempdima{#1}%
+ \adjsetlength\@tempdimb{#2}%
+ \adjsetlength\@tempdimc{#3}%
+ \setbox\collectedbox\hbox{}%
+ \wd\collectedbox\@tempdima
+ \ht\collectedbox\@tempdimb
+ \dp\collectedbox\@tempdimc
+ \leavevmode
+ \box\collectedbox
+ \endgroup
+}
% \end{macrocode}
% \end{macro}
%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \subsection{New, experimental macros and keys}
+% \begin{key}{adjbox}{gobble}
+% Discards the content.
+% \begin{macrocode}
+\define@key\adjbox@fam{gobble}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
+}
+% \end{macrocode}
+% \end{key}
%
+% \begin{key}{adjbox}{discard}
+% Discards the content.
+% \begin{macrocode}
+\define@key\adjbox@fam{discard}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
+}
+% \end{macrocode}
+% \end{key}
%
%
-% \begin{macro}{\bgimagebox}
+% \begin{key}{adjbox}{content}
+% Replaces the content. The old content is still processed completely before being replaced..
% \begin{macrocode}
-\newcommand*\bgimagebox[2][]{%
- \collectboxcheckenv{bgimagebox}%
- \@collectbox{\@bgimagebox{#1}{#2}}%
+\define@key\adjbox@fam{content}{%
+ \adjbox@Gin@Add{\@collectbox{#1}}%
}
% \end{macrocode}
-% \end{macro}
+% \end{key}
%
%
-% \begin{macro}{\@bgimagebox}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Store box content and sizes} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{key}{adjbox}{gstore}
+% Store the current content into a box without removing it.
% \begin{macrocode}
-\def\@bgimagebox#1#2{%
- \mbox{%
- \lower\depth\hbox{%
- \edef\@tempa{\noexpand\adjustimage
- {#1,width=\the\width,totalheight=\the\totalheight}%
- {#2}%
- }%
- \@tempa
- }%
- \hskip-\width%
- \BOXCONTENT
- }%
+\define@key\adjbox@fam{gstore}{%
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{\BOXCONTENT}}%
}
% \end{macrocode}
-% \end{macro}
+% \end{key}
%
+% \begin{key}{adjbox}{gstore*}
+% Store the content into a box only.
+% \begin{macrocode}
+\define@key\adjbox@fam{gstore*}{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{}}%
+}
+% \end{macrocode}
+% \end{key}
%
-% \begin{key}{adjbox}{bgimage}
-% One or two arguments, the first optional one are further \Macro\includegraphics keys.
+% \begin{key}{adjbox}{gstore width}
% \begin{macrocode}
-\define@key{adjbox}{bgimage}{%
- \@ifnextchar\bgroup{%
- \adjbox@bgimage
- }{%
- \adjbox@bgimage{}{#1}%
- }#1\@nnil
+\define@key{adjbox}{gstore width}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\width\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
%
+% \begin{key}{adjbox}{gstore depth}
+% \begin{macrocode}
+\define@key{adjbox}{gstore depth}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\depth\BOXCONTENT}}%
+}
+% \end{macrocode}
+% \end{key}
%
-% \begin{macro}{\adjbox@bgimage}
+% \begin{key}{adjbox}{gstore height}
% \begin{macrocode}
-\def\adjbox@bgimage#1#2#3\@nnil{%
- \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
+\define@key{adjbox}{gstore height}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\height\BOXCONTENT}}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{gstore totalheight}
+% \begin{macrocode}
+\define@key{adjbox}{gstore totalheight}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\totalheight\BOXCONTENT}}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{gstore sizes}
+% \begin{macrocode}
+\define@key{adjbox}{gstore sizes}{%
+ \adjbox@Gin@Add{\@collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{macro}{\adjbox@gstore@sizes}[4]{width register}{height register}{depth register}{totalheight register}
+% Stores the width, height, depth and totalheight in the given registers if they are not empty (or \Macro\relax).
+% \begin{macrocode}
+\def\adjbox@gstore@sizes#1#2#3#4#5\@nnil{%
+ \ifx\relax#1\relax\else
+ \global#1=\width
+ \fi
+ \ifx\relax#2\relax\else
+ \global#2=\height
+ \fi
+ \ifx\relax#3\relax\else
+ \global#3=\depth
+ \fi
+ \ifx\relax#4\relax\else
+ \global#4=\totalheight
+ \fi
}
% \end{macrocode}
% \end{macro}
%
%
+%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Experimental split and pagebreak keys and macros} ^^A (((
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
% \begin{macrocode}
%%\RequirePackage{storebox}
% \end{macrocode}
@@ -3392,11 +3617,11 @@
\ifdim\Gin@nat@height>\totalheight
\Gin@nat@height\totalheight
\fi
- \adjbox@tllx\z@
- \adjbox@tlly\totalheight
- \adjbox@turx\width
- \adjbox@tury\z@
- \advance\adjbox@tlly-\Gin@nat@height
+ \tc@llx\z@
+ \tc@lly\totalheight
+ \tc@urx\width
+ \tc@ury\z@
+ \advance\tc@lly-\Gin@nat@height
\@@splitbox
}
% \end{macrocode}
@@ -3406,20 +3631,20 @@
% \begin{macro}{\@@splitbox}
% \begin{macrocode}
\def\@@splitbox{%
- \advance\adjbox@turx-\@tempdima
+ \advance\tc@urx-\@tempdima
\@@@splitbox
- \ifdim\adjbox@turx>\z@
- \advance\adjbox@tllx+\@tempdima
+ \ifdim\tc@urx>\z@
+ \advance\tc@llx+\@tempdima
\expandafter\@@splitbox
\else
- \ifdim\adjbox@tlly<\splitbox@epsilon
+ \ifdim\tc@lly<\splitbox@epsilon
\splitboxlastnewline
\else
\splitboxnewline
- \adjbox@tllx\z@
- \adjbox@turx\width
- \advance\adjbox@tlly-\Gin@nat@height
- \advance\adjbox@tury+\Gin@nat@height
+ \tc@llx\z@
+ \tc@urx\width
+ \advance\tc@lly-\Gin@nat@height
+ \advance\tc@ury+\Gin@nat@height
\expandafter\expandafter
\expandafter\@@splitbox
\fi
@@ -3434,7 +3659,7 @@
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
@@ -3446,7 +3671,7 @@
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
@@ -3482,6 +3707,8 @@
% \end{macro}
%
%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
% \begin{macro}{\pagebreakbox}
% \begin{macrocode}
\newcommand\pagebreakbox{%
@@ -3508,8 +3735,8 @@
% \begin{tabular}{ll}
% \Macro\@tempa & Caption code \\
% \Macro\@tempboxa & Caption box \\
-% \Macro\adjbox@tlly & Lower clip amount \\
-% \Macro\adjbox@tury & Lower clip amount \\
+% \Macro\tc@lly & Lower clip amount \\
+% \Macro\tc@ury & Lower clip amount \\
% \end{tabular}
% \begin{macrocode}
\def\@pagebreakbox{%
@@ -3518,32 +3745,32 @@
\storebox\splittedbox{\BOXCONTENT}%
\setbox\collectedbox\hbox{\usestorebox\splittedbox}%
\fi
- \adjsetlength\adjbox@tlly
+ \adjsetlength\tc@lly
{\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}%
- \ifdim\adjbox@tlly>\z@
+ \ifdim\tc@lly>\z@
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\z@\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\z@
\BOXCONTENT
\endgroup
\par\noindent
- \adjsetlength\adjbox@tury{\totalheight-\adjbox@tlly}%
- \ifdim\adjbox@tlly>\textheight
+ \adjsetlength\tc@ury{\totalheight-\tc@lly}%
+ \ifdim\tc@lly>\textheight
\loop
- \advance\adjbox@tlly-\textheight
+ \advance\tc@lly-\textheight
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\tc@ury
\BOXCONTENT
\endgroup
- \advance\adjbox@tury\textheight
+ \advance\tc@ury\textheight
\par\noindent
- \ifdim\adjbox@tlly>\textheight
+ \ifdim\tc@lly>\textheight
\repeat
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\BOXCONTENT
\else
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\par\noindent
\BOXCONTENT
\fi
@@ -3562,560 +3789,14 @@
% \end{macrocode}
% \end{macro}
%
-% \iffalse
-%</adjustbox.sty>
-% \fi
-%
-%
-% \iffalse
-%<*adjgrfx.sty>
-% \fi
-% \begin{macrocode}
-\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox]
-\RequirePackage{graphicx}
-% \end{macrocode}
-%
-%
-%%^^A \width, \height, \totalheight, \depth = size current at option execution (changes after every option) (initial: natural size)
-%%^^A \Width, \Height, \Totalheight, \Depth = requested size of image (height/totalheight and width) (initial: natural size)
-%%^^A \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH = natural size of image
-%%
-%%
-%
-% \begin{macro}{\Gin@adj@adddim}
-% \begin{macrocode}
-\newcommand*\Gin@adj@adddim{%
- \let\height\Gin@nat@height
- \let\width\Gin@nat@width
- \let\totalheight\height
- \let\depth\z@
- \let\adjbox@HEIGHT\HEIGHT
- \let\adjbox@WIDTH\WIDTH
- \let\adjbox@TOTALHEIGHT\TOTALHEIGHT
- \let\adjbox@DEPTH\DEPTH
- \global\let\HEIGHT\Gin@nat@height
- \global\let\WIDTH\Gin@nat@width
- \global\let\TOTALHEIGHT\HEIGHT
- \global\let\DEPTH\z@
- \let\adjbox@Height\Height
- \let\adjbox@Width\Width
- \let\adjbox@Totalheight\Totalheight
- \let\adjbox@Depth\Depth
- \global\let\Height\Gin@nat@height
- \global\let\Width\Gin@nat@width
- \global\let\Totalheight\Height
- \global\let\Depth\z@
- \edef\adjbox@restore@dims{%
- \global\adjbox@nat@height\the\adjbox@nat@height\relax
- \global\adjbox@nat@width \the\adjbox@nat@width\relax
- \global\adjbox@req@height\the\adjbox@req@height\relax
- \global\adjbox@req@width \the\adjbox@req@width\relax
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\Gin@adj@remdim}
-% \begin{macrocode}
-\newcommand*\Gin@adj@remdim{%
- \global\let\HEIGHT\adjbox@HEIGHT
- \global\let\WIDTH\adjbox@WIDTH
- \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT
- \global\let\DEPTH\adjbox@DEPTH
- \global\let\Height\adjbox@Height
- \global\let\Width\adjbox@Width
- \global\let\Totalheight\adjbox@Totalheight
- \global\let\Depth\adjbox@Depth
- \adjbox@restore@dims
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\newdimen\adjbox@nat@width
-\newdimen\adjbox@nat@height
-\newdimen\adjbox@req@width
-\newdimen\adjbox@req@height
-% \end{macrocode}
-%
-% \begin{macro}{\Gin@adj@keepdim}
-% \begin{macrocode}
-\newcommand*\Gin@adj@keepdim{%
- \global\adjbox@nat@height\Gin@nat@height
- \global\adjbox@nat@width \Gin@nat@width
- \global\adjbox@req@height\Gin@req@height
- \global\adjbox@req@width \Gin@req@width
- \global\let\HEIGHT\adjbox@nat@height
- \global\let\WIDTH\adjbox@nat@width
- \global\let\TOTALHEIGHT\adjbox@nat@height
- \global\let\DEPTH\z@
- \global\let\Height\adjbox@req@height
- \global\let\Width\adjbox@req@width
- \global\let\Totalheight\adjbox@req@height
- \global\let\Depth\z@
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\Gin@ii}
-% \begin{macrocode}
-\def\Gin@ii[#1]#2{%
- \def\@tempa{[}\def\@tempb{#2}%
- \ifx\@tempa\@tempb
- \def\@tempa{\Gin@iii[#1][}%
- \expandafter\@tempa
- \else
- \begingroup
- \Gin@adj@adddim
- \@tempswafalse
- \toks@{\Ginclude@graphics{#2}}%
- \setkeys{Gin}{#1}%
- \Gin@esetsize
- \the\toks@
- \Gin@adj@remdim
- \endgroup
- \fi}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\Gin@iii}
-% \begin{macrocode}
-\def\Gin@iii[#1,#2][#3,#4]#5{%
- \begingroup
- \Gin@adj@adddim
- \Gin@bboxtrue
- \Gin@defaultbp\Gin@llx{#1}%
- \Gin@defaultbp\Gin@lly{#2}%
- \Gin@defaultbp\Gin@urx{#3}%
- \Gin@defaultbp\Gin@ury{#4}%
- \Ginclude@graphics{#5}%
- \Gin@adj@remdim
- \endgroup}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\Gin@setfile}
-% \begin{macrocode}
-\def\Gin@setfile#1#2#3{%
- \ifx\\#2\\\Gread@false\fi
- \ifGin@bbox\else
- \ifGread@
- \csname Gread@%
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- eps%
- \else
- #1%
- \fi
- \endcsname{\Gin@base#2}%
- \else
- \Gin@nosize{#3}%
- \fi
- \fi
- \Gin@viewport@code
- \Gin@nat@height\Gin@ury bp%
- \advance\Gin@nat@height-\Gin@lly bp%
- \Gin@nat@width\Gin@urx bp%
- \advance\Gin@nat@width-\Gin@llx bp%
- \Gin@req@sizes
- \Gin@adj@keepdim
- \expandafter\ifx\csname Ginclude@#1\endcsname\relax
- \Gin@drafttrue
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- \@latex@error{Can not include graphics of type: #1}\@ehc
- \global\expandafter\let\csname Gread@#1\endcsname\@empty
- \fi
- \fi
- \leavevmode
- \ifGin@draft
- \hb@xt@\Gin@req@width{%
- \vrule\hss
- \vbox to \Gin@req@height{%
- \hrule \@width \Gin@req@width
- \vss
- \edef\@tempa{#3}%
- \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
- \vss
- \hrule}%
- \hss\vrule}%
- \else
- \@addtofilelist{#3}%
- \ProvidesFile{#3}[Graphic file (type #1)]%
- \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
- \dp\z@\z@
- \ht\z@\Gin@req@height
- \wd\z@\Gin@req@width
- \box\z@
- \fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-%</adjgrfx.sty>
-% \fi
-%
%
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
-%<*adjcalc.sty>
-% \fi
-% Test if this package was loaded as package or as file (as part of 'adjustbox'):
-% \begin{macrocode}
-\begingroup
-\def\@tempa{adjcalc}
-\expandafter
-\endgroup
-\ifx\@tempa\@currname
- \ProvidesPackage{adjcalc}[2011/08/07 v1.0 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
- \RequirePackage{xkeyval}
-\fi
-% \end{macrocode}
-%
-%
-%
-% Use e-TeX by default if available, otherwise LaTeX (maybe with \pkg{calc})
-% \begin{macrocode}
-\AtEndOfPackage{\adjcalc@atend}
-\def\adjcalc@atend{%
-\begingroup
-\expandafter\ifx\csname eTeXversion\endcsname\relax
- \endgroup
- \RequirePackage{calc}%
- \adjcalc@calc
- \def\adjcalc@etex{\PackageError{adjcalc}{e-TeX not available for current compiler!}}%
-\else
- \endgroup
- \adjcalc@etex
-\fi
-}
-% \end{macrocode}
-%
-% Initial definitions for the package options. This macros are later redefined because the same keys
-% can be used as macro options.
-% \begin{macrocode}
-\def\adjcalc@pgfmath{\AtEndOfPackage{\RequirePackage{pgf}}\def\adjcalc@atend{\adjcalc@pgfmath}}
-\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
-\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
-\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
-% \end{macrocode}
-%
-% Options:
-% \begin{macrocode}
-\DeclareOptionX<adjbox>{pgfmath}{\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>{etex}{\adjcalc@etex}
-\DeclareOptionX<adjbox>{calc}{\adjcalc@calc}
-\DeclareOptionX<adjbox>{none}{\let\adjcalc@atend\relax\def\adjsetlength{\setlength}\let\adjcalc@overwrite\relax}
-\DeclareOptionX<adjbox>{overwrite}{\adjcalc@overwrite}
-\ProcessOptionsX*<adjbox>
-\disable@keys{adjbox}{none}
-% \end{macrocode}
-%
-% \begin{macro}{\adjcalc@etex}
-% \begin{macrocode}
-\def\adjcalc@etex{%
- \protected\def\adjsetlength##1##2{%
- ##1=\glueexpr(##2)\relax
- }%
- \protected\def\adjaddtolength##1##2{%
- \advance##1 by \glueexpr(##2)\relax
- }%
- \protected\def\adjsetcounter##1##2{%
- \@ifundefined{c@##1}%
- {\@nocounterr{##1}}%
- {\global\csname c@##1\endcsname\numexpr(##2)\relax}%
- }%
- \protected\def\adjaddtocounter##1##2{%
- \@ifundefined{c@##1}%
- {\@nocounterr{##1}}%
- {\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
- }%
- \def\adjbox@default##1##2{%
- \@defaultunits##1=\glueexpr##2 \adjbox@defaultunit\relax\@nnil
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-%
-% \begin{macro}{\adjcalc@calc}
-% This uses the underlying (re-)definitions of the normal macros (\Macro\setlength, ...) done by the \pkg{calc} package.
-% This allows to locally redefine \Macro\setlength to call \Macro\adjsetlength, etc., without causing an infinite loop.
-% \begin{macrocode}
-\def\adjcalc@calc{%
- \DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
- \DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
- \DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
- \DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
- \def\adjbox@default##1##2{%
- \begingroup
- \message{^^J\detokenize{##2}^^J}%
- \def\calc@post@scan####1!{%
- \def\@tempa{####1}%
- \ifx\@tempa\@empty
- \endgroup% to end calc processing
- % is number only
- \global\@adjbox@needsdefaulttrue
- \else
- \endgroup% to end calc processing
- % full expression
- \global\@adjbox@needsdefaultfalse
- \fi
- }%
- \calc@assign@skip{##1}{##2 \adjbox@defaultunit}%
- \endgroup
- \if@adjbox@needsdefault
- ##1=##2 \adjbox@defaultunit\relax
- \else
- \calc@assign@skip{##1}{##2}%
- \fi
- }%
- \def\adjbox@checkdefault##1\@nnil##2##3{%
- \ifx\relax##1\relax\else
- \calc@assign@skip{##2}{##3}%
- \fi
- }%
-}
-\newif\if@adjbox@needsdefault
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\adjcalc@pgfmath}
-% \begin{macrocode}
-\def\adjcalc@pgfmath{%
- \DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
- \DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
- \DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
- \DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
- \def\adjbox@default##1##2{%
- \edef\pgfmathresultunitscale{1\adjbox@defaultunit}%
- \let\pgfmathpostparse\pgfmathscaleresult
- \pgfmathparse{##2}%
- ##1=\pgfmathresult pt\relax
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\adjcalc@overwrite}
-% \begin{macrocode}
-\def\adjcalc@overwrite{%
- \let\setlength\adjsetlength
- \let\addtolength\adjaddtolength
- \let\setcounter\adjsetcounter
- \let\addtocounter\adjaddtocounter
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-%</adjcalc.sty>
-% \fi
-%
-%
-% \iffalse
-%<*adjpgf.def>
-% \fi
-% \iffalse
-%<!COPYRIGHT>
-% \fi
-% \begin{macrocode}
-\ProvidesFile{adjpgf.def}[%
-%<!DATE>
-%<!VERSION>
-%<*DRIVER>
- 2099/01/01 develop
-%</DRIVER>
- adjustbox fall-back clip driver using PGF]
-% \end{macrocode}
-%
-% \begin{macrocode}
-\RequirePackage{pgf}
-% \end{macrocode}
-%
-% \begin{macro}{\@cliptoboxdim}
-% Clips to official box dimension.
-% \begin{macrocode}
-\def\@cliptoboxdim#1{%
- \setbox#1\hbox{\begin{pgfpicture}%
- \pgfpathmoveto{\pgfqpoint\z@{-\dp#1}}%
- \pgfpathlineto{\pgfqpoint\z@{\ht#1}}%
- \pgfpathlineto{\pgfqpoint{\wd#1}{\ht#1}}%
- \pgfpathlineto{\pgfqpoint{\wd#1}{-\dp#1}}%
- \pgfpathclose
- \pgfusepathqclip
- \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}%
- \pgfnode{rectangle}{base west}{\usebox#1}{}{}%
- \pgfsetbaselinepointnow{\pgfpoint\z@\z@}%
- \end{pgfpicture}}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-% vim: ft=tex
-% \fi
-% \iffalse
-%</adjpgf.def>
-% \fi
-%
-%
-% \iffalse
-%<*adjpdftex.def>
-% \fi
-% \iffalse
-%<!COPYRIGHT>
-% \fi
-% \begin{macrocode}
-\ProvidesFile{adjpdftex.def}[%
-%<!DATE>
-%<!VERSION>
-%<*DRIVER>
- 2099/01/01 develop
-%</DRIVER>
- adjustbox clip driver for pdftex]
-% \end{macrocode}
-%
-%
-% \begin{macro}{\@cliptoboxdim}
-% Clips to official box dimension.
-%
-% Uses a PDF X-Object which has the side-effect of clipping.
-% TODO: Rewrite to use clipping path?
-% \begin{macrocode}
-\def\@cliptoboxdim#1{%
- \pdfxform#1%
- \setbox#1=\hbox{%
- \pdfrefxform\pdflastxform
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-% vim: ft=tex
-% \fi
-% \iffalse
-%</adjpdftex.def>
-% \fi
-%
-%
-% \iffalse
-%<*adjdvips.def>
-% \fi
-% \iffalse
-%<!COPYRIGHT>
-% \fi
-% \begin{macrocode}
-\ProvidesFile{adjdvips.def}[%
-%<!DATE>
-%<!VERSION>
-%<*DRIVER>
- 2099/01/01 develop
-%</DRIVER>
- adjustbox clip driver for dvips]
-% \end{macrocode}
-%
-%
-% \begin{macro}{\@cliptoboxdim}[1]{box register to clip}
-% Clips to official box dimension.
-%
-% The following clipping code was suggested by
-% Joseph Wright (LaTeX3 project), but slightly modified
-% for this package.
-% \begin{macrocode}
-\def\@cliptoboxdim#1{%
- \setbox#1=\hbox{%
- \adjsetlength\@tempdima{\ht#1+\dp#1}%
- \edef\TOTALHEIGHT{-\strip@pt\@tempdima\space}%
- \edef\DEPTH{\strip@pt\dp#1\space}%
- \edef\WIDTH{\strip@pt\wd#1\space}%
- \special{%
- ps:
- /mtrxc matrix currentmatrix def
- currentpoint gsave
- translate
- Resolution 72 div VResolution 72 div
- scale
- newpath
- 0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
- newpath
- mtrxc setmatrix
- }%
- \box#1%
- \special{ps: grestore }%
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-% vim: ft=tex
-% \fi
-% \iffalse
-%</adjdvips.def>
-% \fi
-%
-%
-% \iffalse
-%<*adjxetex.def>
-% \fi
-% \iffalse
-%<!COPYRIGHT>
-% \fi
-% \begin{macrocode}
-\ProvidesFile{adjpdftex.def}[%
-%<!DATE>
-%<!VERSION>
-%<*DRIVER>
- 2099/01/01 develop
-%</DRIVER>
- adjustbox clip driver for pdftex]
-% \end{macrocode}
-%
-%
-% \begin{macro}{\@cliptoboxdim}
-% Clips to official box dimension.
-%
-% The following clipping code was suggested by
-% Joseph Wright (LaTeX3 project), but slightly modified
-% for this package.
-% \begin{macrocode}
-\def\@cliptoboxdim#1{%
- \setbox#1=\hbox{%
- \Gin@defaultbp\WIDTH{\wd#1}%
- \Gin@defaultbp\DEPTH{\dp#1}%
- \@tempdima\ht#1%
- \advance\@tempdima\dp#1%
- \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
- \special{pdf:content q }%
- \special{%
- pdf:literal direct
- 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
- }%
- \special{pdf:literal direct W }%
- \special{pdf:literal direct n }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \special{pdf:content q }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \box#1%
- \special{pdf:literal direct Q }%
- \special{pdf:literal direct Q }%
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \iffalse
-% vim: ft=tex
-% \fi
-% \iffalse
-%</adjxetex.def>
+%</adjustbox.sty>
% \fi
%
+% ^^A )))
% \Finale
% \endinput
+% ^^A vim: foldenable foldmethod=marker foldmarker=(((,)))
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins b/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins
index cd9098becc6..196015c47cf 100644
--- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins
+++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins
@@ -3,12 +3,21 @@
\askforoverwritefalse
\generate{%
\file{adjustbox.sty}{\nopreamble\from{adjustbox.dtx}{adjustbox.sty}}%
- \file{adjcalc.sty}{\nopreamble\from{adjustbox.dtx}{adjcalc.sty}}%
- \file{adjgrfx.sty}{\nopreamble\from{adjustbox.dtx}{adjgrfx.sty}}%
- \file{adjpgf.def}{\nopreamble\from{adjustbox.dtx}{adjpgf.def}}%
- \file{adjpdftex.def}{\nopreamble\from{adjustbox.dtx}{adjpdftex.def}}%
- \file{adjdvips.def}{\nopreamble\from{adjustbox.dtx}{adjdvips.def}}%
- \file{adjxetex.def}{\nopreamble\from{adjustbox.dtx}{adjxetex.def}}%
+ \file{adjcalc.sty}{\nopreamble\from{adjcalc.dtx}{adjcalc.sty}}%
+ \file{trimclip.sty}{\nopreamble\from{trimclip.dtx}{trimclip.sty}}%
+ \file{tc-pgf.def}{\nopreamble\from{trimclip.dtx}{tc-pgf.def}}%
+ \file{tc-pdftex.def}{\nopreamble\from{trimclip.dtx}{tc-pdftex.def}}%
+ \file{tc-dvips.def}{\nopreamble\from{trimclip.dtx}{tc-dvips.def}}%
+ \file{tc-xetex.def}{\nopreamble\from{trimclip.dtx}{tc-xetex.def}}%
+ \file{box.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{box.tex}}%
+ \file{compare.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{compare.tex}}%
+ \file{margin2.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{margin2.tex}}%
+ \file{margin.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{margin.tex}}%
+ \file{trim2.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{trim2.tex}}%
+ \file{trim3.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{trim3.tex}}%
+ \file{trim.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{trim.tex}}%
+ \file{viewport2.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{viewport2.tex}}%
+ \file{viewport.tex}{\nopreamble\nopostamble\from{trimclip.dtx}{viewport.tex}}%
}
\endbatchfile
%% vim: ft=tex
diff --git a/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
new file mode 100644
index 00000000000..cb1afd4dd95
--- /dev/null
+++ b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
@@ -0,0 +1,1944 @@
+% \iffalse meta-comment
+%<=*COPYRIGHT>
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+%<=/COPYRIGHT>
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{trimclip.dtx}[%
+%<=*DATE>
+ 2012/05/16
+%<=/DATE>
+%<=*VERSION>
+ v1.0
+%<=/VERSION>
+ DTX file for the trimclip package]
+\documentclass[a4paper]{ydoc}[2011/11/16]
+\GetFileInfo{trimclip.dtx}
+\usepackage{trimclip}[\filedate]
+
+\usepackage[utf8]{inputenc}
+\usepackage{standalone}
+
+%\AtBeginDocument{\MakeShortMacroArgs\`\relax}
+%\AtEndDocument{\DeleteShortVerb\`}
+%
+\normalmarginpar
+
+\usepackage{flafter}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\newsavebox\mybox
+
+\renewenvironment{example}[1][Example:]{%
+ \subsubsection*{#1}%
+}{%
+ \par
+}
+\newenvironment{examples}[1][Examples:]{%
+ \subsubsection*{#1}%
+}{%
+ \par
+}
+\optionaloff
+
+\lstdefinelanguage{none}{}%
+\lstdefinelanguage{adjustbox}{%
+ moretexcs={%
+ begin,end,adjustbox
+ },
+ emph={%
+ frame,fbox,cframe,cfbox,minipage,raise
+ },
+}%
+
+\lstdefinestyle{examplecode}{%
+ basicstyle=\ttfamily\small,
+ numbers=none,language=none,
+ classoffset=1,
+ morekeywords={begin,end},
+ keywordstyle=\bfseries,
+ classoffset=0,
+ morekeywords={adjustbox,minsizebox,maxsizebox,lapbox,marginbox,phantombox},
+ keywordstyle=\macrodescstyle,
+}
+
+\makeatletter
+\def\PrintExample{%
+ \begingroup
+ \par\smallskip\noindent
+ \leavevmode
+ \BoxExample
+ \@tempdima=\textwidth
+ \advance\@tempdima by -\wd\examplecodebox\relax
+ \advance\@tempdima by -\wd\exampleresultbox\relax
+ \advance\@tempdima by -15pt\relax
+ \ifdim\@tempdima>\bigskipamount
+ \hbox to \textwidth{%
+ \null\hss
+ \minipage[c]{\wd\examplecodebox}\usebox\examplecodebox\endminipage
+ \hfill\hskip\bigskipamount\hfill
+ \minipage[c]{\wd\exampleresultbox}%
+ \EXAMPLERESULT
+ \endminipage
+ \hss\null
+ }%
+ \else
+ \vbox{%
+ \leftline{\usebox\examplecodebox}%
+ \vspace{\bigskipamount}%
+ \rightline{\EXAMPLERESULT}%
+ }%
+ \fi
+ \par\smallskip
+ \endgroup
+}
+\def\EXAMPLERESULT{%
+ \leavevmode\hbox{%
+ \textcolor{exampleborder}{%
+ \boxframe
+ {\dimexpr\wd\exampleresultbox+2\fboxrule\relax}%
+ {\dimexpr\ht\exampleresultbox+\fboxrule\relax}%
+ {\dimexpr\dp\exampleresultbox+\fboxrule\relax}%
+ \hskip-\wd\exampleresultbox
+ \hskip-\fboxrule
+ \rule[-.25\fboxrule]{\wd\exampleresultbox}{.5\fboxrule}%
+ \hskip-\wd\exampleresultbox
+ }%
+ \usebox\exampleresultbox
+ }%
+}%
+\makeatother
+\colorlet{exampleborder}{black!33}
+\def\Descsep{\par\vskip-2.5ex\relax}
+
+\def\examplecontent{\raisebox{-4pt}{\begin{tabular}[b]{@{}|c|c|@{}}
+ \hline
+ A & B \\
+ \hline
+ C & D \\
+ \hline
+ \end{tabular}%
+}}
+
+%\EnableCrossrefs
+%\CodelineIndex
+%\RecordChanges
+\OnlyDescription
+\renewcommand\topfraction{.9}
+\renewcommand\bottomfraction{.9}
+\renewcommand\textfraction{.1}
+\renewcommand\floatpagefraction{.5}
+\renewcommand\dbltopfraction{.7}
+\renewcommand\dblfloatpagefraction{.5}
+\begin{document}
+ \DocInput{trimclip.dtx}
+ \PrintChanges
+ %\newpage\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{484}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v1.0}{2012/05/16}{First version after extraction from \pkg{adjustbox} package.}
+%
+% \GetFileInfo{trimclip.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
+% \bundle{adjustbox}
+% \author{Martin Scharrer}
+% \email{martin@scharrer-online.de}
+% ^^A\repository{https://bitbucket.org/martin_scharrer/adjustbox}
+% \ydocpdfsettings
+% \maketitle
+%
+% \makeatletter
+% \def\LATeX{\texorpdfstring{(L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts
+% \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em)\TeX}{(La)TeX}}
+% \makeatother
+%
+% \vspace{-\baselineskip}
+% \begin{abstract}
+% This package extends the standard \pkg{graphicx} package by providing the missing \Macro\trimbox and \Macro\clipbox
+% macros to trim and clip arbitrary \TeX\ material.
+% The macros allow for verbatim content. Equivalent environments are also provided.
+% The package comes with own clipping drivers for all common output formats as well as a \pkg{pgf} fall-back driver.
+% \end{abstract}
+%
+% \section{Introduction}
+% The standard \LaTeX{} package \pkg{graphicx}.^^A\footnote{Actually it is the \pkg{graphics} package, but
+% ^^Athis is assumed to be completely superseded by its extension \pkg{graphicx}.}
+% allows to scale, resize and rotate either images or text (i.e.\ any \TeX\ content). For text the macros
+% \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox can be used, while equivalent keys exist for the
+% \Macro\includegraphics macro. However, while it is possible to trim and clip images using the \Key{trim}, \Key{viewport}
+% and \Key{clip} keys, no equivalent macros are provided. This package closes this gap by defining the macros
+% \Macro\trimbox and \Macro\clipbox. As an extra the macro \Macro\marginbox is also provided. It can be seen as an
+% inverted \Macro\trimbox, expanding the official size of the content instead of reducing it.
+% Originally these macros were included in the \pkg{adjustbox} package together with the general \Macro\adjustbox macro.
+% However, the fundamental clip and trim macros and their driver files are now packed into this minimalistic package,
+% so that other packages can reuse its functionality without the need to load the ever-growing \pkg{adjustbox} package.
+%
+% \enlargethispage{\baselineskip}
+% The macros provided by this package differ in three aspects from the macros defined by \pkg{graphicx}. The content
+% argument is actually read directly as a horizontal box and not as a macro argument, even when the syntax looks the
+% same. This allows for arbitrary content including special things like verbatim material. It is allowed to replace the
+% "{ }" around the content with \Macro\bgroup and \Macro\egroup. Furthermore, for every macro there is an equivalent
+% environment with the same name. Special care is taken to allow the same name for both, which is normally not allowed.
+% Finally, the lengths arguments of the macros can contain algebraic expressions to calculate the used length. This is
+% only possible with the \pkg{graphicx} macros if the \pkg{calc} package is loaded. However, the \pkg{trimclip} macros
+% use the \pkg{adjcalc} wrapper package which either uses $\epsilon$-\TeX\ primitives, \pkg{calc} or \pkg{pgfmath} to
+% provide this feature.
+%
+%
+% \section{Dependencies}
+% This package uses the author's other packages \pkg{collectbox} (to collect the content as a real box) and
+% \pkg{adjcalc} (to allow for math expressions for lengths). The latter is part of the same \pkg{adjustbox} bundle and
+% should have be installed together with \pkg{trimclip}.
+%
+% \section{Drivers}
+% The clip operation can not be implemented using general \TeX\ commands, but is rather output format specific. The
+% clipped material is actually included unclipped and the output file (i.e.\ PDF or PS file) contains format specific
+% instructions, so that the document viewer will clip the content when the document is displayed. Depending on the used
+% compilation work-flow (like |pdflatex|, |latex|+|dvips| or |latex|+|dvipdfm|, etc.) this clipping instructions must be
+% passed in a different way. In order to support all of these, dedicated driver files are provided which hold the
+% specific low-level instructions. This requirement should also be known to most users from the \pkg{graphics/x},
+% \pkg{(x)color} or \pkg{hyperref} packages which also require output format specific low-level instructions to
+% implement their features.
+%
+% A set of driver files for the most common used \LaTeX\ compilers is provided with this package (see
+% \autoref{sec:options} for a list). If no suitable driver file is found, the \pkg{pgf} package is used instead to
+% implement the clip operation. This (large) package comes with its own set of driver files and should cover any other
+% \LaTeX\ compilers. The \pkg{trimclip} drivers were inspired by the \pkg{graphic/x} and \pkg{pgf} driver code and
+% were written by Joseph Wright of the \LaTeX3 project and Martin Scharrer (the author of this package).
+%
+% \section{Package Options}\label{sec:options}
+% Normally the package should be loaded without any options. A suitable driver will then automatically be selected.
+% However, the package accepts the following options to select the used driver manually. Any other option is passed to the
+% \pkg{graphicx} package and the driver selected by it is used. However, this does not work if \pkg{graphicx} or
+% \pkg{graphics} was already loaded before. In this case any unknown option is taken as driver and a file
+% `\MacroArgs'tc-'<option>'.def'\relax' is loaded if it exits. If not, the default PGF fall-back driver is used. PGF
+% comes with a own set of drivers but is large and can be considered a significant overhead if used only for rectangular
+% clipping.
+%
+% \begin{description}
+% \def\Option#1{\item[{{\normalfont\opt{#1}}}]}%
+% \Option{pdftex} Use the |pdftex| driver. This driver is automatically selected for |pdflatex| and |lualatex|
+% and should not be used for any other \LaTeX\ compilers.
+% \Option{dvips} Use the |dvips| driver. This driver is automatically selected for |latex|.
+% \Option{xetex} Use the |xetex| driver. This driver is automatically selected for |xelatex|.
+% \Option{dvipdfm} Use the |xetex| driver which is also compatible with |dvipdfm|.
+% \Option{dvipdfmx} Use the |xetex| driver which is also compatible with |dvipdfmx|.
+% \Option{pgf} Use the fall-back PGF driver explicitly. This makes sense if issue with another driver are encountered.
+% \end{description}
+%
+% It should be noted that choosing an incorrect driver will lead to clip operation not being applied (they act like trim
+% operations) and may lead to a broken output file.
+%
+%
+% \section{Argument Values}\label{sec:argval}
+% All macros of this package and their matching environments require four length values which are used to change the
+% left, bottom, right and top side of the content. Because of the used \pkg{adjcalc} package complicated algebraic
+% expressions can be used to calculate these amounts. The used math engine can be changed by loading \pkg{adjcalc}
+% with the appropriate option before loading \pkg{trimclip}. Please see the \pkg{adjcalc} manual for more details
+% on this.
+% Like with the |trim| or |viewport| keys of \Macro\includegraphics the length values must be separated by spaces.
+% Note that if a previous length expression ends in a macro any trailing spaces will be removed by \TeX. Therefore it
+% is required to wrap this \emph{complete} length expression in braces.
+% Several examples of this are shown in the \emph{Usage} section.
+% It is also possible to only provide a single length which is used for all four
+% sides or only two lengths which are taken for the left/right as well as bottom/top side. This simplifies symmetric
+% operations and got inspired by Cascading Style Sheets (CSS) used to style websites.
+%
+% If a length value is a simple number without a unit, a default unit is substituted (usually `|bp|', \emph{big points},
+% the standard PostScript and PDF unit). This default unit can be changed using \Macro\adjcalc{'defaultunit='<unit>} or
+% completely disabled (\MacroArgs'defaultunit=none'). See the \pkg{adjcalc} manual for more details.
+%
+% The length values can contain the following macros to refer to the original size of the content:
+%
+% \DescribeMacros
+% \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
+% \endDescribeMacros
+% These \LaTeX{} lengths hold the original dimensions of the content and can be used to make relative changes. Like any
+% other length registers they can be used with a factor, e.g.\ \MacroArgs'.5'\AlsoMacro\width to refer to half the
+% natural width of the content.
+%
+%
+% \section{Usage}
+%
+% \subsection{Trimming}
+% \vspace{-\medskipamount}
+% \DescribeMacro\trimbox{<llx>~<lly>~<urx>~<ury>}{<content>}
+% \DescribeMacro\trimbox{<all sites>}{<content>}
+% \DescribeMacro\trimbox{<left/right>~<top/bottom>}{<content>}
+% \DescribeMacro\trimbox*{<llx>~<lly>~<urx>~<ury>}{<content>}
+% The macro \Macro\trimbox trims the given amount from the lower left (ll) and the upper right (ur) corner of
+% the box. This means that the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and
+% \meta{urx} and \meta{ury} from the right and top of the box, respectively.
+% If only one value is given it will be used for all four sites.
+% If only two values are given the first one will be used for the left and right side (llx, urx) and the second for the bottom and top side (lly, ury).
+%
+% If the starred version is used the four coordinates are taken as the \Key{viewport} instead, i.e. the box
+% is trimmed to the rectangle described by the coordinates. In this case all four values must be specified explicitly.
+%
+% \begin{examples}
+% \begin{examplecode}
+% \examplecontent
+% \end{examplecode}
+% \begin{examplecode}
+% \trimbox{2pt 3pt 2pt 3pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \trimbox{2pt 3pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \trimbox{2pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \trimbox{{.5\width} {.5\totalheight} 2pt 2pt}
+% {\examplecontent}
+% \end{examplecode}
+% \medskip
+% \begin{examplecode}
+% \trimbox*{5pt 0pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \medskip
+% \begin{examplecode}
+% \trimbox*{5pt -2pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \medskip
+% \begin{examplecode}
+% \trimbox*{5pt 10pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \bigskip
+% \bigskip
+% \begin{examplecode}
+% \trimbox*{5pt -3pt 3em -1pt}{\examplecontent}
+% \end{examplecode}
+% \end{examples}
+%
+%
+% \DescribeEnv[<content>]{trimbox}{<1, 2 or 4 trim values>}
+% \vspace{-\baselineskip}
+% \DescribeEnv[<content>]{trimbox*}{<llx>~<lly>~<urx>~<ury>}
+% The \env{trimbox} and \env{trimbox*} environments do the same as the corresponding macros.
+%
+%
+% \Needspace*{10\baselineskip}
+% \subsection{Clipping}
+% \vspace{-\medskipamount}
+% \DescribeMacro\clipbox{<llx>~<lly>~<urx>~<ury>}{<content>}
+% \DescribeMacro\clipbox{<all sites>}{<content>}
+% \DescribeMacro\clipbox{<left/right>~<top/bottom>}{<content>}
+% \DescribeMacro\clipbox*{<llx>~<lly>~<urx>~<ury>}{<content>}
+% The \Macro\clipbox macro works like the \Macro\trimbox and trims the given amounts from the \meta{text}.
+% However, in addition the trimmed material is also clipped, i.e. it is not shown in the final document.
+% Note that the material will still be part of the output file but is simply not shown.
+% The full content can still be exported using special tools, so using \Macro\clipbox\relax (or \Macro\includegraphics[clip,trim=...])
+% to censor classified information would be a bad idea.
+% The starred version will again use the given coordinates as viewport.
+%
+% \DescribeEnv[<content>]{clipbox}{<1, 2 or 4 trim values>}
+% \vspace{-\baselineskip}
+% \DescribeEnv[<content>]{clipbox*}{<llx>~<lly>~<urx>~<ury>}
+% The environment versions of \Macro\clipbox and \Macro\clipbox*. The same rules as for the trimming environments apply.
+%
+% \begin{examples}
+% \begin{examplecode}
+% \examplecontent
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox{2pt 3pt 2pt 3pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox{2pt 3pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox{2pt}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox{{.5\width} {.5\totalheight} 2pt 2pt}
+% {\examplecontent}
+% \end{examplecode}
+% \medskip
+% \begin{examplecode}
+% \clipbox*{5pt 0pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \medskip
+% \begin{examplecode}
+% \clipbox*{5pt -2pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox*{5pt 10pt 3em 2em}{\examplecontent}
+% \end{examplecode}
+% \begin{examplecode}
+% \clipbox*{5pt -3pt 3em -1pt}{\examplecontent}
+% \end{examplecode}
+% \end{examples}
+%
+% \subsection{Margin}
+% \vspace{-\medskipamount}
+% \DescribeMacro\marginbox{<all sites>}{<content>}
+% \DescribeMacro\marginbox{<left/right>~<top/bottom>}{<content>}
+% \DescribeMacro\marginbox{<llx>~<lly>~<urx>~<ury>}{<content>}
+% \Descsep
+% \DescribeEnv[<content>]{marginbox*}{<1, 2 or 4 margin values>}
+% This macro and environment can be used to add a margin (white space) around the content. It can be seen as the opposite of \Macro\trimbox.
+% The original baseline of the content is preserved because \meta{lly} is added to the depth.
+%
+% \begin{example}
+% \begin{examplecode}
+% Before \fbox{\marginbox{1ex 2ex 3ex 4ex}{Text}} After
+% \end{examplecode}
+% \end{example}
+%
+%
+% \DescribeMacro\marginbox'*'{<all sites>}{<content>}
+% \DescribeMacro\marginbox'*'{<left/right>~<top/bottom>}{<content>}
+% \DescribeMacro\marginbox'*'{<llx>~<lly>~<urx>~<ury>}{<content>}
+% \Descsep
+% \DescribeEnv[<content>]{marginbox}{<1, 2 or 4 margin values>}
+% This starred version is almost identical to the normal \Macro\marginbox, but also raises the content by the \MacroArgs<lly>
+% amount, so that the original depth is preserved instead of the original baseline.
+% Note that while \Macro\marginbox is basically the opposite of \Macro\trimbox, \Macro\marginbox* is not the opposite of \Macro\trimbox*.
+%
+% \begin{example}
+% \begin{examplecode}
+% Before \fbox{\marginbox*{1ex 2ex 3ex 4ex}{Text}} After
+% \end{examplecode}
+% \end{example}
+%
+%
+% \clearpage
+% \section{Diagrams}
+% ^^A This section explains the details about the trim and clip implementations.
+% ^^A It should give the interested reader a deeper understanding of the operations and the behaviour in normal and edge cases.
+% The box dimensions, trim values and change of the baseline for different scenarios are visualized by the following diagrams.
+%
+% \begin{figure}[!bt]
+% \centering
+% {\catcode`\%=14\relax\input{box}}
+% \caption{Box dimensions. Shown are also the \LaTeX\ macros and the \TeX\ primitives. Here \cs{br} stands for a box register.
+% Note that the depth is a positive values on its own downwards pointed axes.
+% }\label{fig:boxdim}
+% \end{figure}
+%
+% \begin{figure}[!bt]
+% \centering
+% {\catcode`\%=14\relax\input{trim}}
+% \caption{Trimming. The four values are removed from each side.}\label{fig:trim}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{trim2}}
+% \caption{Trimming with \texttt{lly}$>$depth. In this case the resulting box moves up to the original baseline.}\label{fig:trim2}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{trim3}}
+% \caption{Trimming with \texttt{ury}$>$height. In this case the resulting box falls down to the original baseline}\label{fig:trim2}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{viewport}}
+% \caption{Viewport with \texttt{lly}$>$0pt. The \texttt{ll} and \texttt{ur} values are taken from the origin. The baseline is the vertical zero reference.}\label{fig:viewport}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{viewport2}}
+% \caption{Viewport with \texttt{lly}$<$0pt. In this case the viewport ranges into the depth of the original box.}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{margin}}
+% \caption{Marginbox. The \texttt{llx} and \texttt{urx} are added to the left and right and increase the width. The \texttt{ury} is added to the height
+% and \texttt{lly} to the depth of the box. This keeps the baseline at the original position.}
+% \label{fig:margin}
+% \end{figure}
+%
+% \begin{figure}
+% \centering
+% {\catcode`\%=14\relax\input{margin2}}
+% \caption{Marginbox*. In addition to the normal margin the content
+% is also raised by \texttt{lly}, so that the original depth is preserved.
+% This effectively moves the baseline down.}
+% \label{fig:margin}
+% \end{figure}
+%
+% \StopEventually{}
+% \clearpage
+% \section{Implementation}
+% \setcounter{lstnumber}{1}
+%
+%
+% \iffalse
+%<*trimclip.sty>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesPackage{trimclip}[%
+%<!DATE>
+%<!VERSION>
+%<*DRIVER>
+ 2099/01/01 develop
+%</DRIVER>
+ Trim and clip general TeX material]
+% \end{macrocode}
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Options}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \begin{macrocode}
+\def\tc@driver{tc-\Gin@driver}
+\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
+\DeclareOption{pdftex}{\def\tc@driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
+\DeclareOption{xetex}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvips}{\def\tc@driver{tc-dvips.def}\PassOptionsToPackage{dvips}{graphicx}}
+\DeclareOption{dvipdfm}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvipdf}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption*{%
+ \@ifpackageloaded{graphics}{%
+ \edef\tc@driver{tc-\CurrentOption.def}%
+ \begingroup
+ \edef\@tempa{\CurrentOption.def}%
+ \ifx\@tempa\Gin@driver\else
+ \let\on@line\@gobble
+ \PackageWarning{trimclip}{%
+ A different clipping driver was requested than the\MessageBreak
+ one used for 'graphics/x'! This is not recommended\MessageBreak
+ and can lead to defect output files.%
+ }%
+ \fi
+ \endgroup
+ }{%
+ \def\tc@driver{tc-\Gin@driver}%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
+\ProcessOptions*\relax
+% \end{macrocode}
+%
+% \begin{macrocode}
+\RequirePackage{graphicx}[1999/02/16]
+\RequirePackage{collectbox}[2011/08/22]
+\RequirePackage{adjcalc}
+% \end{macrocode}
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{User level and auxiliary macros}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% \begin{macro}{\tc@readvalues}
+% Reads the four values for trim, viewport and clip.
+% Valid inputs are:
+% 4 values directly,
+% 1 value which is taken four times,
+% 2 values which is taken for left/right and top/bottom.
+% \begin{macrocode}
+\def\tc@readvalues#1{%
+ \tc@@readvalues#1 {} {} {} \\%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tc@@readvalues}
+% \begin{macrocode}
+\def\tc@@readvalues#1 #2 #3 #4 #5\\{%
+ \adjsetlengthdefault\tc@llx{#1}%
+ \ifx\@nnil#2\@nnil
+ \tc@lly\tc@llx
+ \tc@urx\tc@llx
+ \tc@ury\tc@llx
+ \else
+ \adjsetlengthdefault\tc@lly{#2}%
+ \ifx\@nnil#3\@nnil
+ \tc@urx\tc@llx
+ \tc@ury\tc@lly
+ \else
+ \adjsetlengthdefault\tc@urx{#3}%
+ \adjsetlengthdefault\tc@ury{#4}%
+ \fi
+ \fi
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tc@llx}
+% \begin{macro}{\tc@lly}
+% \begin{macro}{\tc@urx}
+% \begin{macro}{\tc@ury}
+% Dimension registers for the four trim/viewport values.
+% Legend: ll = lower left, ur = upper right.
+% \begin{macrocode}
+\newdimen\tc@llx
+\newdimen\tc@lly
+\newdimen\tc@urx
+\newdimen\tc@ury
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\trimbox}
+% \begin{macrocode}
+\newcommand\trimbox{%
+ \collectboxcheckenv{trimbox}%
+ \@ifstar
+ \trimbox@s
+ \trimbox@
+}
+\def\trimbox@#1{%
+ \collectbox{\@trimclip\@trimbox{#1}}%
+}
+\def\trimbox@s#1{%
+ \collectbox{\@trimclip\@viewportbox{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{environment}{trimbox*}
+% \begin{macrocode}
+\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
+ \@collectboxisenv{trimbox*}%
+ \trimbox@s
+}
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{macro}{\clipbox}
+% \begin{macrocode}
+\newcommand\clipbox{%
+ \collectboxcheckenv{clipbox}%
+ \@ifstar
+ \clipbox@s
+ \clipbox@
+}
+\def\clipbox@#1{%
+ \collectbox{\@trimclip\@clipbox{#1}}%
+}
+\def\clipbox@s#1{%
+ \collectbox{\@trimclip\@clipvpbox{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{environment}{clipbox*}
+% \begin{macrocode}
+\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
+ \@collectboxisenv{clipbox*}%
+ \clipbox@s
+}
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{macro}{\marginbox}[1]{Margins as space separated values (like for 'trim')}
+% Collect box first.
+% \begin{macrocode}
+\newcommand\marginbox{%
+ \collectboxcheckenv{marginbox}%
+ \@ifstar
+ \marginbox@s
+ \marginbox@
+}
+\def\marginbox@#1{%
+ \@collectbox{\@trimclip\@marginbox{#1}}%
+}
+\def\marginbox@s#1{%
+ \@collectbox{\@trimclip\@marginraisebox{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{environment}{marginbox*}[1]{Margins as space separated values (like for 'trim')}
+% \begin{macrocode}
+\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
+ \@collectboxisenv{marginbox*}%
+ \marginbox@s
+}
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{macro}{\@trimclip}[2]{<trim/viewport/clip macro>}{<values>}
+% General macro which parses the values and feeds it to the given lower-level macro.
+% Finally the box is typeset. This macro will always be used inside a group
+% created by \Macro\@collectbox.
+% \begin{macrocode}
+\def\@trimclip#1#2{%
+ \tc@readvalues{#2}%
+ #1%
+ \collectedbox
+ \tc@llx
+ \tc@lly
+ \tc@urx
+ \tc@ury
+ \usebox\collectedbox
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Low-level commands}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+% \begin{macro}{\tc@correctbaseline}
+% Adjust baseline if required by negative depth or height.
+% \begin{macrocode}
+\def\tc@correctbaseline#1{%
+% \end{macrocode}
+% If depth is negative lower the box to get zero depth
+% \begin{macrocode}
+ \ifdim\dp#1<\z@
+ \raise\dp#1%
+ \else
+% \end{macrocode}
+% Else if height is negative lower the box to get zero height
+% \begin{macrocode}
+ \ifdim\ht#1<\z@
+ \lower\ht#1%
+ \fi\fi
+ \box#1%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tc@correctdims}
+% Ensure that all dimensions are non-negative.
+% \begin{macrocode}
+\def\tc@correctdims#1{%
+ \ifdim\dp#1<\z@ \dp#1=\z@ \fi
+ \ifdim\wd#1<\z@ \wd#1=\z@ \fi
+ \ifdim\ht#1<\z@ \ht#1=\z@ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@trimbox}[5]{<box register>}{<tllx>}{<tlly>}{<turx>}{<tury>}
+% Removes the four length for the left, bottom, right and top from the official size of the box register.
+% \begin{macrocode}
+\def\@trimbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly-\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx-\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury-\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1-\tc@urx
+ \ht#1-\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\@marginbox}
+% Adds the given margins to the depth, width and height.
+% The left margin is created by an horizontal skip.
+% This implementation assumes that the margins are positive and no special checks are added.
+% While negative margins will trim some margin off, this will not lead to correct results if this amounts
+% are larger than the existing dimensions. For this the \Macro\@trimbox macro should be used.
+% \begin{macrocode}
+\def\@marginbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \dp#1\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@marginraisebox}
+% Like \Macro\@marginbox but raises the box accordant to the bottom margin,
+% so that the original depth is kept.
+% \begin{macrocode}
+\def\@marginraisebox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ % Copy original tty values (ury is taken as temp dimension)
+ \tc@ury=\tc@lly
+ \advance\tc@lly\dp#1%
+ \dp#1\tc@lly
+ % Raise bu original tty value (now in ury)
+ \raise\tc@ury\box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@trimbox}[5]{<box register>}{<tllx>}{<tlly>}{<turx>}{<tury>}
+% Removes the four length for the left, bottom, right and top from the official size of the box register.
+% \begin{macrocode}
+\def\@viewportbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ % Assign values
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \tc@ury=#5\relax
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@clipbox}
+% Clips the box using the given trim amounts.
+% For this the box is first trimmed and then clipped to its official size using a driver dependent macro.
+% \begin{macrocode}
+\def\@clipbox#1#2#3#4#5{%
+ \@trimbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@clipvpbox}
+% Clips the box using the given trim amounts.
+% For this the box is first trimmed and then clipped to its official size using a driver dependent macro.
+% \begin{macrocode}
+\def\@clipvpbox#1#2#3#4#5{%
+ \@viewportbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \subsection{Driver loading}
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% The clipping support is output driver dependent. The driver selected by \pkg{graphics} is used and a definition file
+% is used if its exists. Otherwise either the default \texttt{pdftex} implementation or the \pkg{pgf} fall-back driver
+% is used.
+% \begin{macrocode}
+\InputIfFileExists{\tc@driver}{%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{Using driver '\tc@driver'.}}%
+}{%
+ \input{tc-pgf.def}%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{No clipping driver '\tc@driver' available.\MessageBreak Using fall-back PGF driver.}}%
+}
+% \end{macrocode}
+%
+%
+% \iffalse
+%</trimclip.sty>
+% \fi
+%
+% \subsection{Driver files}
+%
+% \subsubsection{PGF fall-back driver}
+% \iffalse
+%<*tc-pgf.def>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF]
+% \end{macrocode}
+%
+% \begin{macrocode}
+\RequirePackage{pgf}
+% \end{macrocode}
+%
+% \begin{macro}{\@cliptoboxdim}
+% Clips to official box dimension.
+% \begin{macrocode}
+\def\@cliptoboxdim#1{%
+ \setbox#1\hbox{\begin{pgfpicture}%
+ \pgfpathmoveto{\pgfqpoint\z@{-\dp#1}}%
+ \pgfpathlineto{\pgfqpoint\z@{\ht#1}}%
+ \pgfpathlineto{\pgfqpoint{\wd#1}{\ht#1}}%
+ \pgfpathlineto{\pgfqpoint{\wd#1}{-\dp#1}}%
+ \pgfpathclose
+ \pgfusepathqclip
+ \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}%
+ \pgfnode{rectangle}{base west}{\usebox#1}{}{}%
+ \pgfsetbaselinepointnow{\pgfpoint\z@\z@}%
+ \end{pgfpicture}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%^^A vim: ft=tex
+% \iffalse
+%</tc-pgf.def>
+% \fi
+%
+% \subsubsection{pdftex driver}
+% \iffalse
+%<*tc-pdftex.def>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesFile{tc-pdftex.def}[2012/05/13 v1.0 Clipping driver for pdftex]
+% \end{macrocode}
+%
+% \begin{macro}{\@cliptoboxdim}
+% Clips to official box dimension.
+%
+% Uses now \Macro\pdfliteral because \Macro\pdfxform does not support
+% transparencies and patterns with TikZ.
+% \begin{macrocode}
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \pdfsave
+ \pdfliteral direct {%
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
+ }%
+ \hbox to 0pt{\copy#1\hss}%
+ \pdfrestore
+ \hskip \wd#1
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%^^A vim: ft=tex
+% \iffalse
+%</tc-pdftex.def>
+% \fi
+%
+% \subsubsection{dvips driver}
+% \iffalse
+%<*tc-dvips.def>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips]
+% \end{macrocode}
+%
+% \begin{macro}{\@cliptoboxdim}[1]{box register to clip}
+% Clips to official box dimension.
+%
+% The following clipping code was suggested by
+% Joseph Wright (LaTeX3 project), but slightly modified
+% for this package.
+% \begin{macrocode}
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \adjsetlength\@tempdima{\ht#1+\dp#1}%
+ \edef\TOTALHEIGHT{-\strip@pt\@tempdima\space}%
+ \edef\DEPTH{\strip@pt\dp#1\space}%
+ \edef\WIDTH{\strip@pt\wd#1\space}%
+ \special{%
+ ps:
+ /mtrxc matrix currentmatrix def
+ currentpoint gsave
+ translate
+ Resolution 72 div VResolution 72 div
+ scale
+ newpath
+ 0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
+ newpath
+ mtrxc setmatrix
+ }%
+ \box#1%
+ \special{ps: grestore }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%^^A vim: ft=tex
+% \iffalse
+%</tc-dvips.def>
+% \fi
+%
+% \subsubsection{xetex driver}
+% \iffalse
+%<*tc-xetex.def>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\ProvidesFile{tc-xetex.def}[2012/05/13 v1.0 Clipping driver for xetex]
+% \end{macrocode}
+%
+% \begin{macro}{\@cliptoboxdim}
+% Clips to official box dimension.
+%
+% The following clipping code was suggested by
+% Joseph Wright (LaTeX3 project), but slightly modified
+% for this package.
+% \begin{macrocode}
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \special{pdf:bcontent }%
+ \special{%
+ pdf:literal direct
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
+ }%
+ \special{pdf:literal direct W }%
+ \special{pdf:literal direct n }%
+ \box#1%
+ \special{pdf:econtent }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%^^A vim: ft=tex
+% \iffalse
+%</tc-xetex.def>
+% \fi
+%
+% \Finale
+% \endinput
+%
+% ^^A Standalone figures:
+%
+% \iffalse
+%<*box.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+\begin{tikzpicture}[font=\sffamily,>=latex]
+ \newcommand\Cs[1]{\texttt{\scriptsize\textbackslash #1}}
+% Save example text in box
+ \sbox\mybox{\pgfinterruptpicture\sffamily\color{black!25}\scalebox{10}{Xy}\endpgfinterruptpicture}
+ \def\HEIGHT{\ht\mybox}
+ \def\WIDTH{\wd\mybox}
+ \def\DEPTH{\dp\mybox}
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0) node [above,midway] {baseline};
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+ \draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \tikzset{inner sep=5pt}
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [pos=1.1,left,align=left]
+ {depth\\\Cs{depth}\\\Cs{dp}\Cs{br}};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [pos=.4,left,align=left]
+ {height\\\Cs{height}\\\Cs{ht}\Cs{br}};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right,align=left]
+ {totalheight\\\Cs{totalheight}};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below,align=left]
+ {width\\\Cs{width}\\\Cs{wd}\Cs{br}};
+ \fill (-2.5ex,0) circle (.5pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</box.tex>
+% \fi
+%
+% \iffalse
+%<*compare.tex>
+% \fi
+\documentclass{article}
+\usepackage[margin=1cm,paperwidth=20cm,paperheight=100cm]{geometry}
+\usepackage[]{xcolor}
+\usepackage[export]{adjustbox}
+%\listfiles
+\fboxsep=0pt
+\parskip=1cm
+
+\usepackage[tightpage]{preview}
+
+\usepackage{standalone}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{tikz}
+\newdimen\unit
+\tikzset{unit/.code={\unit=\dimexpr#1\relax}}
+\tikzset{xy/.style={x={#1},y={#1},unit={#1},font={\sffamily\fontsize{.2\unit}{.24\unit}\selectfont},line width=.01\unit}}
+
+\def\showdiff#1{%
+ {%
+ \diff=\dimexpr#10-#11\relax
+ \pgfmathsetlength\absdiff{abs(\diff)}%
+ \ifdim\diff=0pt%
+ \textcolor{green}{PASSED}%
+ \else
+ \ifdim\absdiff<\Epsilon
+ \pgfmathtruncatemacro\FCOLOR{100*(\Epsilon-abs(\absdiff))/\Epsilon}%
+ \textcolor{green!\FCOLOR!yellow}{OK: \the\diff}%
+ \else
+ \textcolor{red}{FAILED: \the\diff}%
+ \fi
+ \fi
+ \quad
+ \ifdim#11=0pt
+ \diff=#10
+ \else
+ \pgfmathsetlength\diff{(#10/#11) - 1pt}
+ \fi
+ \ifdim\diff<0pt
+ \absdiff=-\diff
+ \else
+ \absdiff=\diff
+ \fi
+ \ifdim\diff=0pt%
+ \textcolor{green}{PASSED}%
+ \else
+ \ifdim\absdiff<\dEpsilon
+ \pgfmathtruncatemacro\FCOLOR{100*(\dEpsilon-abs(\absdiff))/\dEpsilon}%
+ \textcolor{green!\FCOLOR!yellow}{OK: \the\diff}%
+ \else
+ \textcolor{red}{FAILED: \the\diff}%
+ \fi
+ \fi
+ }%
+}
+
+\newlength\diff
+\newlength\absdiff
+\newlength\Epsilon
+\newlength\dEpsilon
+\Epsilon=0.05pt
+\dEpsilon=0.001pt
+\def\test#1#2{%
+ \begin{preview}%
+ \sbox0{\includegraphics[#1]{#2}}%
+ \sbox1{\adjustbox{#1}{\input{#2}\unskip}}%
+ \begin{tabular}{ll@{}l}
+ \usebox0 & \usebox1 & .\\
+ \the\ht0 & \the\ht1 & \showdiff\ht \\
+ \the\dp0 & \the\dp1 & \showdiff\dp \\
+ \the\wd0 & \the\wd1 & \showdiff\wd \\
+ \end{tabular}%
+ \end{preview}%
+}
+
+\begin{document}
+\ttfamily
+
+\test{}{gridbp}
+
+\test{}{gridpt}
+
+\test{clip,trim=10bp 20bp 0 0,width=177bp,frame=1pt 1pt}{gridbp}
+
+\test{clip,trim=10pt 20pt 0 0,width=177pt,frame=1pt 1pt}{gridpt}
+
+\test{angle=45,clip,trim=10bp 0 0 0,width=177bp,totalheight=5cm,frame}{gridbp}
+
+\test{clip,trim=10pt 0 0 0,angle=90,trim=5pt 0 0 0}{gridbp}
+
+\test{angle=180,totalheight=5cm}{gridbp}
+
+\test{width=3cm,angle=0,totalheight=5cm}{gridbp}
+
+\test{width=3cm,totalheight=5cm,angle=180}{gridbp}
+
+\test{width=3cm,totalheight=5cm}{gridbp}
+
+\test{margin=.5cm .5cm .5cm .5cm,frame}{gridbp}
+\end{document}
+
+\test{width=2cm,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame,angle=5,
+margin=.1cm .1cm .1cm .1cm,frame
+}{gridbp}
+
+\test{width=2cm,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+margin=1pt 1pt 1pt 1pt,frame,angle=1,
+}{gridbp}
+
+
+\end{document}
+
+\adjustbox{width=2cm,trim={.5\WIDTH} 0 0 0,frame}{Ag}
+% \iffalse
+%</compare.tex>
+% \fi
+%
+% \iffalse
+%<*margin2.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Save example text in box
+ \def\text{\scalebox{10}{Xy}}
+ \sbox\mybox{\pgfinterruptpicture\sffamily\color{black!25}\scalebox{10}{Xy}\endpgfinterruptpicture}
+ \def\HEIGHT{\ht\mybox}
+ \def\WIDTH{\wd\mybox}
+ \def\DEPTH{\dp\mybox}
+ \def\LLX{.15\WIDTH}
+ \def\LLY{.5\DEPTH}
+ \def\URX{.15\WIDTH}
+ \def\URY{.25\HEIGHT}
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \begin{scope}[blue,every node/.append style={inner sep=2pt}]
+ \begin{scope}
+ \draw ([shift={(-\LLX,-\LLY)}]0,-\DEPTH) rectangle ([shift={(\URX,\URY)}]\WIDTH,\HEIGHT);
+%\node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+%\draw [->,.!45] (\WIDTH,\HEIGHT) -- ++(-\URX,-\URY);
+%\draw [->,.!45] (0,-\DEPTH) -- ++(\LLX,\LLY);
+ \draw [->] (.5\WIDTH,-\DEPTH) -- ++(0,-\LLY) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,.5*\HEIGHT-.5*\DEPTH) -- ++(-\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw [->] (.5\WIDTH,\HEIGHT) -- ++(0,\URY) node [right,midway] {\scriptsize ury};
+ \draw [->] (\WIDTH,.5*\HEIGHT-.5*\DEPTH) -- ++(\URX,0) node [above,midway] {\scriptsize urx};
+ \draw [->] (.5\WIDTH,-\DEPTH) -- ++(0,-\LLY) node [right,midway] {\scriptsize lly};
+ \draw (-\LLX,-\LLY) -- ([shift={(+\URX,0)}]\WIDTH,-\LLY);
+ \path [fill=white,draw] (-\LLX,-\LLY) circle (1pt);
+ \draw [->] (.5\WIDTH,0pt) -- ++(0,-\LLY) node [right,midway] {\scriptsize lly};
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</margin2.tex>
+% \fi
+%
+% \iffalse
+%<*margin.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\newsavebox\mybox
+
+\begin{document}
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+%</standalone>
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Save example text in box
+ \def\text{\scalebox{10}{Xy}}
+ \sbox\mybox{\pgfinterruptpicture\sffamily\color{black!25}\scalebox{10}{Xy}\endpgfinterruptpicture}
+ \def\HEIGHT{\ht\mybox}
+ \def\WIDTH{\wd\mybox}
+ \def\DEPTH{\dp\mybox}
+ \def\LLX{.15\WIDTH}
+ \def\LLY{.5\DEPTH}
+ \def\URX{.15\WIDTH}
+ \def\URY{.25\HEIGHT}
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \begin{scope}[blue,every node/.append style={inner sep=2pt}]
+ \begin{scope}
+ \draw ([shift={(-\LLX,-\LLY)}]0,-\DEPTH) rectangle ([shift={(\URX,\URY)}]\WIDTH,\HEIGHT);
+%\node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+%\draw [->,.!45] (\WIDTH,\HEIGHT) -- ++(-\URX,-\URY);
+%\draw [->,.!45] (0,-\DEPTH) -- ++(\LLX,\LLY);
+ \draw [->] (.5\WIDTH,-\DEPTH) -- ++(0,-\LLY) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,.5*\HEIGHT-.5*\DEPTH) -- ++(-\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw (-\LLX,0) -- ([shift={(+\URX,0)}]\WIDTH,0);
+ \draw [->] (.5\WIDTH,\HEIGHT) -- ++(0,\URY) node [right,midway] {\scriptsize ury};
+ \draw [->] (\WIDTH,.5*\HEIGHT-.5*\DEPTH) -- ++(\URX,0) node [above,midway] {\scriptsize urx};
+ \path [fill=white,draw] (-\LLX,0) circle (1pt);
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</margin.tex>
+% \fi
+%
+% \iffalse
+%<*trim2.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\usepackage{adjustbox}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+
+% Save example text in box
+\def\text{\sffamily\scalebox{10}{Xy}}
+\sbox\mybox{\sffamily\color{black!25}\scalebox{10}{Xy}}
+\def\HEIGHT{\ht\mybox}
+\def\WIDTH{\wd\mybox}
+\def\DEPTH{\dp\mybox}
+\def\LLX{.15\WIDTH}
+\def\LLY{\DEPTH+.15\HEIGHT}
+\def\URX{.15\WIDTH}
+\def\URY{.25\HEIGHT}
+%
+%\usebox\mybox
+%\rlap{\trimbox{{\LLX} {\LLY} {\URX} {\URY}}{\usebox\mybox}}\clipbox{{\LLX} {\LLY} {\URX} {\URY}}{\color{blue}{\text}}
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
+ \fill (-2.5ex,0) circle (.5pt);
+ \begin{scope}[blue] %,every node/.append style={inner sep=2pt}]
+ \begin{scope}
+ \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+%\draw [->,.!45] (\WIDTH,\HEIGHT) -- ++(-\URX,-\URY);
+%\draw [->,.!45] (0,-\DEPTH) -- ++(\LLX,\LLY);
+ \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \draw [->] (\LLX,-\DEPTH) -- ++(0,\LLY) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw (\LLX,-\DEPTH+\LLY) -- ([shift={(-\URX,0)}]\WIDTH,-\DEPTH+\LLY);
+ \draw [->] (\LLX+.2\WIDTH,-\DEPTH+\LLY) -- (\LLX+.2\WIDTH,0) node [right,midway] {\scriptsize moves down};
+ \path [fill=white,draw] (\LLX,-\DEPTH+\LLY) circle (1pt);
+ \draw [->]
+ ([shift={(-\URX,0)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [left,midway] {\scriptsize ury}
+ ;
+ \draw [->]
+ ([shift={(0,-\URY)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [below,midway] {\scriptsize urx}
+ ;
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</trim2.tex>
+% \fi
+%
+% \iffalse
+%<*trim3.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\usepackage{adjustbox}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+
+% Save example text in box
+\def\text{\sffamily\scalebox{10}{Xy}}
+\sbox\mybox{\sffamily\color{black!25}\scalebox{10}{Xy}}
+\def\HEIGHT{\ht\mybox}
+\def\WIDTH{\wd\mybox}
+\def\DEPTH{\dp\mybox}
+\def\LLX{.15\WIDTH}
+\def\LLY{.4\DEPTH}
+\def\URX{.15\WIDTH}
+\def\URY{(\HEIGHT+.25\DEPTH)}
+%
+%\leavevmode
+%\rlap{\hbox to \wd\mybox{\hrulefill}}\usebox\mybox
+%\rlap{\hbox to \wd\mybox{\hrulefill}}\rlap{\trimbox{{\LLX} {\LLY} {\URX} {\URY}}{\usebox\mybox}}\clipbox{{\LLX} {\LLY} {\URX} {\URY}}{\color{blue}{\text}}
+%\sbox0{\clipbox{{\LLX} {\LLY} {\URX} {\URY}}{\color{blue}{\text}}}%
+%ht=\the\ht0, dp=\the\dp0, wd=\the\wd0
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
+ \fill (-2.5ex,0) circle (.5pt);
+ \begin{scope}[blue] %,every node/.append style={inner sep=2pt}]
+ \begin{scope}
+ \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+%\draw [->,.!45] (\WIDTH,\HEIGHT) -- ++(-\URX,{-\URY});
+%\draw [->,.!45] (0,-\DEPTH) -- ++(\LLX,\LLY);
+ \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \draw [->] (\LLX,-\DEPTH) -- ++(0,\LLY) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw (\LLX,-\DEPTH+\LLY) -- ([shift={(-\URX,0)}]\WIDTH,-\DEPTH+\LLY);
+ \draw [->] (\LLX+.2\WIDTH,{\HEIGHT-\URY}) -- (\LLX+.2\WIDTH,0) node [pos=0.4,below right] {\scriptsize moves up};
+ \path [fill=white,draw] (\LLX,{\HEIGHT-\URY}) circle (1pt);
+ \draw [->]
+ ([shift={(-\URX,0)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [left,midway] {\scriptsize ury}
+ ;
+ \draw [->]
+ ([shift={(0,-\URY)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [below,midway] {\scriptsize urx}
+ ;
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</trim3.tex>
+% \fi
+%
+% \iffalse
+%<*trim.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Save example text in box
+ \def\text{\scalebox{10}{Xy}}
+ \sbox\mybox{\pgfinterruptpicture\sffamily\color{black!25}\scalebox{10}{Xy}\endpgfinterruptpicture}
+ \def\HEIGHT{\ht\mybox}
+ \def\WIDTH{\wd\mybox}
+ \def\DEPTH{\dp\mybox}
+ \def\LLX{.15\WIDTH}
+ \def\LLY{.5\DEPTH}
+ \def\URX{.15\WIDTH}
+ \def\URY{.25\HEIGHT}
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
+ \fill (-2.5ex,0) circle (.5pt);
+ \begin{scope}[blue,every node/.append style={inner sep=2pt}]
+ \begin{scope}
+ \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+%\draw [->,.!45] (\WIDTH,\HEIGHT) -- ++(-\URX,-\URY);
+%\draw [->,.!45] (0,-\DEPTH) -- ++(\LLX,\LLY);
+ \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \draw [->] (\LLX,-\DEPTH) -- ++(0,\LLY) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw (\LLX,0) -- ([shift={(-\URX,0)}]\WIDTH,0);
+ \draw [->]
+ ([shift={(-\URX,0)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [left,midway] {\scriptsize ury}
+ ;
+ \draw [->]
+ ([shift={(0,-\URY)}]\WIDTH,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [below,midway] {\scriptsize urx}
+ ;
+ \path [fill=white,draw] (\LLX,0) circle (1pt);
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</trim.tex>
+% \fi
+%
+% \iffalse
+%<*viewport2.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\usepackage{adjustbox}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+
+% Save example text in box
+\def\text{\sffamily\scalebox{10}{Xy}}
+\sbox\mybox{\sffamily\color{black!25}\scalebox{10}{Xy}}
+\def\HEIGHT{\ht\mybox}
+\def\WIDTH{\wd\mybox}
+\def\DEPTH{\dp\mybox}
+\def\LLX{.15\WIDTH}
+\def\LLY{\DEPTH-.15\HEIGHT}
+\def\URX{.15\WIDTH}
+\def\URY{.25\HEIGHT}
+%
+%\usebox\mybox
+%\rlap{\trimbox{{\LLX} {\LLY} {\URX} {\URY}}{\usebox\mybox}}\clipbox{{\LLX} {\LLY} {\URX} {\URY}}{\color{blue}{\text}}
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
+ \fill (-2.5ex,0) circle (.5pt);
+ \begin{scope}[blue]
+ \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+ \begin{scope}[blue]
+ \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \draw (\LLX,0) -- ([shift={(-\URX,0)}]\WIDTH,0);
+ \path [fill=white,draw] (\LLX,0) circle (1pt);
+ \end{scope}
+ \begin{scope}[blue!50!black] %,every node/.append style={inner sep=2pt}]
+%\draw [->,.!45] (0,0) -- ++(-\URX+\WIDTH,-\URY+\HEIGHT);
+%\draw [->,.!45] (0,0) -- ++(\LLX,\LLY-\DEPTH);
+ \draw [->] (\LLX,0) -- (\LLX,\LLY-\DEPTH) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw [->]
+ ([shift={(-\URX,0)}]\WIDTH,0) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [right,midway] {\scriptsize ury}
+ ;
+ \draw [->]
+ ([shift={(0,-\URY)}]0,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [above,midway] {\scriptsize urx}
+ ;
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</viewport2.tex>
+% \fi
+%
+% \iffalse
+%<*viewport.tex>
+% \fi
+%<*standalone>
+\documentclass{standalone}
+
+\usepackage{tikz}
+\usetikzlibrary{calc}
+\usepackage{adjustbox}
+\newsavebox\mybox
+
+\begin{document}
+%</standalone>
+% Diagram of the TeX box model and its dimensions
+% Copyright (C) 2001 by Martin Scharrer <martin@scharrer.me>, Nov 12th 2011
+% This is free code under the LPPL v1.3 or later version OR the CC BY-SA 3.0
+
+% Save example text in box
+\def\text{\sffamily\scalebox{10}{Xy}}
+\sbox\mybox{\sffamily\color{black!25}\scalebox{10}{Xy}}
+\def\HEIGHT{\ht\mybox}
+\def\WIDTH{\wd\mybox}
+\def\DEPTH{\dp\mybox}
+\def\LLX{.15\WIDTH}
+\def\LLY{\DEPTH+.15\HEIGHT}
+\def\URX{.15\WIDTH}
+\def\URY{.25\HEIGHT}
+%
+%\usebox\mybox
+%\rlap{\trimbox{{\LLX} {\LLY} {\URX} {\URY}}{\usebox\mybox}}\clipbox{{\LLX} {\LLY} {\URX} {\URY}}{\color{blue}{\text}}
+\begin{tikzpicture}[font=\sffamily,>=latex]
+% Extensions lines for dimensions (drawn here to be below other material)
+ \draw [gray,thin]
+ (0,0) -- +(-3.5ex,0)
+ (0,\HEIGHT) -- +(-3.5ex,0)
+ (0,-\DEPTH) -- +(-3.5ex,0)
+ (\WIDTH,\HEIGHT) -- +(3.5ex,0)
+ (\WIDTH,-\DEPTH) -- +(3.5ex,0)
+ (0,-\DEPTH) -- +(0,-3.5ex)
+ (\WIDTH,-\DEPTH) -- +(0,-3.5ex)
+ ;
+% Text node:
+ \node [inner sep=0pt,anchor=base west] {\usebox\mybox};
+% Baseline
+ \draw (0,0) -- (\WIDTH,0);% node [above,midway] {baseline};
+%\draw [<-,shorten <=2pt] (0,0) -- (2ex,-2ex) -- +(.5ex,0) node [right=-0.5ex] {origin};
+% Dimensions
+ \draw [->] (-2.5ex,0) -- +(0,-\DEPTH) node [midway,left] {depth};
+ \draw [->] (-2.5ex,0) -- +(0, \HEIGHT) node [midway,left] {height};
+ \draw [<->] (\WIDTH,-\DEPTH) ++(2.5ex,0) -- +(0,\DEPTH+\HEIGHT) node [midway,right] {totalheight};
+ \draw [<->] (0,-\DEPTH) ++(0,-2.5ex) -- +(\WIDTH,0) node [midway,below] {width};
+ \fill (-2.5ex,0) circle (.5pt);
+ \begin{scope}[blue]
+ \clip ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \node [inner sep=0pt,anchor=base west,color=blue!50!white] {\text};
+ \end{scope}
+ \begin{scope}[blue]
+%\draw [->,.!45] (0,0) -- ++(-\URX+\WIDTH,-\URY+\HEIGHT);
+%\draw [->,.!45] (0,0) -- ++(\LLX,\LLY-\DEPTH);
+ \draw ([shift={(\LLX,\LLY)}]0,-\DEPTH) rectangle ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT);
+ \draw (\LLX,-\DEPTH+\LLY) -- ([shift={(-\URX,0)}]\WIDTH,-\DEPTH+\LLY);
+ \draw [->] (\LLX+.2\WIDTH,-\DEPTH+\LLY) -- (\LLX+.2\WIDTH,0) node [right,midway] {\scriptsize moves down};
+ \path [fill=white,draw] (\LLX,-\DEPTH+\LLY) circle (1pt);
+ \end{scope}
+ \begin{scope}[blue!50!black] %,every node/.append style={inner sep=2pt}]
+ \draw [->] (\LLX,0) -- (\LLX,\LLY-\DEPTH) node [right,midway] {\scriptsize lly};
+ \draw [->] (0,-\DEPTH+\LLY) -- ++(\LLX,0) node [above,midway] {\scriptsize llx};
+ \draw [->]
+ ([shift={(-\URX,0)}]\WIDTH,0) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [right,midway] {\scriptsize ury}
+ ;
+ \draw [->]
+ ([shift={(0,-\URY)}]0,\HEIGHT) --
+ ([shift={(-\URX,-\URY)}]\WIDTH,\HEIGHT)
+ node [above,midway] {\scriptsize urx}
+ ;
+ \end{scope}
+% Box
+ \draw [thick] (0,-\DEPTH) rectangle (\WIDTH,\HEIGHT);
+% Origin
+ \path [fill=white,draw=black] (0,0) circle (1pt);
+% Center inner box
+ \path let
+ \p1 = (current bounding box.south west),
+ \p2 = (current bounding box.north east),
+ \p3 = (0,-\DEPTH),
+ \p4 = (\WIDTH,\HEIGHT)
+ in
+ (\x3-\x2+\x4,\y3) rectangle (\x4+\x3-\x1,\y4);
+\end{tikzpicture}
+%<*standalone>
+\end{document}
+%</standalone>
+% \iffalse
+%</viewport.tex>
+% \fi
+%
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
index 0fc7a627de3..98c05a8e6ed 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
+++ b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
@@ -1,15 +1,29 @@
-\begingroup
-\def\@tempa{adjcalc}
-\expandafter
-\endgroup
-\ifx\@tempa\@currname
- \ProvidesPackage{adjcalc}[2011/08/07 v1.0 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
- \RequirePackage{xkeyval}
-\fi
-\AtEndOfPackage{\adjcalc@atend}
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files adjcalc.dtx, adjustbox.ins
+%% and the derived file adjcalc.sty.
+%% It is part of the larger adjustbox bundle.
+%%
+\ProvidesPackage{adjcalc}[%
+ 2012/05/16
+ v1.1
+ Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
+\RequirePackage{xkeyval}
\def\adjcalc@atend{%
\begingroup
-\expandafter\ifx\csname eTeXversion\endcsname\relax
+\expandafter\ifx\csname glueexpr\endcsname\relax
\endgroup
\RequirePackage{calc}%
\adjcalc@calc
@@ -23,13 +37,42 @@
\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
-\DeclareOptionX<adjbox>{pgfmath}{\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>{etex}{\adjcalc@etex}
-\DeclareOptionX<adjbox>{calc}{\adjcalc@calc}
-\DeclareOptionX<adjbox>{none}{\let\adjcalc@atend\relax\def\adjsetlength{\setlength}\let\adjcalc@overwrite\relax}
-\DeclareOptionX<adjbox>{overwrite}{\adjcalc@overwrite}
-\ProcessOptionsX*<adjbox>
-\disable@keys{adjbox}{none}
+\def\adjcalc@defaultunit{bp}%
+\DeclareOptionX<adjcalc>{pgfmath}{\adjcalc@pgfmath}
+\DeclareOptionX<adjcalc>{etex}{\adjcalc@etex}
+\DeclareOptionX<adjcalc>{calc}{\adjcalc@calc}
+\DeclareOptionX<adjcalc>{none}{%
+ \let\adjcalc@atend\relax
+ \let\adjcalc@overwrite\relax
+ \def\adjsetlength{\setlength}%
+ \def\adjaddtolength{\addtolength}%
+ \def\adjsetcounter{\setcounter}%
+ \def\adjaddtocounter{\addtocounter}%
+}
+\DeclareOptionX<adjcalc>{overwrite}{\adjcalc@overwrite}
+\DeclareOptionX<adjcalc>{defaultunit}[bp]{%
+ \begingroup
+ \def\@tempa{#1}%
+ \def\@tempb{none}%
+ \ifx\@tempa\@tempb% 'none':
+ \endgroup
+ \def\adjsetlengthdefault{\adjsetlength}%
+ \else
+ \ifx\@tempb\adjcalc@defaultunit
+ \endgroup
+ % was 'none' before
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+ \else
+ \endgroup
+ \fi
+ \fi
+ \def\adjcalc@defaultunit{#1}%
+}
+\ProcessOptionsX*<adjcalc>
+\disable@keys{adjcalc}{none}
+\def\adjcalcset{%
+ \setkeys{adjcalc}%
+}
\def\adjcalc@etex{%
\protected\def\adjsetlength##1##2{%
##1=\glueexpr(##2)\relax
@@ -47,56 +90,58 @@
{\@nocounterr{##1}}%
{\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
}%
- \def\adjbox@default##1##2{%
- \@defaultunits##1=\glueexpr##2 \adjbox@defaultunit\relax\@nnil
+ \def\adjsetlengthdefault@##1##2{%
+ \@defaultunits##1=\glueexpr##2 \adjcalc@defaultunit\relax\@nnil
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
+\newif\if@adjcalc@needsdefault
\def\adjcalc@calc{%
\DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
\DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
\DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
\DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
- \def\adjbox@default##1##2{%
+ \def\adjsetlengthdefault@##1##2{%
\begingroup
- \message{^^J\detokenize{##2}^^J}%
\def\calc@post@scan####1!{%
\def\@tempa{####1}%
\ifx\@tempa\@empty
\endgroup% to end calc processing
% is number only
- \global\@adjbox@needsdefaulttrue
+ \global\@adjcalc@needsdefaulttrue
\else
\endgroup% to end calc processing
% full expression
- \global\@adjbox@needsdefaultfalse
+ \global\@adjcalc@needsdefaultfalse
\fi
}%
- \calc@assign@skip{##1}{##2 \adjbox@defaultunit}%
+ \calc@assign@skip{##1}{##2 \adjcalc@defaultunit}%
\endgroup
- \if@adjbox@needsdefault
- ##1=##2 \adjbox@defaultunit\relax
+ \if@adjcalc@needsdefault
+ ##1=##2 \adjcalc@defaultunit\relax
\else
\calc@assign@skip{##1}{##2}%
\fi
}%
- \def\adjbox@checkdefault##1\@nnil##2##3{%
+ \def\adjcalc@checkdefault##1\@nnil##2##3{%
\ifx\relax##1\relax\else
\calc@assign@skip{##2}{##3}%
\fi
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
-\newif\if@adjbox@needsdefault
\def\adjcalc@pgfmath{%
\DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
\DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
\DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
\DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
- \def\adjbox@default##1##2{%
- \edef\pgfmathresultunitscale{1\adjbox@defaultunit}%
+ \def\adjsetlengthdefault@##1##2{%
+ \edef\pgfmathresultunitscale{1\adjcalc@defaultunit}%
\let\pgfmathpostparse\pgfmathscaleresult
\pgfmathparse{##2}%
##1=\pgfmathresult pt\relax
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
\def\adjcalc@overwrite{%
\let\setlength\adjsetlength
@@ -104,6 +149,7 @@
\let\setcounter\adjsetcounter
\let\addtocounter\adjaddtocounter
}
+\adjcalc@atend
\endinput
%%
%% End of file `adjcalc.sty'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty b/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty
deleted file mode 100644
index 8b0afff8ffa..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty
+++ /dev/null
@@ -1,144 +0,0 @@
-\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox]
-\RequirePackage{graphicx}
-%%^^A \width, \height, \totalheight, \depth = size current at option execution (changes after every option) (initial: natural size)
-%%^^A \Width, \Height, \Totalheight, \Depth = requested size of image (height/totalheight and width) (initial: natural size)
-%%^^A \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH = natural size of image
-%%
-%%
-\newcommand*\Gin@adj@adddim{%
- \let\height\Gin@nat@height
- \let\width\Gin@nat@width
- \let\totalheight\height
- \let\depth\z@
- \let\adjbox@HEIGHT\HEIGHT
- \let\adjbox@WIDTH\WIDTH
- \let\adjbox@TOTALHEIGHT\TOTALHEIGHT
- \let\adjbox@DEPTH\DEPTH
- \global\let\HEIGHT\Gin@nat@height
- \global\let\WIDTH\Gin@nat@width
- \global\let\TOTALHEIGHT\HEIGHT
- \global\let\DEPTH\z@
- \let\adjbox@Height\Height
- \let\adjbox@Width\Width
- \let\adjbox@Totalheight\Totalheight
- \let\adjbox@Depth\Depth
- \global\let\Height\Gin@nat@height
- \global\let\Width\Gin@nat@width
- \global\let\Totalheight\Height
- \global\let\Depth\z@
- \edef\adjbox@restore@dims{%
- \global\adjbox@nat@height\the\adjbox@nat@height\relax
- \global\adjbox@nat@width \the\adjbox@nat@width\relax
- \global\adjbox@req@height\the\adjbox@req@height\relax
- \global\adjbox@req@width \the\adjbox@req@width\relax
- }%
-}
-\newcommand*\Gin@adj@remdim{%
- \global\let\HEIGHT\adjbox@HEIGHT
- \global\let\WIDTH\adjbox@WIDTH
- \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT
- \global\let\DEPTH\adjbox@DEPTH
- \global\let\Height\adjbox@Height
- \global\let\Width\adjbox@Width
- \global\let\Totalheight\adjbox@Totalheight
- \global\let\Depth\adjbox@Depth
- \adjbox@restore@dims
-}
-\newdimen\adjbox@nat@width
-\newdimen\adjbox@nat@height
-\newdimen\adjbox@req@width
-\newdimen\adjbox@req@height
-\newcommand*\Gin@adj@keepdim{%
- \global\adjbox@nat@height\Gin@nat@height
- \global\adjbox@nat@width \Gin@nat@width
- \global\adjbox@req@height\Gin@req@height
- \global\adjbox@req@width \Gin@req@width
- \global\let\HEIGHT\adjbox@nat@height
- \global\let\WIDTH\adjbox@nat@width
- \global\let\TOTALHEIGHT\adjbox@nat@height
- \global\let\DEPTH\z@
- \global\let\Height\adjbox@req@height
- \global\let\Width\adjbox@req@width
- \global\let\Totalheight\adjbox@req@height
- \global\let\Depth\z@
-}
-\def\Gin@ii[#1]#2{%
- \def\@tempa{[}\def\@tempb{#2}%
- \ifx\@tempa\@tempb
- \def\@tempa{\Gin@iii[#1][}%
- \expandafter\@tempa
- \else
- \begingroup
- \Gin@adj@adddim
- \@tempswafalse
- \toks@{\Ginclude@graphics{#2}}%
- \setkeys{Gin}{#1}%
- \Gin@esetsize
- \the\toks@
- \Gin@adj@remdim
- \endgroup
- \fi}
-\def\Gin@iii[#1,#2][#3,#4]#5{%
- \begingroup
- \Gin@adj@adddim
- \Gin@bboxtrue
- \Gin@defaultbp\Gin@llx{#1}%
- \Gin@defaultbp\Gin@lly{#2}%
- \Gin@defaultbp\Gin@urx{#3}%
- \Gin@defaultbp\Gin@ury{#4}%
- \Ginclude@graphics{#5}%
- \Gin@adj@remdim
- \endgroup}
-\def\Gin@setfile#1#2#3{%
- \ifx\\#2\\\Gread@false\fi
- \ifGin@bbox\else
- \ifGread@
- \csname Gread@%
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- eps%
- \else
- #1%
- \fi
- \endcsname{\Gin@base#2}%
- \else
- \Gin@nosize{#3}%
- \fi
- \fi
- \Gin@viewport@code
- \Gin@nat@height\Gin@ury bp%
- \advance\Gin@nat@height-\Gin@lly bp%
- \Gin@nat@width\Gin@urx bp%
- \advance\Gin@nat@width-\Gin@llx bp%
- \Gin@req@sizes
- \Gin@adj@keepdim
- \expandafter\ifx\csname Ginclude@#1\endcsname\relax
- \Gin@drafttrue
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- \@latex@error{Can not include graphics of type: #1}\@ehc
- \global\expandafter\let\csname Gread@#1\endcsname\@empty
- \fi
- \fi
- \leavevmode
- \ifGin@draft
- \hb@xt@\Gin@req@width{%
- \vrule\hss
- \vbox to \Gin@req@height{%
- \hrule \@width \Gin@req@width
- \vss
- \edef\@tempa{#3}%
- \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
- \vss
- \hrule}%
- \hss\vrule}%
- \else
- \@addtofilelist{#3}%
- \ProvidesFile{#3}[Graphic file (type #1)]%
- \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
- \dp\z@\z@
- \ht\z@\Gin@req@height
- \wd\z@\Gin@req@width
- \box\z@
- \fi}
-\endinput
-%%
-%% End of file `adjgrfx.sty'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def b/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def
deleted file mode 100644
index d5469f69f87..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def
+++ /dev/null
@@ -1,30 +0,0 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
-%% 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://www.latex-project.org/lppl.txt
-%% 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 Martin Scharrer.
-%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
-%%
-\ProvidesFile{adjpdftex.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for pdftex]
-\def\@cliptoboxdim#1{%
- \pdfxform#1%
- \setbox#1=\hbox{%
- \pdfrefxform\pdflastxform
- }%
-}
-\endinput
-%%
-%% End of file `adjpdftex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
index 819c1cbbb99..7ce9d94a77e 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
+++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
@@ -1,7 +1,5 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% 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.
@@ -18,36 +16,39 @@
%% and the derived file adjustbox.sty.
%%
\ProvidesPackage{adjustbox}[%
- 2011/11/14
- v0.8
+ 2012/05/16
+ v0.9
Adjusting TeX boxes (trim, clip, ...)]
\RequirePackage{xkeyval}
-\def\adjbox@defaultunit{bp}
-\DeclareOptionX<adjbox>{defaultunit}{%
- \def\adjbox@defaultunit{#1}%
- \begingroup
- \def\@tempa{none}%
- \expandafter\endgroup
- \ifx\@tempa\adjbox@defaultunit
- \def\adjbox@default{\adjsetlength}%
- \fi
-}
+\RequirePackage{adjcalc}
\def\adjbox@fam{adjbox}
-\DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}}
-\DeclareOptionX<adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
-\DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}}
-\DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput}
-\def\adjbox@driver{adj\Gin@driver}
-\DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}}
-\DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}}
-\let\adjbox@maybeend\relax
-\input{adjcalc.sty}
-\disable@keys{adjbox}{patch,export,PGF,minimal}
+\DeclareOptionX<Adjbox>{export}{\def\adjbox@fam{Gin}}
+\DeclareOptionX<Adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
+\DeclareOptionX<Adjbox>{patch}{%
+ \PackageWarning{adjustbox}{%
+ The 'patch' option is now deprecated.\MessageBreak
+ Use the new \string\adjustimage\space or \string\adjincludegraphics\space macros instead%
+ \@gobble
+ }%
+}
+\DeclareOptionX<Adjbox>{minimal}{\let\adjustbox@minimal\endinput}
+\DeclareOptionX<Adjbox>{pgfmath}{\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+\DeclareOptionX<Adjbox>{calc}{\AtEndOfPackage{\RequirePackage{calc}\adjcalcset{calc}}}
+\DeclareOptionX<Adjbox>{etex}{\AtEndOfPackage{\adjcalcset{etex}}}
+\DeclareOptionX<Adjbox>{defaultunit}{\AtEndOfPackage{\adjcalcset{defaultunit={#1}}}}
+\DeclareOptionX<Adjbox>{pgf}{\PassOptionsToPackage{pgf}{trimclip}}
+\DeclareOptionX<Adjbox>{PGF}{\PassOptionsToPackage{pgf}{trimclip}\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+\DeclareOptionX*{%
+ \IfFileExists{tc-\CurrentOption.def}{%
+ \PassOptionsToPackage\CurrentOption{trimclip}%
+ }{%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
+\ProcessOptionsX*<Adjbox>\relax
+\RequirePackage{trimclip}
\RequirePackage{graphicx}[1999/02/16]
-\RequirePackage{collectbox}[2011/08/22]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{collectbox}[2012/05/13]
\newcommand*\adjustboxset{%
\@ifstar
{\adjbox@addkeysafter}%
@@ -81,112 +82,15 @@
\fi
}
\let\adjbox@keysafter\@empty
-\define@key{adjbox}{viewport}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjbox@@viewport
- \adjustbox@@@trimclip
- }%
-}
-\define@key{adjbox}{trim}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjustbox@@@trimclip
- }%
-}
-\def\adjustbox@@@trimclip{%
- \ifGin@clip
- \expandafter\@clipbox
- \else
- \expandafter\@trimbox
- \fi
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\def\adjbox@parse@v#1{%
- \adjbox@parse@@v#1 {} {} {} \\%
-}
-\def\adjbox@parse@@v#1 #2 #3 #4 #5\\{%
- \adjbox@default\adjbox@tllx{#1}%
- \ifx\@nnil#2\@nnil
- \adjbox@tlly\adjbox@tllx
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@tlly{#2}%
- \ifx\@nnil#3\@nnil
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@turx{#3}%
- \adjbox@default\adjbox@tury{#4}%
- \fi
- \fi
-}%
-%%\newdimen\adjbox@llx
-%%\newdimen\adjbox@lly
-%%\newdimen\adjbox@urx
-%%\newdimen\adjbox@ury
-\newdimen\adjbox@tllx
-\newdimen\adjbox@tlly
-\newdimen\adjbox@turx
-\newdimen\adjbox@tury
-\def\adjbox@@viewport{%
- %\advance\adjbox@tllx by -\z@
- \advance\adjbox@tlly by \dp\collectedbox
- \advance\adjbox@turx by -\wd\collectedbox
- \advance\adjbox@tury by -\ht\collectedbox
- \adjbox@turx=-\adjbox@turx
- \adjbox@tury=-\adjbox@tury
-}
-\newcommand\trimbox{%
- \collectboxcheckenv{trimbox}%
- \@ifstar
- \trimbox@s
- \trimbox@
-}
-\def\trimbox@#1{%
- \collectbox{\trimbox@@\@trimbox{#1}}%
-}
-\def\trimbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@trimbox}{#1}}%
-}
-\def\trimbox@@#1#2{%
- \adjbox@parse@v{#2}%
- #1%
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
- \@collectboxisenv{trimbox*}%
- \trimbox@s
-}
-\newcommand\clipbox{%
- \collectboxcheckenv{clipbox}%
- \@ifstar
- \clipbox@s
- \clipbox@
-}
-\def\clipbox@#1{%
- \collectbox{\trimbox@@\@clipbox{#1}}%
-}
-\def\clipbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@clipbox}{#1}}%
-}
-\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
- \@collectboxisenv{clipbox*}%
- \clipbox@s
-}
\newcommand\adjustbox[1]{%
+ \begingroup
+ \edef\adjbox@line{\the\inputlineno}%
+ \let\collectbox@mode\relax
+ \let\collectbox@noindent\relax
\collectboxcheckenv{adjustbox}%
+ \ifcollectboxenv\else
+ \let\adjustbox@noindent\relax
+ \fi
\begingroup
\adjbox@setkeys{#1}%
\expandafter\expandafter\expandafter
@@ -208,6 +112,7 @@
\def\adjbox@setkeys{%
\setkeys*{ADJBOX}%
}
+\let\adjustbox@noindent\noindent
\def\adjustbox@#1{%
\adjbox@Width\width
\adjbox@Height\height
@@ -221,9 +126,11 @@
\@tempswatrue
\toks@{{\adjustbox@content}}%
\def\setlength{\adjsetlength}%
- \setkeys{adjbox,Gin}{#1}%
+ \setkeys{adjbox,Gin,adjcalc}{#1}%
\adjbox@esetsize
+ \adjustbox@noindent
\the\toks@
+ \endgroup
}
\def\adjustbox@content{%
\usebox\collectedbox
@@ -252,57 +159,283 @@
\newcommand*\adjincludegraphics[2][]{%
\adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\def\@trimbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip-\@tempdima
- \adjsetlength\@tempdima{\dp#5 - (#2)}%
- \adjsetlength\@tempdimb{\wd#5 - (#3)}%
- \adjsetlength\@tempdimc{\ht#5 - (#4)}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \ifdim\dp#5<\z@
- \raise\dp#5%
- \else
- \ifdim\ht#5<\z@
- \lower\ht#5%
- \fi\fi
- \box#5%
+{\csname adjustbox@minimal\endcsname}
+\def\adjbox@Gin@add#1{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
+}
+\def\adjbox@Gin@Add{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjbox@Gin@add
+}
+\def\adjbox@Gin@sizeadd#1#2#3\relax{%
+ \ifx\@nnil#3\@nnil
+ \adjbox@Gin@add{#1{#2}{#2}}%
+ \else
+ \adjbox@Gin@add{#1{#2}{#3}}%
+ \fi
+}
+\define@key{adjbox}{viewport}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipvpbox
+ \else
+ \expandafter\@viewportbox
+ \fi
+ }{#1}%
}%
- \ifdim\dp#5<\z@ \dp#5=\z@ \fi
- \ifdim\wd#5<\z@ \wd#5=\z@ \fi
- \ifdim\ht#5<\z@ \ht#5=\z@ \fi
-}
-\def\@clipbox#1#2#3#4#5{%
- \@trimbox{#1}{#2}{#3}{#4}{#5}%
- \@cliptoboxdim{#5}%
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\InputIfFileExists{\adjbox@driver}{%
- \PackageInfo{adjustbox}{Using driver '\adjbox@driver'.}%
-}{%
- \input{adjpgf.def}%
- \PackageInfo{adjustbox}{Using fall-back PGF driver.}
}
-\adjbox@maybeend
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\phantombox[3]{%
- \begingroup
+\define@key\adjbox@fam{Viewport}{%
+ \adjbox@Gin@Add{\trimbox@s{#1}}%
+}
+\define@key{adjbox}{trim}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipbox
+ \else
+ \expandafter\@trimbox
+ \fi
+ }{#1}%
+ }%
+}
+\define@key\adjbox@fam{Trim}{%
+ \adjbox@Gin@Add{\trimbox@{#1}}%
+}
+\define@key\adjbox@fam{Clip}{%
+ \adjbox@Gin@Add{\clipbox@{#1}}%
+}
+\define@key\adjbox@fam{Clip*}{%
+ \adjbox@Gin@Add{\clipbox@s{#1}}%
+}
+\define@key\adjbox@fam{margin}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
+}
+\define@key\adjbox@fam{margin*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
+}
+\define@key\adjbox@fam{padding}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
+}
+\define@key\adjbox@fam{padding*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
+}
+\define@key\adjbox@fam{scale}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@scale@xy
+ }{%
+ \adjbox@scale@x
+ }#1\@nnil
+}
+\def\adjbox@scale@x#1\@nnil{%
+ \adjbox@scale@xy{#1}{#1}\@nnil%
+}
+\def\adjbox@scale@xy#1#2\@nnil{%
+ \if@tempswa
+ \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
+ \else
+ \def\Gin@req@sizes{%
+ \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
+ \Gin@req@height\Gin@scaley\Gin@nat@height
+ \Gin@req@width\Gin@scalex\Gin@nat@width}%
+ \fi
+ \@tempswatrue
+}
+\define@key\adjbox@fam{reflect}[]{%
+ \adjbox@scale@xy{-1}{1}\@nnil
+}
+\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
+\def\adjbox@halign#1#2#3{%
+ \Gin@esetsize
+ \@tempswatrue
\adjsetlength\@tempdima{#1}%
- \adjsetlength\@tempdimb{#2}%
- \adjsetlength\@tempdimc{#3}%
- \setbox\collectedbox\hbox{}%
- \wd\collectedbox\@tempdima
- \ht\collectedbox\@tempdimb
- \dp\collectedbox\@tempdimc
+ \edef\@tempa{\leavevmode\hb@xt@\the\@tempdima}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
+}
+\define@key\adjbox@fam{center}[\linewidth]{%
+ \adjbox@halign{#1}\hss\hss
+}
+\define@key\adjbox@fam{left}[\linewidth]{%
+ \adjbox@halign{#1}\relax\hss
+}
+\define@key\adjbox@fam{right}[\linewidth]{%
+ \adjbox@halign{#1}\hss\relax
+}
+\define@key\adjbox@fam{outer}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\hss\relax}%
+ {\@tempa\relax\hss}%
+ \else
+ \@tempa\hss\hss
+ \fi
+}
+\define@key\adjbox@fam{inner}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\relax\hss}%
+ {\@tempa\hss\relax}%
+ \else
+ \@tempa\hss\hss
+ \fi
+}
+\def\adjbox@ifoddpage{%
+ \begingroup
+ \adjbox@checkoddpage
+ \expandafter\endgroup
+ \ifoddpage
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\adjbox@checkoddpage{%
+ \ifodd\c@page
+ \oddpagetrue
+ \else
+ \oddpagefalse
+ \fi
+}%
+\newif\ifoddpage
+\AtBeginDocument{%
+ \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
+ {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
+}%
+\define@key\adjbox@fam{raise}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@raise
+ }{%
+ \adjbox@raise{#1}{}{}%
+ }#1{}{}{}\@nnil
+}
+\def\adjbox@raise#1#2#3#4\@nnil{%
+ \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
+}
+\define@key\adjbox@fam{valign}{%
+ \csname adjbox@valign@#1\endcsname
+}
+\def\adjbox@raisebox#1#2#3{%
+ \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
+}
+\def\adjbox@@raisebox#1#2#3{%
+ \ifx\@nnil#1\@nnil
+ \setbox\@tempboxa\copy\collectedbox
+ \else
+ \adjsetlength\@tempdima{#1}%
+ \setbox\@tempboxa\hbox{\raise\@tempdima\copy\collectedbox}%
+ \fi
+ \ifx\@nnil#2\@nnil\else
+ \adjsetlength\@tempdima{#2}%
+ \ht\@tempboxa\@tempdima
+ \fi
+ \ifx\@nnil#3\@nnil\else
+ \adjsetlength\@tempdima{#3}%
+ \dp\@tempboxa\@tempdima
+ \fi
+ \box\@tempboxa
+}
+\def\adjboxvtop{\ht\strutbox}
+\def\adjboxvcenter{1ex}
+\def\adjboxvbottom{-\dp\strutbox}
+\def\adjbox@valign@t{%
+ \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}%
+}
+\def\adjbox@valign@T{%
+ \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}%
+}
+\def\adjbox@valign@M{%
+ \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}%
+}
+\def\adjbox@valign@m{%
+ \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}%
+}
+\def\adjbox@valign@c{%
+ \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}%
+}
+\def\adjbox@vcenter{%
\leavevmode
- \box\collectedbox
- \endgroup
+ \hbox{%
+ $\vcenter{\hbox{\BOXCONTENT}}\m@th$
+ }%
+}
+\def\adjbox@valign@b{%
+ \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}%
+}
+\def\adjbox@valign@B{%
+ \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}%
+}
+\define@key\adjbox@fam{set height}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
+}
+\define@key\adjbox@fam{set depth}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
+}
+\define@key\adjbox@fam{set vsize}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
+}
+\define@key\adjbox@fam{vspace}{%
+ \adjbox@vskip#1 {} \@nnil{}%
+}
+\define@key\adjbox@fam{vspace*}{%
+ \adjbox@vskip#1 {} \@nnil*%
+}
+\def\adjbox@vskip#1 #2 #3\@nnil#4{%
+ \ifx\@nnil#2\@nnil
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#1}}%
+ \else
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#2}}%
+ \fi
+}
+\define@key\adjbox@fam{min width}{%
+ \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
+}
+\define@key\adjbox@fam{max width}{%
+ \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
+}
+\define@key\adjbox@fam{min height}{%
+ \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
+}
+\define@key\adjbox@fam{max height}{%
+ \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
+}
+\define@key\adjbox@fam{min totalheight}{%
+ \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
+}
+\define@key\adjbox@fam{max totalheight}{%
+ \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
+}
+\define@key\adjbox@fam{min size}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
+}
+\define@key\adjbox@fam{max size}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
+}
+\define@key\adjbox@fam{min totalsize}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+}
+\define@key\adjbox@fam{max totalsize}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+}
+\define@key\adjbox@fam{warn width}[\linewidth]{%
+ \adjust@addcode{\@collectbox{%
+ \@tempdima=#1\relax
+ \ifdim\width>\@tempdima
+ \advance\@tempdima by -\width
+ \@tempdima=-\@tempdima
+ \typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
+ \ifnum\adjbox@line=\inputlineno
+ line \adjbox@line
+ \else
+ lines \adjbox@line--\the\inputlineno
+ \fi
+ }%
+ \fi
+ \BOXCONTENT
+ }}{}%
}
\newcommand*\minsizebox{%
\collectboxcheckenv{minsizebox}%
@@ -379,20 +512,6 @@
\Gscale@box\@tempa[\@tempb]\BOXCONTENT
\fi
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\define@key\adjbox@fam{Trim}{%
- \adjbox@Gin@Add{\trimbox@{#1}}%
-}
-\define@key\adjbox@fam{Viewport}{%
- \adjbox@Gin@Add{\trimbox@s{#1}}%
-}
-\define@key\adjbox@fam{Clip}{%
- \adjbox@Gin@Add{\clipbox@{#1}}%
-}
-\define@key\adjbox@fam{Clip*}{%
- \adjbox@Gin@Add{\clipbox@s{#1}}%
-}
\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
\adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
}
@@ -427,7 +546,9 @@
\relax
\global\let\adjbox@checkcolor\relax
\else
- \PackageError{adjustbox}{Using a macro, envrionment or key with color\MessageBreak requires a color package to be loaded manually.\MessageBreak Recommended is 'xcolor' but 'color' is ok, too}{}.
+ \PackageError{adjustbox}{Using a macro, environment or key with color\MessageBreak
+ requires a color package to be loaded manually.\MessageBreak
+ Recommended is 'xcolor' but 'color' is ok, too}{}.
\fi
}
\def\adjbox@@frame#1#2#3#4{%
@@ -437,13 +558,8 @@
\ifx\@nnil#3\@nnil\else
\adjsetlength\fboxsep{#3}%
\fi
- \adjsetlength\adjbox@tllx{\fboxrule + \fboxsep}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
+ \adjsetlength\tc@llx{\fboxrule + \fboxsep}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
\ifx\@nnil#4\@nnil\else
\setbox\collectedbox
\fi
@@ -454,13 +570,8 @@
\adjbox@boxframe\width\height\depth
\color@endgroup\egroup
\ifx\@nnil#4\@nnil\else
- \adjsetlength\adjbox@tllx{#4}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
+ \adjsetlength\tc@llx{#4}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
\BOXCONTENT
\fi
}
@@ -489,57 +600,6 @@
}%
}%
}
-\define@key\adjbox@fam{scale}{%
- \@ifnextchar\bgroup{%
- \adjbox@scale@xy
- }{%
- \adjbox@scale@x
- }#1\@nnil
-}
-\def\adjbox@scale@x#1\@nnil{%
- \adjbox@scale@xy{#1}{#1}\@nnil%
-}
-\def\adjbox@scale@xy#1#2\@nnil{%
- \if@tempswa
- \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
- \else
- \def\Gin@req@sizes{%
- \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
- \Gin@req@height\Gin@scaley\Gin@nat@height
- \Gin@req@width\Gin@scalex\Gin@nat@width}%
- \fi
- \@tempswatrue
-}
-\define@key\adjbox@fam{reflect}[]{%
- \adjbox@scale@xy{-1}{1}\@nnil
-}
-\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
-\define@key\adjbox@fam{lap}{%
- \@ifnextchar\bgroup{%
- \adjbox@lapbox
- }{%
- \adjbox@lapbox{#1}{}%
- }#1{}{}\@nnil
-}
-\def\adjbox@lapbox#1#2#3\@nnil{%
- \ifx\@nnil#2\@nnil
- \adjbox@Gin@Add{\lapbox{#1}}%
- \else
- \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
- \fi
-}
-\define@key\adjbox@fam{rlap}[]{%
- \adjbox@Gin@Add{\lapbox{\width}}%
-}
-\define@key\adjbox@fam{llap}[]{%
- \adjbox@Gin@Add{\lapbox{-\width}}%
-}
-\define@key\adjbox@fam{margin}{%
- \adjbox@Gin@Add{\marginbox@{#1}}%
-}
-\define@key\adjbox@fam{margin*}{%
- \adjbox@Gin@Add{\marginbox@s{#1}}%
-}
\define@key\adjbox@fam{dpi}{%
\adjsetlength\pdfpxdimen{1in/(#1)}%
}
@@ -555,69 +615,48 @@
\define@key{ADJBOX}{Execute}{%
#1%
}
-\define@key\adjbox@fam{raise}{%
- \@ifnextchar\bgroup{%
- \adjbox@raise
- }{%
- \adjbox@raise{#1}{}{}%
- }#1{}{}{}\@nnil
-}
-\def\adjbox@raise#1#2#3#4\@nnil{%
- \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
-}
-\define@key\adjbox@fam{valign}{%
- \csname adjbox@valign@#1\endcsname
+\define@key{adjbox}{Addcode}{%
+ \adjust@@addcode#1{}\@nnil%
}
-\def\adjbox@raisebox#1#2#3{%
- \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
+\define@key{adjbox}{addcode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@@addcode#1{}\@nnil%
}
-\def\adjbox@@raisebox#1#2#3{%
- \ifx\@nnil#1\@nnil
- \setbox\@tempboxa\box\collectedbox
+\long\def\adjust@@addcode#1#2#3\@nnil{%
+ \ifx\@nnil#3\@nnil
+ \adjust@addcode{#1}{#2}%
\else
- \adjsetlength\@tempdima{#1}%
- \sbox\@tempboxa{\raise\@tempdima\box\collectedbox}%
- \fi
- \ifx\@nnil#2\@nnil\else
- \adjsetlength\@tempdima{#2}%
- \ht\@tempboxa\@tempdima
- \fi
- \ifx\@nnil#3\@nnil\else
- \adjsetlength\@tempdima{#3}%
- \dp\@tempboxa\@tempdima
+ \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
\fi
- \box\@tempboxa
-}
-\def\adjboxvtop{\ht\strutbox}
-\def\adjboxvcenter{1ex}
-\def\adjboxvbottom{-\dp\strutbox}
-\def\adjbox@valign@t{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}%
}
-\def\adjbox@valign@T{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}%
-}
-\def\adjbox@valign@M{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}%
-}
-\def\adjbox@valign@m{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}%
-}
-\def\adjbox@valign@c{%
- \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}%
+\define@key{adjbox}{precode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@addcode{#1}{}%
}
-\def\adjbox@vcenter{%
- \leavevmode
- \hbox{%
- $\vcenter{\hbox{\BOXCONTENT}}\m@th$
- }%
+\define@key{adjbox}{Precode}{%
+ \adjust@addcode{#1}{}%
}
-\def\adjbox@valign@b{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}%
+\define@key{adjbox}{appcode}{%
+ \toks@\expandafter{\the\toks@#1}%
}
-\def\adjbox@valign@B{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}%
+\long\def\adjust@addcode#1#2{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
+}%
+\define@key\adjbox@fam{env}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@addenv
+ }{%
+ \adjbox@addenv{#1}\@nnil%
+ \remove@to@nnil
+ }#1\@nnil
}
+\def\adjbox@addenv#1#2\@nnil{%
+ \def\@tempa{\begin{#1}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
+}%
\define@key\adjbox@fam{bgcolor}{%
\adjbox@checkcolor
\@ifnextchar\bgroup{%
@@ -647,121 +686,53 @@
\BOXCONTENT
}%
}%
-\define@key\adjbox@fam{set height}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
-}
-\define@key\adjbox@fam{set depth}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
-}
-\define@key\adjbox@fam{set vsize}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
-}
-\def\adjbox@Gin@add#1{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
-}
-\def\adjbox@Gin@Add{%
- \Gin@esetsize
- \@tempswatrue
- \adjbox@Gin@add
-}
-\def\adjbox@Gin@sizeadd#1#2#3\relax{%
- \ifx\@nnil#3\@nnil
- \adjbox@Gin@add{#1{#2}{#2}}%
- \else
- \adjbox@Gin@add{#1{#2}{#3}}%
- \fi
-}
-\def\adjbox@halign#1#2#3{%
- \Gin@esetsize
- \@tempswatrue
- \adjsetlength\@tempdima{#1}%
- \edef\@tempa{\hb@xt@\the\@tempdima}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
-}
-\define@key\adjbox@fam{center}[\linewidth]{%
- \adjbox@halign{#1}\hss\hss
-}
-\define@key\adjbox@fam{left}[\linewidth]{%
- \adjbox@halign{#1}\relax\hss
+\newcommand*\bgimagebox[2][]{%
+ \collectboxcheckenv{bgimagebox}%
+ \@collectbox{\@bgimagebox{#1}{#2}}%
}
-\define@key\adjbox@fam{right}[\linewidth]{%
- \adjbox@halign{#1}\hss\relax
+\def\@bgimagebox#1#2{%
+ \mbox{%
+ \lower\depth\hbox{%
+ \edef\@tempa{\noexpand\adjustimage
+ {#1,width=\the\width,totalheight=\the\totalheight}%
+ {#2}%
+ }%
+ \@tempa
+ }%
+ \hskip-\width%
+ \BOXCONTENT
+ }%
}
-\define@key\adjbox@fam{outer}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\hss\relax}%
- {\@tempa\relax\hss}%
- \else
- \@tempa\hss\hss
- \fi
+\define@key{adjbox}{bgimage}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@bgimage
+ }{%
+ \adjbox@bgimage{}{#1}%
+ }#1\@nnil
}
-\define@key\adjbox@fam{inner}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\relax\hss}%
- {\@tempa\hss\relax}%
- \else
- \@tempa\hss\hss
- \fi
+\def\adjbox@bgimage#1#2#3\@nnil{%
+ \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
}
-\def\adjbox@ifoddpage{%
- \begingroup
- \adjbox@checkoddpage
- \expandafter\endgroup
- \ifoddpage
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi
+\define@key\adjbox@fam{lap}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@lapbox
+ }{%
+ \adjbox@lapbox{#1}{}%
+ }#1{}{}\@nnil
}
-\def\adjbox@checkoddpage{%
- \ifodd\c@page
- \oddpagetrue
+\def\adjbox@lapbox#1#2#3\@nnil{%
+ \ifx\@nnil#2\@nnil
+ \adjbox@Gin@Add{\lapbox{#1}}%
\else
- \oddpagefalse
+ \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
\fi
-}%
-\newif\ifoddpage
-\AtBeginDocument{%
- \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
- {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
-}%
-\define@key\adjbox@fam{min width}{%
- \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
-}
-\define@key\adjbox@fam{max width}{%
- \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
-}
-\define@key\adjbox@fam{min height}{%
- \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
-}
-\define@key\adjbox@fam{max height}{%
- \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
-}
-\define@key\adjbox@fam{min totalheight}{%
- \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
-}
-\define@key\adjbox@fam{max totalheight}{%
- \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
-}
-\define@key\adjbox@fam{min size}{%
- \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
-}
-\define@key\adjbox@fam{max size}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
}
-\define@key\adjbox@fam{min totalsize}{%
- \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+\define@key\adjbox@fam{rlap}[]{%
+ \adjbox@Gin@Add{\lapbox{\width}}%
}
-\define@key\adjbox@fam{max totalsize}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+\define@key\adjbox@fam{llap}[]{%
+ \adjbox@Gin@Add{\lapbox{-\width}}%
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\lapbox[2][\width-\@tempdimb]{%
\collectboxcheckenv{lapbox}%
\@collectbox{\@lapbox{#1}{#2}}%
@@ -784,59 +755,6 @@
\hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
\fi
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\marginbox{%
- \collectboxcheckenv{marginbox}%
- \@ifstar
- \marginbox@s
- \marginbox@
-}
-\def\marginbox@#1{%
- \@collectbox{\marginbox@@{#1}}%
-}
-\def\marginbox@s#1{%
- \@collectbox{\marginbox@@s{#1}}%
-}
-\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
- \@collectboxisenv{marginbox*}%
- \marginbox@s
-}
-\def\marginbox@@#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\def\marginbox@@s#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \raise\adjbox@tlly\copy\collectedbox
-}
-\def\@marginbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip\@tempdima
- \adjsetlength\@tempdima{\dp#5 + #2}%
- \adjsetlength\@tempdimb{\wd#5 + #3}%
- \adjsetlength\@tempdimc{\ht#5 + #4}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \box#5%
- }%
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define@key{ADJBOX}{minipage}{%
\adjbox@page{minipage}{#1}%
}
@@ -866,35 +784,45 @@
\let\setlength\adjbox@origsetlength
}
\newcommand*\stackbox[1][c]{%
- \collectboxcheckenv{stackbox}%
- \@testopt{\@stackbox{#1}}{b}%
+ \collectboxcheckenv{stackbox}%
+ \@ifnextchar[%]
+ {\@stackbox{#1}}%
+ {\@@stackbox{#1}{b}[]}%
}
\def\@stackbox#1[#2]{%
+ \@testopt{\@@stackbox{#1}{#2}}{}%
+}
+\def\@@stackbox#1#2[#3]{%
\collectbox@
- {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}
+ {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3}
\BOXCONTENT
{\end{varwidth}}%
}
-\define@key{ADJBOX}{stack}[{}{}]{%
- \adjbox@stack#1{}{}\@nnil
+\def\adjbox@halign@c{\centering}
+\def\adjbox@halign@l{\raggedright}
+\def\adjbox@halign@r{\raggedleft}
+\def\adjbox@halign@j{\let\\\newline}
+\define@key{ADJBOX}{stack}[{}{}{}]{%
+ \adjbox@stack#1{}{}{}\@nnil
}
-\def\adjbox@stack#1#2#3\@nnil{%
+\def\adjbox@stack#1#2#3#4\@nnil{%
\ifx\@nnil#1\@nnil
- \adjbox@@stack{c}{b}%
+ \adjbox@@stack{c}{b}{}%
\else
\ifx\@nnil#2\@nnil
- \adjbox@@stack{#1}{b}%
+ \adjbox@@stack{#1}{b}{}%
\else
- \adjbox@@stack{#1}{#2}%
+ \adjbox@@stack{#1}{#2}{#3}%
\fi\fi
}
-\def\adjbox@@stack#1#2{%
- \def\adjbox@collectbox##1{\collectbox@{\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}{##1}{\end{varwidth}}}%
+\def\adjbox@@stack#1#2#3{%
+ \def\adjbox@collectbox##1{%
+ \collectbox@{%
+ \begin{varwidth}[#2]{\linewidth}%
+ \csname adjbox@halign@#1\endcsname#3%
+ }{##1}{\end{varwidth}}%
+ }%
}
-\def\adjbox@halign@c{\centering}
-\def\adjbox@halign@l{\raggedright}
-\def\adjbox@halign@r{\raggedleft}
-\def\adjbox@halign@j{\let\\\newline}
\IfFileExists{varwidth.sty}
{\RequirePackage{varwidth}}{%
\define@key{ADJBOX}{varwidth}{%
@@ -963,75 +891,135 @@
\def\adjbox@innercode#1#2{%
\def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}%
}%
-\define@key{ADJBOX}{env}{%
+\define@key\adjbox@fam{label}{%
+ \def\adjbox@label{\label{#1}}%
+}
+\let\adjbox@label\@empty
+\define@key\adjbox@fam{caption}{%
+ \@ifnextchar{[}{%
+ \adjbox@def@caption
+ }{%
+ \adjbox@def@@caption
+ }#1\@nnil
+}
+\def\adjbox@def@@caption#1\@nnil{%
+ \def\adjbox@caption{\caption{#1}}%
+}
+\def\adjbox@def@caption[#1]#2\@nnil{%
+ \def\adjbox@caption{\caption[#1]{#2}}%
+}
+\let\adjbox@caption\@empty
+\define@key\adjbox@fam{figure}[]{%
+ \Gin@esetsize
+ \@tempswafalse
+ \let\adjustbox@noindent\relax
+ \ifx\@nnil#1\@nnil
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{}%
+ \else
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{[#1]}%
+ \fi
+}
+\def\adjbox@figure#1#2{%
+ \def\@tempa{\begin{figure}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@#1\end{figure}}%
+}
+\define@key\adjbox@fam{float}{%
+ \let\adjustbox@noindent\relax
\@ifnextchar\bgroup{%
- \adjbox@addenv
+ \adjbox@float
}{%
- \adjbox@addenv{#1}\@nnil%
+ \adjbox@float{#1}\@nnil
\remove@to@nnil
}#1\@nnil
}
-\def\adjbox@addenv#1#2\@nnil{%
- \def\@tempa{\begin{#1}#2}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
-}%
-\define@key{adjbox}{Addcode}{%
- \adjust@@addcode#1{}\@nnil%
+\def\adjbox@float{%
+ \expandafter\expandafter
+ \expandafter\adjbox@@float\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}%
}
-\define@key{adjbox}{addcode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@@addcode#1{}\@nnil%
+\def\adjbox@@float#1#2#3\@nnil{%
+ \adjust@addcode{\begin{#2}#3}{#1\end{#2}}%
}
-\def\adjust@@addcode#1#2#3\@nnil{%
- \ifx\@nnil#3\@nnil
- \adjust@addcode{#1}{#2}%
+\define@key\adjbox@fam{nofloat}[figure]{%
+ \def\@tempa{\adjust@addcode{\adjnofloat{#1}}}%
+ \expandafter\expandafter\expandafter
+ \@tempa\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label\endadjnofloat}%
+}
+\newenvironment{adjnofloat}[1]{%
+ \trivlist
+ \def\@captype{#1}%
+ \item\relax
+ \leavevmode
+}{%
+ \endtrivlist
+}
+\define@key\adjbox@fam{phantom}[]{%
+ \expandafter\ifx\csname #1phantom\endcsname\relax
+ \adjust@addcode{\phantom}{}%
\else
- \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
+ \expandafter\adjust@addcode\expandafter{\csname #1phantom\endcsname}{}%
\fi
}
-\define@key{adjbox}{precode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@addcode{#1}{}%
+\newcommand*\phantombox[3]{%
+ \begingroup
+ \adjsetlength\@tempdima{#1}%
+ \adjsetlength\@tempdimb{#2}%
+ \adjsetlength\@tempdimc{#3}%
+ \setbox\collectedbox\hbox{}%
+ \wd\collectedbox\@tempdima
+ \ht\collectedbox\@tempdimb
+ \dp\collectedbox\@tempdimc
+ \leavevmode
+ \box\collectedbox
+ \endgroup
}
-\define@key{adjbox}{Precode}{%
- \adjust@addcode{#1}{}%
+\define@key\adjbox@fam{gobble}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
}
-\define@key{adjbox}{appcode}{%
- \toks@\expandafter{\the\toks@#1}%
+\define@key\adjbox@fam{discard}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
}
-\def\adjust@addcode#1#2{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
-}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\bgimagebox[2][]{%
- \collectboxcheckenv{bgimagebox}%
- \@collectbox{\@bgimagebox{#1}{#2}}%
+\define@key\adjbox@fam{content}{%
+ \adjbox@Gin@Add{\@collectbox{#1}}%
}
-\def\@bgimagebox#1#2{%
- \mbox{%
- \lower\depth\hbox{%
- \edef\@tempa{\noexpand\adjustimage
- {#1,width=\the\width,totalheight=\the\totalheight}%
- {#2}%
- }%
- \@tempa
- }%
- \hskip-\width%
- \BOXCONTENT
- }%
+\define@key\adjbox@fam{gstore}{%
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{\BOXCONTENT}}%
}
-\define@key{adjbox}{bgimage}{%
- \@ifnextchar\bgroup{%
- \adjbox@bgimage
- }{%
- \adjbox@bgimage{}{#1}%
- }#1\@nnil
+\define@key\adjbox@fam{gstore*}{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{}}%
}
-\def\adjbox@bgimage#1#2#3\@nnil{%
- \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
+\define@key{adjbox}{gstore width}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\width\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore depth}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\depth\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore height}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\height\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore totalheight}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\totalheight\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore sizes}{%
+ \adjbox@Gin@Add{\@collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
+}
+\def\adjbox@gstore@sizes#1#2#3#4#5\@nnil{%
+ \ifx\relax#1\relax\else
+ \global#1=\width
+ \fi
+ \ifx\relax#2\relax\else
+ \global#2=\height
+ \fi
+ \ifx\relax#3\relax\else
+ \global#3=\depth
+ \fi
+ \ifx\relax#4\relax\else
+ \global#4=\totalheight
+ \fi
}
%%\RequirePackage{storebox}
\newcommand\splitbox[2]{%
@@ -1064,28 +1052,28 @@
\ifdim\Gin@nat@height>\totalheight
\Gin@nat@height\totalheight
\fi
- \adjbox@tllx\z@
- \adjbox@tlly\totalheight
- \adjbox@turx\width
- \adjbox@tury\z@
- \advance\adjbox@tlly-\Gin@nat@height
+ \tc@llx\z@
+ \tc@lly\totalheight
+ \tc@urx\width
+ \tc@ury\z@
+ \advance\tc@lly-\Gin@nat@height
\@@splitbox
}
\def\@@splitbox{%
- \advance\adjbox@turx-\@tempdima
+ \advance\tc@urx-\@tempdima
\@@@splitbox
- \ifdim\adjbox@turx>\z@
- \advance\adjbox@tllx+\@tempdima
+ \ifdim\tc@urx>\z@
+ \advance\tc@llx+\@tempdima
\expandafter\@@splitbox
\else
- \ifdim\adjbox@tlly<\splitbox@epsilon
+ \ifdim\tc@lly<\splitbox@epsilon
\splitboxlastnewline
\else
\splitboxnewline
- \adjbox@tllx\z@
- \adjbox@turx\width
- \advance\adjbox@tlly-\Gin@nat@height
- \advance\adjbox@tury+\Gin@nat@height
+ \tc@llx\z@
+ \tc@urx\width
+ \advance\tc@lly-\Gin@nat@height
+ \advance\tc@ury+\Gin@nat@height
\expandafter\expandafter
\expandafter\@@splitbox
\fi
@@ -1094,14 +1082,14 @@
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
@@ -1123,32 +1111,32 @@
\storebox\splittedbox{\BOXCONTENT}%
\setbox\collectedbox\hbox{\usestorebox\splittedbox}%
\fi
- \adjsetlength\adjbox@tlly
+ \adjsetlength\tc@lly
{\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}%
- \ifdim\adjbox@tlly>\z@
+ \ifdim\tc@lly>\z@
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\z@\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\z@
\BOXCONTENT
\endgroup
\par\noindent
- \adjsetlength\adjbox@tury{\totalheight-\adjbox@tlly}%
- \ifdim\adjbox@tlly>\textheight
+ \adjsetlength\tc@ury{\totalheight-\tc@lly}%
+ \ifdim\tc@lly>\textheight
\loop
- \advance\adjbox@tlly-\textheight
+ \advance\tc@lly-\textheight
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\tc@ury
\BOXCONTENT
\endgroup
- \advance\adjbox@tury\textheight
+ \advance\tc@ury\textheight
\par\noindent
- \ifdim\adjbox@tlly>\textheight
+ \ifdim\tc@lly>\textheight
\repeat
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\BOXCONTENT
\else
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\par\noindent
\BOXCONTENT
\fi
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def b/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def
deleted file mode 100644
index ea614a56f20..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def
+++ /dev/null
@@ -1,46 +0,0 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
-%% 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://www.latex-project.org/lppl.txt
-%% 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 Martin Scharrer.
-%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
-%%
-\ProvidesFile{adjpdftex.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for pdftex]
-\def\@cliptoboxdim#1{%
- \setbox#1=\hbox{%
- \Gin@defaultbp\WIDTH{\wd#1}%
- \Gin@defaultbp\DEPTH{\dp#1}%
- \@tempdima\ht#1%
- \advance\@tempdima\dp#1%
- \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
- \special{pdf:content q }%
- \special{%
- pdf:literal direct
- 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
- }%
- \special{pdf:literal direct W }%
- \special{pdf:literal direct n }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \special{pdf:content q }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \box#1%
- \special{pdf:literal direct Q }%
- \special{pdf:literal direct Q }%
- }%
-}
-\endinput
-%%
-%% End of file `adjxetex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
index 006ef5fe50a..b643bf5bd1b 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
@@ -1,5 +1,5 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% 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.
@@ -12,13 +12,12 @@
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
%%
-\ProvidesFile{adjdvips.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for dvips]
+\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips]
\def\@cliptoboxdim#1{%
\setbox#1=\hbox{%
\adjsetlength\@tempdima{\ht#1+\dp#1}%
@@ -43,4 +42,4 @@
}
\endinput
%%
-%% End of file `adjdvips.def'.
+%% End of file `tc-dvips.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def b/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
new file mode 100644
index 00000000000..e18f0909122
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
@@ -0,0 +1,39 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesFile{tc-pdftex.def}[2012/05/13 v1.0 Clipping driver for pdftex]
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \pdfsave
+ \pdfliteral direct {%
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
+ }%
+ \hbox to 0pt{\copy#1\hss}%
+ \pdfrestore
+ \hskip \wd#1
+ }%
+}
+\endinput
+%%
+%% End of file `tc-pdftex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
index 122cc0071c7..0b32c59cffd 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
@@ -1,5 +1,5 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% 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.
@@ -12,13 +12,12 @@
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
%%
-\ProvidesFile{adjpgf.def}[%
- 2011/11/14
- v0.8
- adjustbox fall-back clip driver using PGF]
+\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF]
\RequirePackage{pgf}
\def\@cliptoboxdim#1{%
\setbox#1\hbox{\begin{pgfpicture}%
@@ -35,4 +34,4 @@
}
\endinput
%%
-%% End of file `adjpgf.def'.
+%% End of file `tc-pgf.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def b/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
new file mode 100644
index 00000000000..2aa3dc0c21e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
@@ -0,0 +1,41 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesFile{tc-xetex.def}[2012/05/13 v1.0 Clipping driver for xetex]
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \special{pdf:bcontent }%
+ \special{%
+ pdf:literal direct
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
+ }%
+ \special{pdf:literal direct W }%
+ \special{pdf:literal direct n }%
+ \box#1%
+ \special{pdf:econtent }%
+ }%
+}
+\endinput
+%%
+%% End of file `tc-xetex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty
new file mode 100644
index 00000000000..d0dcb815ac8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty
@@ -0,0 +1,260 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% 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://www.latex-project.org/lppl.txt
+%% 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 Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesPackage{trimclip}[%
+ 2012/05/16
+ v1.0
+ Trim and clip general TeX material]
+\def\tc@driver{tc-\Gin@driver}
+\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
+\DeclareOption{pdftex}{\def\tc@driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
+\DeclareOption{xetex}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvips}{\def\tc@driver{tc-dvips.def}\PassOptionsToPackage{dvips}{graphicx}}
+\DeclareOption{dvipdfm}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvipdf}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption*{%
+ \@ifpackageloaded{graphics}{%
+ \edef\tc@driver{tc-\CurrentOption.def}%
+ \begingroup
+ \edef\@tempa{\CurrentOption.def}%
+ \ifx\@tempa\Gin@driver\else
+ \let\on@line\@gobble
+ \PackageWarning{trimclip}{%
+ A different clipping driver was requested than the\MessageBreak
+ one used for 'graphics/x'! This is not recommended\MessageBreak
+ and can lead to defect output files.%
+ }%
+ \fi
+ \endgroup
+ }{%
+ \def\tc@driver{tc-\Gin@driver}%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
+\ProcessOptions*\relax
+\RequirePackage{graphicx}[1999/02/16]
+\RequirePackage{collectbox}[2011/08/22]
+\RequirePackage{adjcalc}
+\def\tc@readvalues#1{%
+ \tc@@readvalues#1 {} {} {} \\%
+}
+\def\tc@@readvalues#1 #2 #3 #4 #5\\{%
+ \adjsetlengthdefault\tc@llx{#1}%
+ \ifx\@nnil#2\@nnil
+ \tc@lly\tc@llx
+ \tc@urx\tc@llx
+ \tc@ury\tc@llx
+ \else
+ \adjsetlengthdefault\tc@lly{#2}%
+ \ifx\@nnil#3\@nnil
+ \tc@urx\tc@llx
+ \tc@ury\tc@lly
+ \else
+ \adjsetlengthdefault\tc@urx{#3}%
+ \adjsetlengthdefault\tc@ury{#4}%
+ \fi
+ \fi
+}%
+\newdimen\tc@llx
+\newdimen\tc@lly
+\newdimen\tc@urx
+\newdimen\tc@ury
+\newcommand\trimbox{%
+ \collectboxcheckenv{trimbox}%
+ \@ifstar
+ \trimbox@s
+ \trimbox@
+}
+\def\trimbox@#1{%
+ \collectbox{\@trimclip\@trimbox{#1}}%
+}
+\def\trimbox@s#1{%
+ \collectbox{\@trimclip\@viewportbox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
+ \@collectboxisenv{trimbox*}%
+ \trimbox@s
+}
+\newcommand\clipbox{%
+ \collectboxcheckenv{clipbox}%
+ \@ifstar
+ \clipbox@s
+ \clipbox@
+}
+\def\clipbox@#1{%
+ \collectbox{\@trimclip\@clipbox{#1}}%
+}
+\def\clipbox@s#1{%
+ \collectbox{\@trimclip\@clipvpbox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
+ \@collectboxisenv{clipbox*}%
+ \clipbox@s
+}
+\newcommand\marginbox{%
+ \collectboxcheckenv{marginbox}%
+ \@ifstar
+ \marginbox@s
+ \marginbox@
+}
+\def\marginbox@#1{%
+ \@collectbox{\@trimclip\@marginbox{#1}}%
+}
+\def\marginbox@s#1{%
+ \@collectbox{\@trimclip\@marginraisebox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
+ \@collectboxisenv{marginbox*}%
+ \marginbox@s
+}
+\def\@trimclip#1#2{%
+ \tc@readvalues{#2}%
+ #1%
+ \collectedbox
+ \tc@llx
+ \tc@lly
+ \tc@urx
+ \tc@ury
+ \usebox\collectedbox
+}
+\def\tc@correctbaseline#1{%
+ \ifdim\dp#1<\z@
+ \raise\dp#1%
+ \else
+ \ifdim\ht#1<\z@
+ \lower\ht#1%
+ \fi\fi
+ \box#1%
+}%
+\def\tc@correctdims#1{%
+ \ifdim\dp#1<\z@ \dp#1=\z@ \fi
+ \ifdim\wd#1<\z@ \wd#1=\z@ \fi
+ \ifdim\ht#1<\z@ \ht#1=\z@ \fi
+}
+\def\@trimbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly-\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx-\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury-\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1-\tc@urx
+ \ht#1-\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@marginbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \dp#1\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@marginraisebox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ % Copy original tty values (ury is taken as temp dimension)
+ \tc@ury=\tc@lly
+ \advance\tc@lly\dp#1%
+ \dp#1\tc@lly
+ % Raise bu original tty value (now in ury)
+ \raise\tc@ury\box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@viewportbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ % Assign values
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \tc@ury=#5\relax
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@clipbox#1#2#3#4#5{%
+ \@trimbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+\def\@clipvpbox#1#2#3#4#5{%
+ \@viewportbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+\InputIfFileExists{\tc@driver}{%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{Using driver '\tc@driver'.}}%
+}{%
+ \input{tc-pgf.def}%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{No clipping driver '\tc@driver' available.\MessageBreak Using fall-back PGF driver.}}%
+}
+\endinput
+%%
+%% End of file `trimclip.sty'.