summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/adjustbox
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-21 23:56:59 +0000
committerKarl Berry <karl@freefriends.org>2012-05-21 23:56:59 +0000
commit86a77f5dd3bc8913d175cc79d962377eaa68eb7d (patch)
tree4c6a0f3d99b4df31472ec043ebc4180437285030 /Master/texmf-dist/source/latex/adjustbox
parent902beccca919c220f5d4a9f8edcca098aa7d07fa (diff)
adjustbox (21may12)
git-svn-id: svn://tug.org/texlive/trunk@26555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/adjustbox')
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx852
-rw-r--r--Master/texmf-dist/source/latex/adjustbox/trimclip.dtx2
2 files changed, 644 insertions, 210 deletions
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
index 5c5eb67e5c7..91d9cbfbd7e 100644
--- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
+++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
@@ -26,10 +26,10 @@
%<*driver>
\ProvidesFile{adjustbox.dtx}[%
%<=*DATE>
- 2012/05/16
+ 2012/05/21
%<=/DATE>
%<=*VERSION>
- v0.9
+ v1.0
%<=/VERSION>
DTX file for the adjustbox package]
\documentclass[a4paper]{ydoc}[2011/08/11]
@@ -55,7 +55,8 @@
}{%
\par
}
-\optionaloff
+\global\optionaloff
+\let\optionalon\relax
\lstdefinelanguage{none}{}%
\lstdefinelanguage{adjustbox}{%
@@ -146,7 +147,7 @@
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ^^A Title page (((
-% \CheckSum{0}
+% \CheckSum{2141}
%
% \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
@@ -194,7 +195,44 @@
% Added check for \pkg{xcolor} package.
% }
% \changes{v0.9}{2012/05/16}{
-%
+% Basic trim and clip macros and driver files are now placed in a dedicated minimal package 'trimclip'.
+% Special thanks goes to Joseph Wright (LaTeX3 project) for his work on the driver files.
+% Clipping drivers are provided for 'pdftex' (incl. LuaTeX), 'dvips' and 'xetex' as well as a PGF fall-back
+% driver.
+% Packages: New dedicated 'trimclip' package with own manual.
+% Better separation between 'adjcalc' and 'adjustbox' package.
+% Review of manuals
+% New adjustbox keys:
+% * content
+% * gstore
+% * gstore*
+% * gstore width/height/depth/totalheight/sizes
+% * gobble/discard
+% * phantom
+% * warn width
+% * float
+% * nofloat
+% * figure
+% * label
+% * caption
+% * vspace
+% * vspace*
+% * padding (alias of 'margin')
+% * padding* (alias of 'margin*')
+% Fixes: env key now works correctly; Fixed raise box code.
+% Macro changes: Added third optional argument to \stackbox.
+% }
+% \changes{v1.0}{2012/05/21}{%^^A
+% * Updated manual to contain all new keys and macro.
+% * Code optimisations.
+% * Improvements of (re-)boxing code.
+% * Added user-level macros to define keys.
+% * Changed horizontal alignment keys to box the content and added matching macros.
+% * Changed horizontal inner/outer side keys to use 'ifodd' package and added matching macros.
+% * Added missing \cs{leavevmode} for "raise" key.
+% * Simplified code for "valign" key. Fixed spurious space for "valign=v".
+% * Fixed min/max size keys to double a single value correctly.
+% * Code cleanup with "warn width" key.
% }
%
% \GetFileInfo{adjustbox.dtx}
@@ -240,13 +278,14 @@
%
% ^^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.
+% 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.
+% The \pkg{ifoddpage} package is automatically loaded if installed, otherwise the \Key{outer} and \Key{inner} keys are
+% disables as well as \Macro\outersidebox and \Macro\innersidebox macros and corresponding environments.
+% 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
@@ -307,7 +346,7 @@
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \section{Main macros}^^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.
@@ -443,6 +482,7 @@
% \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).
@@ -635,6 +675,26 @@
% \end{examples}
%
%
+% \DescribeKey{warn width}
+% \DescribeKey{warn width}=<max width>
+% If this key is used the current width of the content is measured and compared with the given maximum width (default is
+% \Macro\linewidth).
+% If the content is wider than this value by more than the \TeX\ length \Macro\hfuzz\relax (by default 0.1pt)
+% an \emph{Overfull hbox} warning is produced.
+% The warning will include the source code position and the information that it was an |adjustbox| not a normal
+% paragraph:
+% \par\smallskip\par
+% {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at line N}
+%
+% {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at lines N-M}
+% \par\smallskip\par\noindent
+% Note that this key is not able to take any horizontal space before the |adjustbox|
+% into account. This includes a paragraph indention which might be present with \Macro\adjustbox.
+%
+% This key is useful to be used before the horizontal alignment keys which change the official width of the content
+% and prevent the normal \emph{Overfull} warnings to take affect.
+%
+%
% ^^A )))2
% \Needspace*{8\baselineskip}
% \subsection{Scaling} ^^A (((2
@@ -937,7 +997,7 @@
% places the content in a box with the given width (by default \Macro\linewidth) but aligns it towards the inner margin.
% If the content is wider than the available width it will stick into the outer margin without causing an overfull hbox warning.
% In |twoside| mode this key is equal to \Key{left} for odd pages and equal to \Key{right} for even pages.
-% For |oneside| mode it is always equal to \Key{center}, because there is no inner or outer margin.
+% For |oneside| mode it is equal to \Key{left}.
% Note that the page-is-odd test might not always lead to correct results for some material close to a page boundary, because \TeX\
% might not have decided on which page it will be placed. This can be improved by loading the \pkg{changepage} package with the
% \opt{strict} option, which uses a reference to determine the correct page number (and requires the usual additional compiler run).
@@ -946,9 +1006,26 @@
% \DescribeKey{outer}
% \DescribeKey{outer}'='<width>
% Identical to \Key{inner} but aligns the content towards the outer margin.
+% For |oneside| mode it is equal to \Key{right}.
% If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning.
%
%
+% \DescribeMacro\innersidebox[<width>]{<content>}
+% \vspace{-1.5\baselineskip}
+% \DescribeEnv[<content>]{innersidebox}[<width>]
+% Macro and environment version of the \Key{inner} key. The optional width argument defaults to \Macro\linewidth.
+% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
+% placing a |\mbox{}| or the identical |\null| macro before it.
+%
+%
+% \DescribeMacro\outersidebox[<width>]{<content>}
+% \vspace{-1.5\baselineskip}
+% \DescribeEnv[<content>]{outersidebox}[<width>]
+% Macro and environment version of the \Key{outer} key. The optional width argument defaults to \Macro\linewidth.
+% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
+% placing a |\mbox{}| or the identical |\null| macro before it.
+%
+%
% \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.
@@ -1268,6 +1345,66 @@
% \end{example}
%
% ^^A )))2
+% \subsection{Floats and non-float replacements} ^^A (((2
+% The following keys can be used to turn an adjusted box into a float or a non-floating replacement which also allows
+% for a caption. These keys must be used last and no other normal keys must be used afterwards, otherwise an error will
+% occur because the added floating environment is boxed again.
+%
+%
+% \DescribeKey{caption}=<caption text>
+% \DescribeKey{caption}=[<short caption>]{<long caption>}
+% Defines a caption which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
+% The position of the caption defaults to top for a |table| (non-)float and bottom for every other type.
+%
+% \DescribeKey{captionabove}=<caption text>
+% \DescribeKey{captionabove}=[<short caption>]{<long caption>}
+% Like the \Key{caption} key but forces the placement of the caption above the content.
+% The vertical skip above and below a normal below caption are reversed in this case to get proper
+% spacing. However, this is not done if the \pkg{caption} package is loaded.
+% It is recommended to load this package with the |tableposition=above| option.
+%
+%
+% \DescribeKey{captionbelow}=<caption text>
+% \DescribeKey{captionbelow}=[<short caption>]{<long caption>}
+% Like the \Key{caption} key but forces the placement of the caption below the content.
+%
+%
+% \DescribeKey{label}=<label>
+% Defines a label which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
+%
+%
+% \DescribeKey{figure}
+% \DescribeKey{figure}=<placement>
+% Turns the adjusted box into a \env{figure}.
+% A previously used \Key{caption} and \Key{label} will be added.
+% This is a specialised version of \Key{float}={figure}.
+%
+%
+% \DescribeKey{float}=<float type>
+% \DescribeKey{float}={<float type>}[<position>]
+% Turns the adjusted box into a float of the given type, i.e.\ |figure|, |table| or any other custom defined float.
+% A previously used \Key{caption} and \Key{label} will be added.
+%
+%
+% \DescribeKey{nofloat}=<float type>
+% This will add a non-floating replacement of the given float type (|figure|, |table|, etc.).
+% The will place the content always at the current
+% position which can lead to bad page-breaking. A caption will be in the same format as for real floats of the same
+% type.
+% A previously used \Key{caption} and \Key{label} will be added.
+%
+%
+% \DescribeEnv[<content>]{adjnofloat}{<float type>}
+% This environment is used internally by \Key{nofloat} to create a non-floating replacement of the given float type
+% (|figure|, |table|, etc.). It can also be used directly with other code or be redefined to change the
+% behavior of \Key{nofloat}.
+% Any redefinition should include |\def\@captype{#1}| to set the caption type.
+% The environment will be used in plain form, i.e.\ \Macro\adjnofloat\ldots\Macro\endadjnofloat, so
+% if a group is required in a redefinition it should be added manually using \Macro\begingroup and \Macro\endgroup.
+%
+%
+%
+% ^^A )))2
% \Needspace*{8\baselineskip}
% \subsection{Adding own Code or Environments} ^^A (((2
% \vspace{-\baselineskip}
@@ -1407,10 +1544,48 @@
% The key version of \Macro\pagebreakbox. There should no be any further keys used afterwards, because they will interfere with the page breaks.
%
%
-%
% ^^A )))2
-% \StopEventually{}
+% ^^A )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Defining own Keys} ^^A (((
+% The following macros can be used to define own keys or redefine existing ones.
+%
+% \DescribeMacro\newadjustboxkey{<key>}[<default value>]{<code>}
+% \DescribeMacro\newadjustboxkey*{<key>}[<default value>]{<code>}
+% Defines the new \env{adjustbox} key with the given default value if no value is provided.
+% The value can be accessed inside the code as |#1|
+% Without a default value an error is raised if the value is missing.
+% An error is raised if the key is already defined.
+%
+% The normal form will add the code to the internal token register just before the previous content which is
+% wrapped inside braces: \MacroArgs<code>{<previous content>}. Subsequent keys will receive this as content.
+% The code can therefore read the content as macro argument. If the dimension of the content need to be accessed
+% it should be boxed first using \Macro\collectbox{<code>}. Then the dimension are available using the usual
+% macros and the content can be typeset using \Macro\BOXCONTENT. See the \pkg{collectbox} for additional information.
+%
+% The starred form simply executes the given code in the internal group without changing the token register.
+% In this case the content is not directly accessible and all subsequent keys are not yet processed.
+% This form is useful to locally change settings for the current \Macro\adjustbox macro or \env{adjustbox} environment.
+%
+%
+% \DescribeMacro\renewadjustboxkey{<key>}[<default value>]{<code>}
+% \DescribeMacro\renewadjustboxkey*{<key>}[<default value>]{<code>}
+% Like \Macro\newadjustboxkey but will redefine an existing key.
+% An error is raised if the key is not already defined.
+%
+%
+% \DescribeMacro\provideadjustboxkey{<key>}[<default value>]{<code>}
+% \DescribeMacro\provideadjustboxkey*{<key>}[<default value>]{<code>}
+% Like \Macro\newadjustboxkey but will define the key only if it is not already defined.
+%
%
+% \DescribeMacro\defadjustboxkey{<key>}[<default value>]{<code>}
+% \DescribeMacro\defadjustboxkey*{<key>}[<default value>]{<code>}
+% Like \Macro\newadjustboxkey but will always define the key independent if it is already defined or not.
+%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \StopEventually{}
% \clearpage
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1491,7 +1666,14 @@
% \begin{macrocode}
\RequirePackage{trimclip}
\RequirePackage{graphicx}[1999/02/16]
-\RequirePackage{collectbox}[2012/05/13]
+\RequirePackage{collectbox}[2012/05/17]
+% \end{macrocode}
+%
+% Fall-back code for older \pkg{collectbox} versions:
+% \begin{macrocode}
+\@ifpackagelater{collectbox}{2012/05/17}{}{%
+ \let\@Collectbox\@collectbox
+}
% \end{macrocode}
%
% ^^A )))
@@ -1608,6 +1790,7 @@
\let\Depth\adjbox@Depth
\let\Totalheight\adjbox@Totalheight
\let\Gin@esetsize\adjbox@esetsize
+ \let\@collectbox\@Collectbox
\@tempswatrue
\toks@{{\adjustbox@content}}%
\def\setlength{\adjsetlength}%
@@ -1722,20 +1905,184 @@
% \end{macro}
%
%
-% \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}{\newadjustboxkey}
% \begin{macrocode}
-\def\adjbox@Gin@sizeadd#1#2#3\relax{%
- \ifx\@nnil#3\@nnil
- \adjbox@Gin@add{#1{#2}{#2}}%
+\newcommand\newadjustboxkey{%
+ \@adjustboxkey\adjustbox@newkey
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\renewadjustboxkey}
+% \begin{macrocode}
+\newcommand\renewadjustboxkey{%
+ \@adjustboxkey\adjustbox@renewkey
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\provideadjustboxkey}
+% \begin{macrocode}
+\newcommand\provideadjustboxkey{%
+ \@adjustboxkey\adjustbox@providekey
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\defadjustboxkey}
+% \begin{macrocode}
+\newcommand\defadjustboxkey{%
+ \@adjustboxkey\@secondoftwo
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adjustboxkey}
+% \begin{macrocode}
+\def\@adjustboxkey#1{%
+ \@ifstar
+ {\@adjustboxkey@i#1*}%
+ {\@adjustboxkey@i#1\relax}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adjustboxkey@i}
+% \begin{macrocode}
+\def\@adjustboxkey@i#1#2#3{%
+ \@ifnextchar{[}%
+ {\@adjustboxkey@ii#1#2{#3}}%
+ {\@adjustboxkey@ii#1#2{#3}[\@nnil]}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adjustboxkey@ii}
+% \begin{macrocode}
+\def\@adjustboxkey@ii#1#2#3[#4]#5{%
+ \ifx\@nnil#4\relax
+ \@adjustboxkey@iii#1#2{#3}{}{#5}%
+ \else
+ \@adjustboxkey@iii#1#2{#3}{[#4]}{#5}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adjustboxkey@iv}
+% \begin{macrocode}
+\def\@adjustboxkey@iii#1#2#3#4#5{%
+ #1{#3}{%
+ \ifx*#2\relax
+ \define@key\adjbox@fam{#3}#4{#5}%
\else
- \adjbox@Gin@add{#1{#2}{#3}}%
+ \define@key\adjbox@fam{#3}#4{%
+ \adjbox@Gin@Add{\@Collectbox{#5}}%
+ }%
\fi
+ }{}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\define@adjboxkey}
+% \begin{macrocode}
+\def\define@adjboxkey#1#2{%
+ \define@key\adjbox@fam{#1}{%
+ \adjbox@Gin@Add{#2}%
+ }%
}
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\define@adjboxkey@defvalue}
+% \begin{macrocode}
+\def\define@adjboxkey@defvalue#1#2#3{%
+ \define@key\adjbox@fam{#1}[{#2}]{%
+ \adjbox@Gin@Add{#3}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\define@adjboxkey@novalue}
+% \begin{macrocode}
+\def\define@adjboxkey@novalue#1#2{%
+ \define@key\adjbox@fam{#1}[\@nil]{%
+ \adjbox@novalue{##1}%
+ \adjbox@Gin@Add{#2}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjbox@novalue}
+% \begin{macrocode}
+\def\adjbox@novalue#1{%
+ \ifx\@nil#1\else
+ \PackageWarning{adjustbox}{%
+ Key '\XKV@tkey' does not await a value.\MessageBreak
+ Given value will be ignored%
+ }%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjustbox@newkey}
+% \begin{macrocode}
+\def\adjustbox@newkey#1#2{%
+ \@ifundefined{KV@\adjbox@fam @#1}{#2}{%
+ \PackageError{adjustbox}{Key '#1' already defined}{}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\adjustbox@renewkey}
+% \begin{macrocode}
+\def\adjustbox@renewkey#1{%
+ \@ifundefined{KV@\adjbox@fam @#1}{%
+ \PackageError{adjustbox}{Key '#1' undefined}{}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\adjustbox@providekey}
+% \begin{macrocode}
+\def\adjustbox@providekey#1#2{%
+ \@ifundefined{KV@\adjbox@fam @#1}{#2}{}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\adjbox@let@key}
+% Aliases one key to another.
+% \begin{macrocode}
+\def\adjbox@let@key#1#2#3{%
+ \expandafter\let\csname KV@#1@#2\expandafter\endcsname\csname KV@#1@#3\endcsname
+ \expandafter\let\csname KV@#1@#2@default\expandafter\endcsname\csname KV@#1@#3@default\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Keys for trimming, clipping, viewport and margin} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1760,9 +2107,7 @@
%
% \begin{key}{adjbox}{Viewport}
% \begin{macrocode}
-\define@key\adjbox@fam{Viewport}{%
- \adjbox@Gin@Add{\trimbox@s{#1}}%
-}
+\define@adjboxkey{Viewport}{\trimbox@s{#1}}%
% \end{macrocode}
% \end{key}
%
@@ -1786,62 +2131,48 @@
%
% \begin{key}{adjbox}{Trim}
% \begin{macrocode}
-\define@key\adjbox@fam{Trim}{%
- \adjbox@Gin@Add{\trimbox@{#1}}%
-}
+\define@adjboxkey{Trim}{\trimbox@{#1}}%
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Clip}
% \begin{macrocode}
-\define@key\adjbox@fam{Clip}{%
- \adjbox@Gin@Add{\clipbox@{#1}}%
-}
+\define@adjboxkey{Clip}{\clipbox@{#1}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{Clip*}
% \begin{macrocode}
-\define@key\adjbox@fam{Clip*}{%
- \adjbox@Gin@Add{\clipbox@s{#1}}%
-}
+\define@adjboxkey{Clip*}{\clipbox@s{#1}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{margin}
% \begin{macrocode}
-\define@key\adjbox@fam{margin}{%
- \adjbox@Gin@Add{\marginbox@{#1}}%
-}
+\define@adjboxkey{margin}{\marginbox@{#1}}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{margin*}
% \begin{macrocode}
-\define@key\adjbox@fam{margin*}{%
- \adjbox@Gin@Add{\marginbox@s{#1}}%
-}
+\define@adjboxkey{margin*}{\marginbox@s{#1}}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{padding}
% Alias for \Key{margin}.
% \begin{macrocode}
-\define@key\adjbox@fam{padding}{%
- \adjbox@Gin@Add{\marginbox@{#1}}%
-}
+\adjbox@let@key\adjbox@fam{padding}{margin}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{padding*}
% Alias for \Key{margin*}.
% \begin{macrocode}
-\define@key\adjbox@fam{padding*}{%
- \adjbox@Gin@Add{\marginbox@s{#1}}%
-}
+\adjbox@let@key\adjbox@fam{padding*}{margin*}
% \end{macrocode}
% \end{key}
%
@@ -1914,109 +2245,156 @@
% \subsection{Horizontal alignment keys} ^^A (((
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+%
% \begin{macro}{\adjbox@halign}
% \begin{macrocode}
\def\adjbox@halign#1#2#3{%
- \Gin@esetsize
- \@tempswatrue
+ \@collectbox{\@adjbox@halign{#1}{#2}{#3}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@adjbox@halign}
+% \begin{macrocode}
+\def\@adjbox@halign#1#2#3{%
+ \begingroup
\adjsetlength\@tempdima{#1}%
- \edef\@tempa{\leavevmode\hb@xt@\the\@tempdima}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
+ \leavevmode\hb@xt@\the\@tempdima{#2\BOXCONTENT#3}%
+ \endgroup
}
% \end{macrocode}
% \end{macro}
%
% \begin{key}{adjbox}{center}
% \begin{macrocode}
-\define@key\adjbox@fam{center}[\linewidth]{%
- \adjbox@halign{#1}\hss\hss
-}
+\define@adjboxkey@defvalue{center}{\linewidth}{\adjbox@halign{#1}\hss\hss}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{left}
% \begin{macrocode}
-\define@key\adjbox@fam{left}[\linewidth]{%
- \adjbox@halign{#1}\relax\hss
-}
+\define@adjboxkey@defvalue{left}{\linewidth}{\adjbox@halign{#1}\relax\hss}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{right}
% \begin{macrocode}
-\define@key\adjbox@fam{right}[\linewidth]{%
+\define@adjboxkey@defvalue{right}{\linewidth}{\adjbox@halign{#1}\hss\relax}
+% \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\centerbox}
+% \begin{macrocode}
+\newcommand\centerbox[1][\linewidth]{%
+ \adjustbox@noindent
+ \adjbox@halign{#1}\hss\hss
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\leftalignbox}
+% \begin{macrocode}
+\newcommand\leftalignbox[1][\linewidth]{%
+ \adjustbox@noindent
+ \adjbox@halign{#1}\relax\hss
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\rightalignbox}
+% \begin{macrocode}
+\newcommand\rightalignbox[1][\linewidth]{%
+ \adjustbox@noindent
\adjbox@halign{#1}\hss\relax
}
% \end{macrocode}
-% \end{key}
+% \end{macro}
+%
%
% \begin{key}{adjbox}{outer}
% \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
+\define@adjboxkey@defvalue{outer}{\linewidth}{%
+ \outersidebox[{#1}]%
}
% \end{macrocode}
% \end{key}
%
+%
% \begin{key}{adjbox}{inner}
% \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@adjboxkey@defvalue{inner}{\linewidth}{%
+ \innersidebox[{#1}]%
}
% \end{macrocode}
% \end{key}
%
-% \begin{macro}{\adjbox@ifoddpage}
+%
+% \begin{macro}{\outersidebox}
% \begin{macrocode}
-\def\adjbox@ifoddpage{%
- \begingroup
- \adjbox@checkoddpage
- \expandafter\endgroup
- \ifoddpage
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi
+\newcommand\outersidebox[1][\linewidth]{%
+ \collectboxcheckenv{outersidebox}%
+ \adjustbox@noindent
+ \adjbox@halign{#1}{%
+ \checkoddpage
+ \ifoddpageoroneside
+ \hss
+ \else
+ \relax
+ \fi
+ }{%
+ \ifoddpageoroneside
+ \relax
+ \else
+ \hss
+ \fi
+ }%
}
% \end{macrocode}
% \end{macro}
%
%
-% \begin{macro}{\adjbox@checkoddpage}
+% \begin{macro}{\innersidebox}
% \begin{macrocode}
-\def\adjbox@checkoddpage{%
- \ifodd\c@page
- \oddpagetrue
- \else
- \oddpagefalse
- \fi
-}%
+\newcommand\innersidebox[1][\linewidth]{%
+ \collectboxcheckenv{innersidebox}%
+ \adjustbox@noindent
+ \adjbox@halign{#1}{%
+ \checkoddpage
+ \ifoddpageoroneside
+ \relax
+ \else
+ \hss
+ \fi
+ }{%
+ \ifoddpageoroneside
+ \hss
+ \else
+ \relax
+ \fi
+ }%
+}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
-\newif\ifoddpage
-\AtBeginDocument{%
- \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
- {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
+\IfFileExists{ifoddpage.sty}{%
+ \RequirePackage{ifoddpage}%
+}{%
+ \renewcommand\outersidebox[1][]{%
+ \PackageError{adjustbox}{%
+ The 'outer' and 'inner' keys as well as the\MessageBreak
+ \string\outersidebox\space and \string\innersidebox\space macros\MessageBreak
+ require the 'ifoddpage' package, which is not\MessageBreak
+ installed}{}%
+ }%
+ \let\innersidebox\outersidebox
}%
% \end{macrocode}
%
-%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Vertical alignment keys} ^^A (((
@@ -2043,19 +2421,11 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{key}{adjbox}{valign}
-% \begin{macrocode}
-\define@key\adjbox@fam{valign}{%
- \csname adjbox@valign@#1\endcsname
-}
-% \end{macrocode}
-% \end{key}
-%
%
% \begin{macro}{\adjbox@raisebox}[3]{raise amount}{height}{depth}
% \begin{macrocode}
\def\adjbox@raisebox#1#2#3{%
- \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
+ \@collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
}
% \end{macrocode}
% \end{macro}
@@ -2078,12 +2448,21 @@
\adjsetlength\@tempdima{#3}%
\dp\@tempboxa\@tempdima
\fi
+ \leavevmode
\box\@tempboxa
}
% \end{macrocode}
% \end{macro}
%
%
+% \begin{key}{adjbox}{valign}
+% \begin{macrocode}
+\define@key\adjbox@fam{valign}{%
+ \expandafter\adjbox@Gin@Add\expandafter{\csname adjbox@valign@#1\endcsname}%
+}
+% \end{macrocode}
+% \end{key}
+%
%
% \begin{macro}{\adjboxvtop}
% \begin{macrocode}
@@ -2105,7 +2484,7 @@
% \begin{macro}{\adjbox@valign@t}
% \begin{macrocode}
\def\adjbox@valign@t{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}%
+ \adjbox@raisebox{-\height+\adjboxvtop}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2114,7 +2493,7 @@
% \begin{macro}{\adjbox@valign@T}
% \begin{macrocode}
\def\adjbox@valign@T{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}%
+ \adjbox@raisebox{-\height}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2123,7 +2502,7 @@
% \begin{macro}{\adjbox@valign@M}
% \begin{macrocode}
\def\adjbox@valign@M{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}%
+ \adjbox@raisebox{.5\depth-.5\height}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2132,7 +2511,7 @@
% \begin{macro}{\adjbox@valign@m}
% \begin{macrocode}
\def\adjbox@valign@m{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}%
+ \adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2140,13 +2519,10 @@
%
% \begin{macro}{\adjbox@valign@c}
% \begin{macrocode}
-\def\adjbox@valign@c{%
- \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}%
-}
-\def\adjbox@vcenter{%
+\def\adjbox@valign@c#1{%
\leavevmode
\hbox{%
- $\vcenter{\hbox{\BOXCONTENT}}\m@th$
+ $\vcenter{\hbox{#1}}\m@th$%
}%
}
% \end{macrocode}
@@ -2156,7 +2532,7 @@
% \begin{macro}{\adjbox@valign@b}
% \begin{macrocode}
\def\adjbox@valign@b{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}%
+ \adjbox@raisebox{\depth+\adjboxvbottom}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2165,7 +2541,7 @@
% \begin{macro}{\adjbox@valign@B}
% \begin{macrocode}
\def\adjbox@valign@B{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}%
+ \adjbox@raisebox{\depth}{}{}%
}
% \end{macrocode}
% \end{macro}
@@ -2178,18 +2554,14 @@
%
% \begin{key}{adjbox}{set height}
% \begin{macrocode}
-\define@key\adjbox@fam{set height}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
-}
+\define@adjboxkey{set height}{\adjbox@raisebox{}{#1}{}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{set depth}
% \begin{macrocode}
-\define@key\adjbox@fam{set depth}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
-}
+\define@adjboxkey{set depth}{\adjbox@raisebox{}{}{#1}}
% \end{macrocode}
% \end{key}
%
@@ -2197,9 +2569,7 @@
% 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}%
-}
+\define@adjboxkey{set vsize}{\adjbox@raisebox{}#1}
% \end{macrocode}
% \end{key}
%
@@ -2245,62 +2615,68 @@
%
% \begin{key}{adjbox}{min width}
% \begin{macrocode}
-\define@key\adjbox@fam{min width}{%
- \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
-}
+\define@adjboxkey{min width}{\@minsizebox\height{#1}!}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max width}
% \begin{macrocode}
-\define@key\adjbox@fam{max width}{%
- \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
-}
+\define@adjboxkey{max width}{\@maxsizebox\height{#1}!}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min height}
% \begin{macrocode}
-\define@key\adjbox@fam{min height}{%
- \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
-}
+\define@adjboxkey{min height}{\@minsizebox\height!{#1}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max height}
% \begin{macrocode}
-\define@key\adjbox@fam{max height}{%
- \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
-}
+\define@adjboxkey{max height}{\@maxsizebox\height!{#1}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{min totalheight}
% \begin{macrocode}
-\define@key\adjbox@fam{min totalheight}{%
- \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
-}
+\define@adjboxkey{min totalheight}{\@minsizebox\totalheight!{#1}}
% \end{macrocode}
% \end{key}
%
%
% \begin{key}{adjbox}{max totalheight}
% \begin{macrocode}
-\define@key\adjbox@fam{max totalheight}{%
- \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
-}
+\define@adjboxkey{max totalheight}{\@maxsizebox\totalheight!{#1}}
% \end{macrocode}
% \end{key}
%
%
+%
+% \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}
+\def\adjbox@Gin@sizeadd#1#2\@nnil{%
+ \@ifnextchar\bgroup{%
+ \adjbox@Gin@Add{#1#2}%
+ \remove@to@nnil
+ }{%
+ \adjbox@Gin@Add{#1{#2}{#2}}%
+ \remove@to@nnil
+ }#2\@nnil
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{key}{adjbox}{min size}
% \begin{macrocode}
\define@key\adjbox@fam{min size}{%
- \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
+ \adjbox@Gin@sizeadd{\@minsizebox\height}#1\@nnil
}
% \end{macrocode}
% \end{key}
@@ -2309,7 +2685,7 @@
% \begin{key}{adjbox}{max size}
% \begin{macrocode}
\define@key\adjbox@fam{max size}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
+ \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\@nnil
}
% \end{macrocode}
% \end{key}
@@ -2318,7 +2694,7 @@
% \begin{key}{adjbox}{min totalsize}
% \begin{macrocode}
\define@key\adjbox@fam{min totalsize}{%
- \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+ \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\@nnil
}
% \end{macrocode}
% \end{key}
@@ -2327,19 +2703,26 @@
% \begin{key}{adjbox}{max totalsize}
% \begin{macrocode}
\define@key\adjbox@fam{max totalsize}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+ \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\@nnil
}
% \end{macrocode}
% \end{key}
%
+%
% \begin{key}{adjbox}{warn width}
% \begin{macrocode}
-\define@key\adjbox@fam{warn width}[\linewidth]{%
- \adjust@addcode{\@collectbox{%
+\define@adjboxkey@defvalue{warn width}{\linewidth}{\@Collectbox{\adjbox@warnwidth{#1}}}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{macro}{\adjbox@warnwidth}
+% Warn if width is wider than the given width plus |\hfuzz|.
+% \begin{macrocode}
+\def\adjbox@warnwidth#1{%
\@tempdima=#1\relax
- \ifdim\width>\@tempdima
- \advance\@tempdima by -\width
- \@tempdima=-\@tempdima
+ \advance\@tempdima by -\width
+ \@tempdima=-\@tempdima
+ \ifdim\@tempdima>\hfuzz
\typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
\ifnum\adjbox@line=\inputlineno
line \adjbox@line
@@ -2349,10 +2732,9 @@
}%
\fi
\BOXCONTENT
- }}{}%
}
% \end{macrocode}
-% \end{key}
+% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -2528,7 +2910,7 @@
% \begin{macrocode}
\def\adjbox@frame#1#2 #3 #4 #5\relax{%
\adjbox@Gin@Add{%
- \@collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
+ \@Collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
}%
\remove@to@nnil
}
@@ -2558,7 +2940,7 @@
% \begin{macrocode}
\def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{%
\adjbox@Gin@Add{%
- \@collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
+ \@Collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
}%
\remove@to@nnil
}
@@ -2807,9 +3189,9 @@
% \begin{macrocode}
\def\adjbox@bgcolor#1#2#3\@nnil{%
\ifx\@nnil#1\@nnil
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color{#2}}}}%
+ \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color{#2}}}}%
\else
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
+ \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
\fi
}
% \end{macrocode}
@@ -2822,7 +3204,7 @@
% \begin{macrocode}
\define@key\adjbox@fam{bgcolor*}{%
\adjbox@checkcolor
- \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{#1}}}%
+ \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{#1}}}%
}
% \end{macrocode}
% \end{key}
@@ -2896,7 +3278,7 @@
% \begin{macro}{\adjbox@bgimage}
% \begin{macrocode}
\def\adjbox@bgimage#1#2#3\@nnil{%
- \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
+ \adjbox@Gin@add{\@Collectbox{\@bgimagebox{#1}{#2}}}%
}
% \end{macrocode}
% \end{macro}
@@ -3322,6 +3704,28 @@
% \end{macrocode}
% \end{key}
%
+% \begin{macrocode}
+\chardef\adjbox@caption@pos=11
+% \end{macrocode}
+%
+% \begin{key}{adjbox}{captionabove}
+% \begin{macrocode}
+\define@key\adjbox@fam{captionabove}{%
+ \chardef\adjbox@caption@pos=1
+ \csname KV@\adjbox@fam @caption\endcsname{#1}%
+}
+% \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{captionbelow}
+% \begin{macrocode}
+\define@key\adjbox@fam{captionbelow}{%
+ \chardef\adjbox@caption@pos=0
+ \csname KV@\adjbox@fam @caption\endcsname{#1}%
+}
+% \end{macrocode}
+% \end{key}
+%
% \begin{key}{adjbox}{caption}
% \begin{macrocode}
\define@key\adjbox@fam{caption}{%
@@ -3345,21 +3749,13 @@
% \begin{key}{adjbox}{figure}
% \begin{macrocode}
\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}{}%
+ \adjbox@addfloat{figure}{\begin{figure}}{}{\end{figure}}%
\else
- \expandafter\expandafter\expandafter\adjbox@figure
- \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{[#1]}%
+ \adjbox@addfloat{figure}{\begin{figure}}{[{#1}]}{\end{figure}}%
\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{key}
%
@@ -3370,16 +3766,12 @@
\@ifnextchar\bgroup{%
\adjbox@float
}{%
- \adjbox@float{#1}\@nnil
+ \adjbox@float{#1}{}\@nnil
\remove@to@nnil
}#1\@nnil
}
-\def\adjbox@float{%
- \expandafter\expandafter
- \expandafter\adjbox@@float\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}%
-}
-\def\adjbox@@float#1#2#3\@nnil{%
- \adjust@addcode{\begin{#2}#3}{#1\end{#2}}%
+\def\adjbox@float#1#2\@nnil{%
+ \adjbox@addfloat{#1}{\begin{#1}}{#2}{\end{#1}}%
}
% \end{macrocode}
% \end{key}
@@ -3387,22 +3779,71 @@
% \begin{key}{adjbox}{nofloat}
% \begin{macrocode}
\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}%
+ \adjbox@addfloat{#1}{\adjnofloat}{{#1}}{\endadjnofloat}%
}
% \end{macrocode}
% \end{key}
%
%
+% \begin{macro}{\adjbox@caption@table@pos}
+% \begin{macrocode}
+\def\adjbox@caption@table@pos{1}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjbox@addfloat}
+% \begin{macrocode}
+\def\adjbox@addfloat#1#2#3#4{%
+ \ifnum\adjbox@caption@pos>10
+ \chardef\adjbox@caption@pos=0\csname adjbox@caption@#1@pos\endcsname\relax
+ \fi
+ \ifcase\adjbox@caption@pos
+ \def\@tempa{\adjust@addcode{#2#3}}%
+ \expandafter\expandafter\expandafter\@tempa
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label#4}%
+ \else
+ \def\@tempa##1{\adjust@addcode{#2#3\adjbox@captionabove##1}}%
+ \expandafter\expandafter\expandafter\@tempa
+ \expandafter\expandafter\expandafter
+ {\expandafter\adjbox@caption\adjbox@label}{#4}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\adjbox@captionabove}
+% \begin{macrocode}
+\@ifpackageloaded{caption}{%
+ \let\adjbox@captionabove\relax
+}{%
+ \def\adjbox@captionabove{%
+ \begingroup
+ \edef\@tempa{\endgroup
+ \abovecaptionskip=\the\belowcaptionskip\relax
+ \belowcaptionskip=\the\abovecaptionskip\relax
+ }%
+ \@tempa
+ }%
+ \AtBeginDocument{%
+ \@ifpackageloaded{caption}{%
+ \global\let\adjbox@captionabove\relax
+ }{}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \begin{environment}{adjnofloat}
% Environment used for non-floats.
% \begin{macrocode}
\newenvironment{adjnofloat}[1]{%
\trivlist
\def\@captype{#1}%
+ \parindent\z@
\item\relax
- \leavevmode
}{%
\endtrivlist
}
@@ -3450,20 +3891,18 @@
% \begin{key}{adjbox}{gobble}
% Discards the content.
% \begin{macrocode}
-\define@key\adjbox@fam{gobble}[]{%
+\define@key\adjbox@fam{gobble}[\@nil]{%
+ \adjbox@novalue{#1}%
\let\adjustbox@noindent\relax
- \adjbox@Gin@Add{\@collectbox{}}%
+ \adjbox@Gin@Add{\@Collectbox{}}%
}
% \end{macrocode}
% \end{key}
%
% \begin{key}{adjbox}{discard}
-% Discards the content.
+% Alias of \Key{gobble}.
% \begin{macrocode}
-\define@key\adjbox@fam{discard}[]{%
- \let\adjustbox@noindent\relax
- \adjbox@Gin@Add{\@collectbox{}}%
-}
+\adjbox@let@key\adjbox@fam{discard}{gobble}%
% \end{macrocode}
% \end{key}
%
@@ -3471,9 +3910,7 @@
% \begin{key}{adjbox}{content}
% Replaces the content. The old content is still processed completely before being replaced..
% \begin{macrocode}
-\define@key\adjbox@fam{content}{%
- \adjbox@Gin@Add{\@collectbox{#1}}%
-}
+\define@adjboxkey{content}{\@Collectbox{#1}}%
% \end{macrocode}
% \end{key}
%
@@ -3486,9 +3923,7 @@
% \begin{key}{adjbox}{gstore}
% Store the current content into a box without removing it.
% \begin{macrocode}
-\define@key\adjbox@fam{gstore}{%
- \adjbox@Gin@Add{\global\@collectboxto{#1}{\BOXCONTENT}}%
-}
+\define@adjboxkey{gstore}{\global\@collectboxto{#1}{\BOXCONTENT}}
% \end{macrocode}
% \end{key}
%
@@ -3497,7 +3932,7 @@
% \begin{macrocode}
\define@key\adjbox@fam{gstore*}{%
\let\adjustbox@noindent\relax
- \adjbox@Gin@Add{\global\@collectboxto{#1}{}}%
+ \adjbox@Gin@Add{\global\sbox{#1}}%
}
% \end{macrocode}
% \end{key}
@@ -3505,7 +3940,7 @@
% \begin{key}{adjbox}{gstore width}
% \begin{macrocode}
\define@key{adjbox}{gstore width}{%
- \adjbox@Gin@Add{\@collectbox{\global#1=\width\BOXCONTENT}}%
+ \adjbox@Gin@Add{\@Collectbox{\global#1=\width\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
@@ -3513,7 +3948,7 @@
% \begin{key}{adjbox}{gstore depth}
% \begin{macrocode}
\define@key{adjbox}{gstore depth}{%
- \adjbox@Gin@Add{\@collectbox{\global#1=\depth\BOXCONTENT}}%
+ \adjbox@Gin@Add{\@Collectbox{\global#1=\depth\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
@@ -3521,7 +3956,7 @@
% \begin{key}{adjbox}{gstore height}
% \begin{macrocode}
\define@key{adjbox}{gstore height}{%
- \adjbox@Gin@Add{\@collectbox{\global#1=\height\BOXCONTENT}}%
+ \adjbox@Gin@Add{\@Collectbox{\global#1=\height\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
@@ -3529,7 +3964,7 @@
% \begin{key}{adjbox}{gstore totalheight}
% \begin{macrocode}
\define@key{adjbox}{gstore totalheight}{%
- \adjbox@Gin@Add{\@collectbox{\global#1=\totalheight\BOXCONTENT}}%
+ \adjbox@Gin@Add{\@Collectbox{\global#1=\totalheight\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
@@ -3537,7 +3972,7 @@
% \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}}%
+ \adjbox@Gin@Add{\@Collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
}
% \end{macrocode}
% \end{key}
@@ -3585,9 +4020,7 @@
%
% \begin{key}{adjbox}{split}
% \begin{macrocode}
-\define@key\adjbox@fam{split}{%
- \adjbox@Gin@Add{\@collectbox{\@splitbox#1}}%
-}
+\define@adjboxkey{split}{\@Collectbox{\@splitbox#1}}
% \end{macrocode}
% \end{key}
%
@@ -3722,7 +4155,7 @@
% \begin{key}{adjbox}{pagebreak}
% \begin{macrocode}
\define@key\adjbox@fam{pagebreak}[]{%
- \adjbox@Gin@Add{\@collectbox{\@pagebreakbox}}%
+ \adjbox@Gin@Add{\@Collectbox{\@pagebreakbox}}%
}
% \end{macrocode}
% \end{key}
@@ -3792,6 +4225,7 @@
%
% ^^A )))
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% vim: foldenable foldmethod=marker foldmarker=(((,)))
% \iffalse
%</adjustbox.sty>
% \fi
diff --git a/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
index cb1afd4dd95..a1a6ad7cb37 100644
--- a/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
+++ b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
@@ -159,7 +159,7 @@
%</driver>
% \fi
%
-% \CheckSum{484}
+% \CheckSum{490}
%
% \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