Debian Codegraph @

texmf-dist/source/latex/adjustbox/adjustbox.dtx

raw
1 % \iffalse meta-comment
2 %<=*COPYRIGHT>
3 %% Copyright (C) 2011-2025 by Martin Scharrer <[email protected]>
4 %% -------------------------------------------------------------------
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Martin Scharrer.
16 %%
17 %% This work consists of the files adjustbox.dtx, adjustbox.ins
18 %% and the derived file adjustbox.sty.
19 %%
20 %<=/COPYRIGHT>
21 % \fi
22 %
23 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 % ^^A DRIVER (((
25 % \iffalse
26 %<*driver>
27 \ProvidesFile{adjustbox.dtx}[%
28 %<=*DATE>
29 2025/02/26
30 %<=/DATE>
31 %<=*VERSION>
32 v1.3c
33 %<=/VERSION>
34 DTX file for the adjustbox package]
35 \documentclass[a4paper]{ydoc}[2011/08/11]
36 \usepackage{amsmath}
37 \usepackage[T1]{fontenc}
38 \usepackage[utf8]{inputenc}
39 \usepackage{fourier}
40 \usepackage{newverbs}
41 \usepackage{xparse}
42 \MakeSpecialShortVerb\qverb\"
43 %\AtBeginDocument{\MakeShortMacroArgs\`\relax}
44 %\AtEndDocument{\DeleteShortVerb\`}
45 \GetFileInfo{adjustbox.dtx}
46 \usepackage{adjustbox}[\filedate]
47 \usepackage{tikz}
48
49 \renewenvironment{example}[1][Example:]{%
50 \subsubsection*{#1}%
51 }{%
52 \par
53 }
54 \newenvironment{examples}[1][Examples:]{%
55 \subsubsection*{#1}%
56 }{%
57 \par
58 }
59 \global\optionaloff
60 \let\optionalon\relax
61
62 \lstdefinelanguage{none}{}%
63 \lstdefinelanguage{adjustbox}{%
64 moretexcs={%
65 begin,end,adjustbox
66 },
67 emph={%
68 frame,fbox,cframe,cfbox,minipage,raise
69 },
70 }%
71
72 \lstdefinestyle{examplecode}{%
73 basicstyle=\ttfamily\small,
74 numbers=none,language=none,
75 classoffset=1,
76 morekeywords={begin,end},
77 keywordstyle=\bfseries,
78 classoffset=0,
79 morekeywords={adjustbox,minsizebox,maxsizebox,lapbox,marginbox,phantombox},
80 keywordstyle=\macrodescstyle,
81 emph={viewport, trim, Trim, Viewport, Clip, Clip*, frame, fbox, cframe, cfbox, reflect, lap, margin, margin*, dpi,
82 pxdim, execute, raise, valign, bgcolor, set, height, depth, vsize, width, totalheight, center, left, right, outer, inner, min, max,
83 size, totalsize,
84 minipage, varwidth, innerenv, innercode, env, Addcode, addcode, precode, Precode, appcode, angle, scale, height, width, totalheight, resolution,
85 },
86 emphstyle=\keydescstyle,
87 }
88
89 \makeatletter
90 \def\PrintExample{%
91 \begingroup
92 \par\smallskip\noindent
93 \leavevmode
94 \BoxExample
95 \@tempdima=\textwidth
96 \advance\@tempdima by -\wd\examplecodebox\relax
97 \advance\@tempdima by -\wd\exampleresultbox\relax
98 \advance\@tempdima by -15pt\relax
99 \ifdim\@tempdima>\bigskipamount
100 \hbox to \textwidth{%
101 \null\hss
102 \minipage[c]{\wd\examplecodebox}\usebox\examplecodebox\endminipage
103 \hfill\hskip\bigskipamount\hfill
104 \minipage[c]{\wd\exampleresultbox}%
105 \EXAMPLERESULT
106 \endminipage
107 \hss\null
108 }%
109 \else
110 \vbox{%
111 \leftline{\usebox\examplecodebox}%
112 \vspace{\bigskipamount}%
113 \rightline{\EXAMPLERESULT}%
114 }%
115 \fi
116 \par\smallskip
117 \endgroup
118 }
119 \def\EXAMPLERESULT{%
120 \leavevmode\hbox{%
121 \textcolor{exampleborder}{%
122 \boxframe
123 {\dimexpr\wd\exampleresultbox+2\fboxrule\relax}%
124 {\dimexpr\ht\exampleresultbox+\fboxrule\relax}%
125 {\dimexpr\dp\exampleresultbox+\fboxrule\relax}%
126 \hskip-\wd\exampleresultbox
127 \hskip-\fboxrule
128 }%
129 \usebox\exampleresultbox
130 }%
131 }%
132 \makeatother
133 \colorlet{exampleborder}{black!33}
134 \def\Descsep{\par\vskip-2.5ex\relax}
135
136 %\EnableCrossrefs
137 %\CodelineIndex
138 %\RecordChanges
139 \OnlyDescription
140 \renewcommand{\bottomfraction}{0.5}
141 \begin{document}
142 \DocInput{adjustbox.dtx}
143 \PrintChanges
144 %\newpage\PrintIndex
145 \end{document}
146 %</driver>
147 % \fi
148 % ^^A )))
149 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 % ^^A Title page (((
151 % \CheckSum{3488}
152 %
153 % \CharacterTable
154 % {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
155 % 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
156 % Digits \0\1\2\3\4\5\6\7\8\9
157 % Exclamation \! Double quote \" Hash (number) \#
158 % Dollar \$ Percent \% Ampersand \&
159 % Acute accent \' Left paren \( Right paren \)
160 % Asterisk \* Plus \+ Comma \,
161 % Minus \- Point \. Solidus \/
162 % Colon \: Semicolon \; Less than \<
163 % Equals \= Greater than \> Question mark \?
164 % Commercial at \@ Left bracket \[ Backslash \\
165 % Right bracket \] Circumflex \^ Underscore \_
166 % Grave accent \` Left brace \{ Vertical bar \|
167 % Right brace \} Tilde \~}
168 %
169 %
170 % \changes{v0.1}{2011/01/24}{First internal version}
171 % \changes{v0.2}{2011/01/27}{First released version}
172 % \changes{v0.3}{2011/03/20}{Bug fix for wrong baseline placed on the bottom}
173 % \changes{v0.4}{2011/07/xx}{Added pdftex driver}
174 % \changes{v0.5}{2011/08/13}{Added more macros and keys}
175 % \changes{v0.5a}{2011/08/21}{Fixed \Key{left} and \Key{right} keys. Fixed \Key{valign}'='t}
176 % \changes{v0.6}{2011/09/04}{Added tabular support.}
177 % \changes{v0.6a}{2011/10/29}{Fixed issue with keys affecting the content in an unwanted way.}
178 % \changes{v0.7}{2011/10/30}{Added \cs{adjustboxset} and \cs{adjustimage} macros.}
179 % \changes{v0.8}{2011/11/14}{
180 % Added driver files for dvips and xelatex. Moved pdftex driver code to own file.
181 % Fixed and improved default unit code for the \opt{calc} option.
182 % Changed \cs{adjustimage} code to use internals of \cs{includegraphics}. This allows the redefinition of \cs{includegraphics}.
183 % Added manual for \Key{bgcolor} and added \Key{bgcolor*}.
184 % Changed \Key{bgimage} to use \cs{adjustimage}.
185 % Added manual entries for \Key{cfbox} and \Key{cframe}.
186 % Removed loading of non-mandatory \pkg{storebox} package for now.
187 % Added \Key{set vsize}.
188 % Added shortcuts \Key{rlap} and \Key{llap}.
189 % Added \adjincludegraphics and the Export option.
190 % Fix for \Key{innerenv} argument.
191 % Added lengths \cs{Width}, \cs{Height}, \cs{Depth} and \cs{Totalheight} for the original dimensions of the content.
192 % Added own \cs{raisebox} variant to support math expressions even for \cs{includegraphics}.
193 % Some code cleanup.
194 % Added \Key{varwidth} key as an alternative to \Key{minipage}.
195 % Added \stackbox and \Key{stack} key and \env{stackbox} environment (similar to \cs{shortstack})
196 % Added check for \pkg{xcolor} package.
197 % }
198 % \changes{v0.9}{2012/05/16}{
199 % Basic trim and clip macros and driver files are now placed in a dedicated minimal package 'trimclip'.
200 % Special thanks goes to Joseph Wright (LaTeX3 project) for his work on the driver files.
201 % Clipping drivers are provided for 'pdftex' (incl. LuaTeX), 'dvips' and 'xetex' as well as a PGF fall-back
202 % driver.
203 % Packages: New dedicated 'trimclip' package with own manual.
204 % Better separation between 'adjcalc' and 'adjustbox' package.
205 % Review of manuals
206 % New adjustbox keys:
207 % * content
208 % * gstore
209 % * gstore*
210 % * gstore width/height/depth/totalheight/sizes
211 % * gobble/discard
212 % * phantom
213 % * warn width
214 % * float
215 % * nofloat
216 % * figure
217 % * label
218 % * caption
219 % * vspace
220 % * vspace*
221 % * padding (alias of 'margin')
222 % * padding* (alias of 'margin*')
223 % Fixes: env key now works correctly; Fixed raise box code.
224 % Macro changes: Added third optional argument to \stackbox.
225 % }
226 % \changes{v1.0}{2012/05/21}{%^^A
227 % * Updated manual to contain all new keys and macro.
228 % * Code optimisations.
229 % * Improvements of (re-)boxing code.
230 % * Added user-level macros to define keys.
231 % * Changed horizontal alignment keys to box the content and added matching macros.
232 % * Changed horizontal inner/outer side keys to use 'ifodd' package and added matching macros.
233 % * Added missing \cs{leavevmode} for "raise" key.
234 % * Simplified code for "valign" key. Fixed spurious space for "valign=v".
235 % * Fixed min/max size keys to double a single value correctly.
236 % * Code cleanup with "warn width" key.
237 % }
238 % \changes{v1.1}{2018/04/08}{%^^A
239 % * Several bug fixes.
240 % * Support for round corners and frames.
241 % }
242 % \changes{v1.2}{2019/01/04}{%^^A
243 % * Added missing 'clip' feature for rounded frames.
244 % * Changed order of corner values for rounded frames. This includes an update to the clipping drivers.
245 % * Corrected 'adjnofloat' environment used by the 'nofloat' key to support the 'hypcap' feature of the 'caption' and 'hypcap' packages.
246 % * Updated manual description of `export` option as requested by Issue #9.
247 % * Updated manual to use (left, bottom, right, top) for the side values instead of (llx, lly, urx, ury).
248 % * Some other improvements in the manual.
249 % * Added keys and matching commands and environments to align to the page margins and text area borders:
250 % 'pagecenter', 'pageleft', 'pageright', 'pageinner', 'pageouter',
251 % 'textareacenter', 'textarealeft', 'textarearight', 'textareainner', 'textareaouter'.
252 % * Added 'noindent' key.
253 % * Added \newadjustimage and \NewAdjustImage commands to define custom versions of \adjustimage with predefined key
254 % lists. This include variation to renew, provide and declare such macros.
255 % * Added \provideadjustboxenv and \declareadjustboxenv.
256 % * Added \provideadjustboxcmd and \declareadjustboxcmd.
257 % }
258 % \changes{v1.3}{2020/08/19}{%^^A
259 % * Added support for (hopefully) all 'graphicx' keys.
260 % * Added missing \leavevmode for framing keys.
261 % * Added key "leavevmode" on request of Frank Mittelbach.
262 % * Added 'process' key.
263 % * Added 'clap' key on user request.
264 % * Removed old graphicx key 'print'.
265 % * trimclip: Added explicit luatex driver which uses the pdftex driver to avoid the fallback to PGF driver.
266 % }
267 % \changes{v1.3a}{2022/10/17}{%^^A
268 % * Updated documentation with new repository URL and new email address.
269 % * Added dependency file for texlive.
270 % }
271 % \changes{v1.3b}{2025/02/21}{Added missing tc-luatex.def into .ins file.}
272 % \changes{v1.3c}{2025/02/26}{Added support for newer LuaTeX versions in tc-luatex.def.}
273 %
274 % \GetFileInfo{adjustbox.dtx}
275 %
276 % \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let}
277 %
278 % \author{Martin Scharrer}
279 % \email{[email protected]}
280 % \repository{https://github.com/MartinScharrer/adjustbox/}
281 % \ydocpdfsettings
282 % \maketitle
283 %
284 % \makeatletter
285 % \def\LATeX{\texorpdfstring{(L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts
286 % \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em)\TeX}{(La)TeX}}
287 % \makeatother
288 %
289 % \begin{abstract}
290 % This package allows to adjust general \LATeX\ material in several ways using a key=value interface.
291 % It got inspired by the interface of \Macro\includegraphics from the \pkg{graphicx} package.
292 % This package also loads the \pkg{trimclip} package which code was once included in this package.
293 % \end{abstract}
294 % \clearpage% \tableofcontents
295 %
296 % ^^A )))
297 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298 % \clearpage\section{Introduction} ^^A (((
299 % The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro
300 % \Macro\includegraphics[<options>]{<file name>} which can be used to include graphic files. Several options can be used
301 % to scale, resize, rotate, trim and/or clip the graphic.
302 % The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding
303 % operation on \LATeX{} material, which is subsequently placed inside a \Macro\hbox.
304 % However no macros are provided to trim or clip \LATeX{} material, most likely because this operations
305 % are not done by \TeX{} but by the output format, i.e.\ using PostScript (PS) or PDF operations.
306 %
307 % This package started by providing the missing macros \Macro\clipbox and \Macro\trimbox.
308 % Then a general \Macro\adjustbox macro which allows to combine many operations using a key=value syntax was added and
309 % further extended until it represented the main feature of this package. Newly added keys are also provided as
310 % dedicated macros and corresponding environments.
311 % The \Macro\clipbox and \Macro\trimbox macros were then moved together with the required output driver code to a
312 % dedicated package \pkg{trimclip}. This allows documents and other packages to use these basic features without
313 % loading the full \pkg{adjustbox} package.
314 %
315 %
316 % ^^A )))2
317 % \subsection{Dependencies} ^^A (((2
318 % The \pkg{adjustbox} package and its \pkg{trimclip} sub-package require the author's other packages \pkg{adjcalc}
319 % (bundled with \pkg{adjustbox}) and \pkg{collectbox}, as well as the packages \pkg{xkeyval}, \pkg{graphicx} and \pkg{ifpdf}.
320 % The \pkg{varwidth} package is automatically loaded if installed, otherwise the \Key{varwidth} and \Key{stack} keys are
321 % disables as well as \Macro\stackbox and the \env{stackbox} environment.
322 % The \pkg{ifoddpage} package is automatically loaded if installed, otherwise the \Key{outer} and \Key{inner} keys are
323 % disables as well as \Macro\outersidebox and \Macro\innersidebox macros and corresponding environments.
324 % For features which use colors the \pkg{xcolor} package must also be loaded manually (the \pkg{color} package is fine, too).
325 % The experimental |split| and |pagebreak| features also require the \pkg{storebox} package to be loaded manually.
326 %
327 % ^^A )))2
328 % \subsection{Verbatim Support}\label{sec:verbatim} ^^A (((2
329 % The macros provided by \pkg{adjustbox} and \pkg{trimclip} read the content as a horizontal \TeX{} box and not as an
330 % macro argument in order to support verbatim content.
331 % This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:
332 % \begin{macroquote}
333 % \adjustbox{key=value,\ldots}\AlsoMacro\bgroup~<content>\AlsoMacro\egroup
334 % \end{macroquote}
335 % Special care is taken to allow the \meta{content} to be a single macro (except \Macro\bgroup) without any braces:
336 % \begin{macroquote}
337 % \adjustbox{key=value,\ldots}\AlsoMacro\somemacro
338 % \end{macroquote}
339 % This is to support the habit of some \LaTeX{} users to drop the braces for single token arguments.
340 % All environments support verbatim content.
341 % Note that the plain\TeX{} syntax for environments (\Macro\adjustbox\ldots\Macro\endadjustbox) can not be used
342 % because it will trigger \Macro\adjustbox as a macro. However, the braces around the content can be replaced
343 % by \Macro\bgroup and \Macro\egroup.
344 %
345 % ^^A )))2
346 % ^^A )))
347 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348 % \clearpage\section{Package Options}\label{sec:options} ^^A (((
349 % This package accepts the following options:
350 %
351 % \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
352 % \oitem{export} Exports the keys of \Macro\adjustbox to \Macro\includegraphics so that they can be used with this
353 % macro as well. Note that not all keys will works properly with \Macro\includegraphics as its internal
354 % code does not support all features. If problems occur the option |Export| should be used.
355 % For new documents it is recommended to use the macro \Macro\adjustimage{<keys>}{<filename>} instead.
356 % \oitem{Export} Sets \Macro\includegraphics to be identical to \Macro\adjincludegraphics, which also allows the usage
357 % of all \Macro\adjustbox keys.
358 % \oitem{pgf} This option is passed to \pkg{trimclip} and makes it to use the \pkg{pgf} package for all clip operations.
359 % This overrides all automatically detected drivers.
360 % \oitem{PGF} This option will pass the \opt{pgf} to \pkg{trimclip} and enable the \opt{pgfmath} option of
361 % \pkg{adjcalc}, i.e.\ the \pkg{pgf}
362 % package is used for clip operations and the \pkg{pgfmath} pacakge is used to parse length arguments.
363 % \oitem{minimal} Only load a minimal set of code, i.e.\ \pkg{trimclip} and \Macro\adjustbox/\env{adjustbox}
364 % but no additional keys and macros.
365 % \end{description}
366 %
367 % \noindent
368 % The following options define the way length values are processed by the provided macros.
369 % They are passed to the \Macro\adjcalcset macro of the \pkg{adjcalc} package and load any required packages.
370 % These options can also be used as local keys on \Macro\adjustbox. See the \pkg{adjcalc} manual for more details on
371 % them.
372 %
373 % \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]}
374 % \oitem{etex} Uses the $\epsilon$-\TeX\ primitive \Macro\glueexpr to parse length values.
375 % \oitem{calc} Uses the \pkg{calc} package to parse length values.
376 % \oitem{pgfmath} Uses the \pkg{pgfmath} package of the \pkg{pgf} bundle to parse length values.
377 % \oitem{defaultunit}\MacroArgs!{\hspace*{-1ex}}!'='<unit>\relax
378 % This sets the default unit used for values which accept length without units, e.g.\ \Key{trim}.
379 % \end{description}
380 %
381 % \noindent
382 % In addition, all driver options of the \pkg{trimclip} package are also accepted and passed to it.
383 % All unknown options are passed to the \pkg{graphicx} package, which might pass them down to the \pkg{graphics}
384 % package.
385 %
386 % ^^A )))
387 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
388 % \clearpage\section{Main Macros}^^A (((
389 % The following macros and environments represent the main functionality of this package.
390 % Special care is taken so that the macros and the environments can have the same name.
391 % For starred environments the star can be either part of the name or an optional argument.
392 %
393 % \subsection{Adjust Box Content} ^^A (((2
394 % \vskip-\lastskip
395 % \DescribeMacro\adjustbox{<key=value, \ldots>}{<content>}
396 % The \Macro\adjustbox macro allows the modification of general \LATeX\ content using a key=value syntax.
397 % This can be seen as an extension of the \Macro\includegraphics macro from images to any \LATeX{} material.
398 % The macro supports the all \Macro\includegraphics keys and many more.
399 % However, they are provided as a mandatory not as an optional argument, because an \Macro\adjustbox without options
400 % would not make sense and can be replaced by a simple \Macro\mbox.
401 % As already stated the content is read as a box, not as a macro argument, therefore verbatim or other special
402 % content is supported and the braces can also be replaced by \Macro\bgroup and \Macro\egroup.
403 % There is no starred version of this macro.
404 %
405 % \DescribeEnv[<content>]{adjustbox}{<key=value, \ldots>}
406 % The environment version of \Macro\adjustbox. A difference to the macro is that it includes \Macro\noindent
407 % to suppress paragraph indention.
408 %
409 % \Needspace*{5\baselineskip}
410 % \clearpage\subsection{Adjust Images}
411 % \vskip-\lastskip
412 % \DescribeMacro\adjustimage{<key=value, \ldots>}{<image filename>}
413 % This macro can be used as an extension of \Macro\includegraphics.
414 % While \Macro\adjustbox is based on the same interface as \Macro\includegraphics it provides more keys and allows
415 % global keys set by \Macro\adjustboxset. Most keys can be exported to \Macro\includegraphics using the \opt{export}
416 % option, but there is no support for global keys\footnote{However some keys, but not all, can be set globally using
417 % \Macro\setkeys{Gin}{<includegraphic key=value pairs>}}. Therefore it can make sense to use
418 % \Macro\adjustbox{<key/value pairs>}{\AlsoMacro\includegraphics{<filename>}}, which is the definition of
419 % \Macro\adjustimage.
420 % However, it does not use \Macro\includegraphics directly, but an internal macro, to allow the redefinition of
421 % \Macro\includegraphics.
422 % This macro does not require the \opt{export} option and therefore helps to avoid option clashes
423 % if \pkg{adjustbox} is loaded at several places.
424 %
425 %
426 % \DescribeMacro\adjincludegraphics[<key/value pairs>]{<image filename>}
427 % Like \Macro\adjustimage but in the same format as \Macro\includegraphics, i.e.\ with an optional argument. This macro
428 % allows to use all features of \Macro\adjustbox on images, however special care must be taken if the values include
429 % `|[ ]|'. In this case either the whole value or the while optional argument must be wrapped in `|{ }|':
430 % \Macro\adjincludegraphics['key='{[..]},...]{..} or \\\Macro\adjincludegraphics[{key=[..],...}]{..}. \\
431 % It is possible to redefine \Macro\includegraphics to \Macro\adjincludegraphics and this is done by
432 % the \opt{Export} option (not to be confused with the \opt{export} option).
433 %
434 % ^^A )))2
435 % \clearpage\subsection{Defining custom environments and macros} ^^A (((2
436 % After \pkg{adjustbox} is used to define custom environments to format specific content.
437 % If an environment contains other environments these are often written in the plain form \Macro\foo \ldots
438 % \Macro\endfoo to avoid the overhead of \Macro\begin and \Macro\end and to keep the outer environment name for
439 % meaningful error messages. As mentioned, the dual nature of \Macro\adjustbox which will detect if it is used
440 % as environment of macro does not permit this plain form, which can be a pitfall for custom environment definitions.
441 % Instead the macro form \Macro\adjustbox{<key=value>}\AlsoMacro\bgroup \ldots \Macro\egroup should be used.
442 % To simplify custom environment definitions based on \Macro\adjustbox/\env{adjustbox} the following macros are
443 % provided.
444 %
445 %
446 % \DescribeMacro\newadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
447 % This declaration defines an environment and macro with the given name which will apply the given \pkg{adjustbox} keys
448 % to its content. The environment/macro can also posses arguments, including one leading optional argument, which can be
449 % used inside the key=value pairs. It is recommended to wrap the arguments into braces, e.g.\ use `|{#1}|' instead of
450 % `|#1|' etc., to avoid issues with potentially included commas and equal signs.
451 % The number and type of arguments are defined using two optional arguments in the same
452 % way as for \Macro\newcommand and \Macro\newenvironment.
453 %
454 %
455 % \DescribeMacro\newadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
456 % This declaration works similar to the unstarred version but only defines an environment.
457 % This environment can therefore be used like any other normal \LaTeX\ environment, including in its plain
458 % form {\macrodescstyle\textbackslash\meta{name}} \ldots {\macrodescstyle{\textbackslash end\meta{name}}}.
459 %
460 %
461 % \DescribeMacro\renewadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
462 % \DescribeMacro\renewadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
463 % Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will redefine an existing macro/environment and cause an
464 % error if it was not yet defined.
465 %
466 %
467 % \DescribeMacro\provideadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
468 % \DescribeMacro\provideadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
469 % Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will define a macro/environment only if it does not exists
470 % yet.
471 %
472 %
473 % \DescribeMacro\declareadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>}
474 % \DescribeMacro\declareadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>}
475 % Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will always define a macro/environment even if it does already exist.
476 %
477 %
478 % \DescribeMacro\newadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
479 % This declaration defines a macro which applies the given \pkg{adjustbox} keys to its content.
480 % As with \Macro\adjustbox the content is read as box, not as macro argument.
481 % The macro arguments (if any) are defined in the same way as with \Macro\newcommand.
482 % The arguments can then be used inside the key=value pairs. The number of arguments does not
483 % include the content.
484 % This declaration is intended if no environment form is required and is more efficient than the dual declaration.
485 %
486 % \begin{example}
487 % \begin{examplecode}
488 % \newadjustboxcmd{\frotate}[1]{rotate={#1},fbox}%
489 % \frotate{30}{Text}
490 % \end{examplecode}
491 % \end{example}
492 %
493 % \DescribeMacro\renewadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
494 % Like \Macro\newadjustboxcmd but will redefine an existing macro and cause an
495 % error if it was not yet defined.
496 %
497 %
498 % \DescribeMacro\provideadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
499 % Like \Macro\newadjustboxcmd but will define the macro only if it does not exist yet.
500 %
501 %
502 % \DescribeMacro\declareadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
503 % Like \Macro\newadjustboxcmd but will define the macro in any case even if it does exist yet.%
504 %
505 %
506 % \DescribeMacro\newadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
507 % \DescribeMacro\renewadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
508 % \DescribeMacro\provideadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
509 % These macros allow to define new versions of \Macro\adjustimage with predefined key lists.
510 % The new define image macros can also have arguments which can be used in the predefined key list to
511 % substitude values or one or multiple keys.
512 %
513 % They work like \Macro\newcommand, \Macro\renewcommand and \Macro\providecommand, respectively, where
514 % \meta{num} is the number of arguments and \meta{default} provides a default value for the then optional
515 % first argument. However, instead of a macro content a \meta{key=value} list must be present, which can
516 % contain the arguments (|#1|, |#2|, etc). If arguments are used as values they should be wrapped in braces.
517 % If there are only part of a value the whole value should be wrapped in braces. This is to avoid causes commas
518 % inside the arguments to cause issues with the key=value list.
519 %
520 % \begin{example}
521 % \begin{examplecode}
522 % \newadjustimage{\myimage}[2][red]{width={#2},cfbox={#1}}%
523 % \myimage{2cm}{example-image}
524 % \myimage[blue]{2cm}{example-image}
525 % \end{examplecode}
526 % \end{example}
527 %
528 % \DescribeMacro\declareadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>}
529 % Like \Macro\newadjustimage but will not cause an error if the macro is already defined.
530 %
531 %
532 % \DescribeMacro\NewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
533 % \DescribeMacro\RenewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
534 % \DescribeMacro\ProvideAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
535 % \DescribeMacro\DeclareAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>}
536 % These macros also allow to define new versions of \Macro\adjustimage with predefined key lists, but use
537 % the \pkg{xparse} package (which must be loaded separately!) and its macros \Macro\NewDocumentCommand, \Macro\RenewDocumentCommand,
538 % \Macro\ProvideDocumentCommand and \Macro\DeclareDocumentCommand instead of the standard \LaTeX\ macro creation
539 % macros. This allows a larger variety of optional and mandatory arguments. Please see the \pkg{xparse} manual
540 % for more details.
541 %
542 % \begin{example}
543 % \begin{examplecode}
544 % \NewAdjustImage{\myimage}{O{red}m}{width={#2},cfbox={#1}}%
545 % \myimage{2cm}{example-image}
546 % \myimage[blue]{2cm}{example-image}
547 % \end{examplecode}
548 % \end{example}
549 %
550 %
551 % ^^A )))2
552 % \clearpage\subsection{Setting keys globally} ^^A (((2
553 % \vskip-\lastskip
554 % \DescribeMacro\adjustboxset{<global keys to be executed \emph{before} local keys>}
555 % \DescribeMacro\adjustboxset*{<global keys to be executed \emph{after} local keys>}
556 % Using these two macros all keys can be set globally, i.e.\ for all future \Macro\adjustbox macros and \env{adjustbox}
557 % environments. Note that these settings are actually \emph{local} to the current \TeX\ group and only really global if
558 % used in the preamble or outside any group. The normal macro will place all given keys before the keys used in first
559 % argument of \Macro\adjustbox\ / \env{adjustbox}, while the starred version will place them afterwards.
560 %
561 % If these macros are used several times there keys are accumulated. This happens in the given order for the normal
562 % version and in reversed order for the starred version, i.e.\ the keys of further \Macro\adjustboxset or
563 % \Macro\adjustboxset* are always added so they face inwards. If used without any keys but an empty argument, all keys
564 % previously set with the same macro are removed (from the current \TeX\ scope). This means \Macro\adjustboxset{}
565 % clears all keys set be previously usages of \Macro\adjustboxset{<keys>} and \Macro\adjustboxset*{} clears all set by
566 % \Macro\adjustboxset*{<keys>}. Such resets are again local to the current \TeX\ group.
567 %
568 %
569 % \begin{examples}
570 % The macros:
571 % \begin{macroquote}
572 % \adjustboxset{keya=1} \\
573 % \adjustboxset*{keyc=3}\\
574 % \adjustbox{keyb=2}{content}
575 % \end{macroquote}
576 % are effectively the same as:
577 % \begin{macroquote}
578 % \adjustbox{keya=1,keyb=2,keyc=3}{content}
579 % \end{macroquote}
580 % \par\medskip\noindent
581 % The macros:
582 % \begin{macroquote}
583 % \adjustboxset{keya=1,keyb=2} \\
584 % \adjustboxset{keyc=3,keyd=4} \\
585 % \adjustboxset*{keyg=7,keyh=8}\\
586 % \adjustboxset*{keyi=9,keyj=10}\\
587 % \adjustbox{keye=5,keyf=6}{content}
588 % \end{macroquote}
589 % are effectively the same as:
590 % \begin{codequote}
591 % \AlsoMacro\adjustbox'{keya=1,keyb=2,keyc=3,keyd=4,keye=5,keyf=6,'\\
592 % !\hskip0pt!' keyi=9,keyj=10,keyg=7,keyh=8}'{content}
593 % \end{codequote}
594 % \end{examples}
595 %
596 % ^^A )))2
597 % \clearpage\subsection{Argument Values}\label{sec:argval} ^^A (((2
598 % All length values given in the arguments of all macros and keys provided by this package are parsed
599 % by and advanced version of \Macro\setlength\relax (called \Macro\adjsetlength) which uses either $\epsilon$-\TeX\
600 % expressions (default), the \pkg{calc} package (default fall-back) or the \Macro\pgfmathparse of the \pkg{pgf} package.
601 % This allows for arithmetic expressions in these arguments. See the package options in \autoref{sec:options} to learn
602 % how to change the used length parser. Note that early versions of this package used \Macro\pgfmathparse by default.
603 % Older documents therefore might need now use the \opt{pgfmath} option to compile correctly.
604 %
605 % Note that the four values for \Macro\trimbox and \Macro\clipbox as well as for the
606 % \Key{trim} and \Key{viewport} option of \Macro\adjustbox are separated by spaces. If the expression of any of this
607 % values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces "{ }".
608 %
609 %
610 % \DescribeMacros
611 % \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}%
612 % \endDescribeMacros
613 % These \LaTeX{} lengths hold the current dimensions of the content and can be used as part all length arguments. When
614 % the size of the content is changed by a key these lengths will be adjusted to hold the new size for all further keys.
615 % The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for
616 % \Macro\includegraphics.
617 %
618 % \DescribeMacros
619 % \hbox{\Macro\Width~~~\Macro\Height~~~\Macro\Depth~~~\Macro\Totalheight}%
620 % \endDescribeMacros
621 % These \LaTeX{} lengths hold the original dimension of original unchanged content and are not modified. They are
622 % useful if the size of the content is modified by several keys, but further keys should still work relative to the
623 % original content.
624 %
625 %
626 % \DescribeMacro\smallestside
627 % This macro expands to either \Macro\width or \Macro\totalheight whatever is smaller.
628 %
629 % \DescribeMacro\largestside
630 % This macro expands to either \Macro\width or \Macro\totalheight whatever is larger.
631 %
632 % \DescribeMacro\Smallestside
633 % This macro expands to either \Macro\Width or \Macro\Totalheight whatever is smaller.
634 %
635 % \DescribeMacro\Largestside
636 % This macro expands to either \Macro\Width or \Macro\Totalheight whatever is larger.
637 %
638 %
639 % \subsubsection*{Default unit}
640 % If no unit is provided for of the bounding box coordinates (left, bottom, right, top) in the trim and clip features then
641 % PostScript points (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour of
642 % the \Key{trim} and \Key{viewport} options of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx}
643 % converts all values, independent if a unit is provided or not, internally to bp, because graphics where traditionally
644 % stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt. Because the
645 % \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion
646 % to bp got disabled for them to avoid unnecessary rounding errors. Since v0.5 the default unit can be changed using the
647 % |defaultunit|\MacroArgs'='<unit>\relax key (which is also usable as global package option).
648 %
649 % ^^A )))2
650 % ^^A )))
651 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
652 % \clearpage\section{Adjustbox Keys} ^^A (((
653 % This packages provides the following \Macro\adjustbox keys with matching macros and environments.
654 %
655 %
656 % \subsection{Trimming and Clipping} ^^A (((2
657 % The following keys allow content to be trimmed (i.e.\ the official size is made smaller, so the remaining material
658 % laps over the official boundaries) or clipped (overlapping material is not displayed).
659 % These keys come in different variants, where the lower-case keys represent the behavior of
660 % the corresponding \Macro\includegraphics keys. The corresponding macros (\Macro\trimbox, \Macro\clipbox, etc.)
661 % and environments (\env{trimbox}, \env{clipbox}, etc.) are included in the
662 % accompanying \pkg{trimclip} package and are explained in its manual.
663 %
664 % \DescribeKey{trim}'='<all sites>
665 % \DescribeKey{trim}'='<left/right>~<top/bottom>
666 % \DescribeKey{trim}'='<left>~<bottom>~<right>~<top>
667 % This key represents the original \Key{trim} key of \Macro\includegraphics but accepts its value in different forms.
668 % Unlike most other keys it always acts on the original content independent in which order it is used with other keys.
669 % If only one value is given it will be used for all four sites.
670 % If only two values are given, seperated by a space, the first one will be used for the left and right side and the second for the
671 % bottom and top side.
672 %
673 %
674 % \DescribeKey{viewport}'='<left>~<bottom>~<right>~<top>
675 % This key represents the original \Key{viewport} key of \Macro\includegraphics.
676 % It always trims the original content to the given view port independent from its position.
677 %
678 % \DescribeKey{clip}
679 % \DescribeKey{clip}'=true|false'
680 % This boolean key represents the original \Key{clip} key of \Macro\includegraphics.
681 % It is intended to be used to make \Key{trim} or \Key{viewport} clip the trimmed material.
682 % Note that the material will still be part of the output file but is simply not shown.
683 % It might be exported from the output file using special tools, so using it to censor classified information is a
684 % bad idea.
685 %
686 %
687 % \DescribeKey{Trim}'='<all sites>
688 % \DescribeKey{Trim}'='<left/right>~<top/bottom>
689 % \DescribeKey{Trim}'='<left>~<bottom>~<right>~<top>
690 % \DescribeKey{Viewport}'='<left>~<bottom>~<right>~<top>
691 % The normal \Key{trim} and \Key{viewport} keys are applied on the original content before any resizing or (most) other
692 % keys take effect. This is because for \Macro\includegraphics the trimming is done by the internal graphic driver,
693 % while the effects can be applied later (but can also be driver dependent).
694 % If the \Key{trim} and \Key{viewport} keys are used multiple times only the last values will be used for the trimming,
695 % i.e. the content is only trimmed once. The upper case variants \Key{Trim} and \Key{Viewport} will wrap the content
696 % internally in a \Macro\trimbox or \Macro\trimbox*\relax macro which can be applied multiple times, e.g.\ before and
697 % after the content is rotated. These two keys awaits the same format as the original keys. However, the \Key{clip} key
698 % has no effect on them.
699 %
700 %
701 % \DescribeKey{Clip}'='<all sites>
702 % \DescribeKey{Clip}'='<left/right>~<top/bottom>
703 % \DescribeKey{Clip}'='<left>~<bottom>~<right>~<top>
704 % \DescribeKey{Clip*}'='<left>~<bottom>~<right>~<top>
705 % The \Key{Clip} key will clip the given amounts from the current content and can be used several times if required.
706 % The starred version will use the given coordinates as \Key{viewport}.
707 % These keys work by wrapping the content internally in a \Macro\clipbox or \Macro\clipbox*\relax macro.
708 %
709 %
710 % \DescribeKey{rndcorners}'='<radius for all four corners>
711 % \DescribeKey{rndcorners}'='<left corners>~<right corners>
712 % \DescribeKey{rndcorners}'='<upper left>~<upper right>~<lower left>~<lower right>
713 % This key produces round corners by clipping the content. This is done using the same way as the
714 % above clipping keys but instead of a rectangle clipping path one with quarter circles is used.
715 % The radius of the every round corner can be given separately if wanted. If only one value is given
716 % it is used for all four corners. If only two values are given they will be used for the left and right side, respectively.
717 % A value of 0pt will produce a normal rectangular corner.
718 % No radius should be larger than half the smallest side (minimum of \Macro\width and \Macro\totalheight).
719 %
720 % Please see also the related keys \Key{rndfbox} and \Key{rndframe}, which allow to add a rounded frame around the content as well.
721 %
722 %
723 % ^^A )))2
724 % \clearpage\subsection{Margins and Vertical Spacing} ^^A (((2
725 % \vspace{-\baselineskip}
726 %
727 % \DescribeKey{margin}'='<all sites>
728 % \DescribeKey{margin}'='<left/right>~<top/bottom>
729 % \DescribeKey{margin}'='<left>~<bottom>~<right>~<top>
730 % This key can be used to add a margin (white space) around the content. It can be seen as the opposite of \Key{Trim}.
731 % The original baseline of the content is preserved because \meta{bottom} is added to the depth.
732 % It is also available under the alternative name \Key{padding}, which can be used to more visually distinguish an inner
733 % margin from an outer margin e.g.\ if a frame is added.
734 %
735 % \begin{example}
736 % \begin{examplecode}
737 % Before \adjustbox{padding=1ex 2ex 3ex 4ex,frame,margin=1ex 2ex 3ex 4ex}{Text} After
738 % \end{examplecode}
739 % \end{example}
740 %
741 % \DescribeKey{margin*}'='<all sites>
742 % \DescribeKey{margin*}'='<left/right>~<top/bottom>
743 % \DescribeKey{margin*}'='<left>~<bottom>~<right>~<top>
744 % This starred version is almost identical to the normal \Key{margin} key, but also raises the content by the \MacroArgs<bottom>
745 % amount, so that the original depth is preserved instead of the original baseline.
746 % Note that while \Key{margin} is basically the opposite of \Key{Trim}, \Key{margin*} is not the opposite of \Key{Trim*}.
747 % Instead it also takes the same values as the unstarred key and not viewport values like \Key{Trim*}.
748 % An alternative name of \Key{margin*} is \Key{padding*}.
749 %
750 % \begin{example}
751 % \begin{examplecode}
752 % Before \adjustbox{padding*=1ex 2ex 3ex 4ex,frame,margin*=1ex 2ex 3ex 4ex}{Text} After
753 % \end{examplecode}
754 % \end{example}
755 %
756 %
757 % \DescribeKey{vspace}'='<above/below>
758 % \DescribeKey{vspace}'='<above>~<below>
759 % The \Key{vspace} key adds a vertical space before and after the content.
760 % This is done by adding paragraph breaks and \Macro\vspace macros, which will yield better spacing between
761 % paragraphs then when using the \Key{margin} key.
762 % However \Key{vspace} forces vertical mode around the content. Adding further keys after \Key{vspace} will force
763 % restricted horizontal mode again and the vertical space will be ignored. For this situation the \Key{margin} key is
764 % better suited.
765 %
766 % \DescribeKey{vspace*}'='<above/below>
767 % \DescribeKey{vspace*}'='<above>~<below>
768 % Identical to \Key{vspace} but uses \Macro\vspace'*' instead.
769 % The difference is that the vertical space is not ignored at page breaks, but its full amount is always forced.
770 %
771 %
772 % ^^A )))2
773 % \clearpage\subsection{Minimum and Maximum Size} ^^A (((2
774 % The following keys allow to set a minimum or maximum size.
775 % The content will be scaled down or up if required.
776 %
777 %
778 % \DescribeKey{min width}'='<width>
779 % \DescribeKey{max width}'='<width>
780 % \DescribeKey{min height}'='<height>
781 % \DescribeKey{max height}'='<height>
782 % \DescribeKey{min totalheight}'='<total height>
783 % \DescribeKey{max totalheight}'='<total height>
784 % These keys allow to set the minimum and maximum width, height or totalheight of the content.
785 % The current size of the content is measured and the content is resized if the constraint is not already met,
786 % otherwise the content is unchanged. Multiple usages of these keys are checked one after each other, and therefore
787 % it is possible that a later one is undoing the size changes of an earlier one.
788 % A good example is \Key{max width}'='\AlsoMacro\textwidth which will limit large content to the text width but will not affect smaller
789 % content.
790 %
791 % \DescribeKey{min size}'='{<width>}{<height>}
792 % \DescribeKey{max size}'='{<width>}{<height>}
793 % \DescribeKey{min totalsize}'='{<width>}{<total height>}
794 % \DescribeKey{max totalsize}'='{<width>}{<total height>}
795 % These keys allow to specify the minimum or maximum width and (total)height of the content together,
796 % which is more efficient than using the width and (total)height keys described earlier.
797 %
798 %
799 %
800 % \DescribeMacro\minsizebox{<width>}{<height>}{<content>}
801 % \DescribeMacro\minsizebox'*'{<width>}{<totalheight>}{<content>}
802 % This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is smaller
803 % than the given \meta{width} or \meta{height}.
804 % If only one value should be set the other one can be replaced by "!".
805 % 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
806 % the aspect ratio.
807 % The star variant uses the total height instead of only the height.
808 % This macro is used internally for the \Key{min width}, \Key{min height}, \Key{min totalheight} and \Key{min totalsize} keys.
809 %
810 % \begin{examples}
811 % \begin{examplecode}
812 % \minsizebox{3cm}{2ex}{Some Text} which will be enlarged
813 % \end{examplecode}
814 % \begin{examplecode}
815 % \minsizebox{!}{4ex}{\fbox{Some Text}} which will be enlarged
816 % \end{examplecode}
817 % \begin{examplecode}
818 % \minsizebox*{!}{4ex}{\fbox{Some Text}} which will be enlarged
819 % \end{examplecode}
820 % \begin{examplecode}
821 % \minsizebox{3cm}{!}{Some Text} which will be enlarged
822 % \end{examplecode}
823 % \begin{examplecode}
824 % \minsizebox{1cm}{1ex}{Some Text}, already large enough
825 % \end{examplecode}
826 % \end{examples}
827 %
828 %
829 % \DescribeMacro\maxsizebox{<width>}{<height>}{<content>}
830 % \DescribeMacro\maxsizebox'*'{<width>}{<totalheight>}{<content>}
831 % This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is larger
832 % than the given \meta{width} or \meta{height}.
833 % If only one value should be set the other one can be replaced by "!".
834 % 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
835 % the aspect ratio.
836 % The star variant uses the total height instead of only the height.
837 % This macro is used internally for the \Key{max width}, \Key{max height}, \Key{max totalheight} and \Key{max totalsize} keys.
838 %
839 % \begin{examples}
840 % \begin{examplecode}
841 % \maxsizebox{1cm}{1ex}{Some Text} which will be reduced
842 % \end{examplecode}
843 % \begin{examplecode}
844 % \maxsizebox{!}{1ex}{\fbox{Some Text}} which will be reduced
845 % \end{examplecode}
846 % \begin{examplecode}
847 % \maxsizebox*{!}{1ex}{\fbox{Some Text}} which will be reduced
848 % \end{examplecode}
849 % \begin{examplecode}
850 % \maxsizebox{1cm}{!}{Some Text} which will be reduced
851 % \end{examplecode}
852 % \begin{examplecode}
853 % \maxsizebox{3cm}{1cm}{Some Text}, already small enough
854 % \end{examplecode}
855 % \end{examples}
856 %
857 %
858 % \DescribeKey{warn width}
859 % \DescribeKey{warn width}=<max width>
860 % If this key is used the current width of the content is measured and compared with the given maximum width (default is
861 % \Macro\linewidth).
862 % If the content is wider than this value by more than the \TeX\ length \Macro\hfuzz\relax (by default 0.1pt)
863 % an \emph{Overfull hbox} warning is produced.
864 % The warning will include the source code position and the information that it was an |adjustbox| not a normal
865 % paragraph:
866 % \par\smallskip\par
867 % {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at line N}
868 %
869 % {\ttfamily Overfull |\hbox| (X.Ypt too wide) in adjustbox at lines N-M}
870 % \par\smallskip\par\noindent
871 % Note that this key is not able to take any horizontal space before the |adjustbox|
872 % into account. This includes a paragraph indention which might be present with \Macro\adjustbox.
873 %
874 % This key is useful to be used before the horizontal alignment keys which change the official width of the content
875 % and prevent the normal \emph{Overfull} warnings to take affect.
876 %
877 %
878 % ^^A )))2
879 % \Needspace*{8\baselineskip}
880 % \clearpage\subsection{Scaling} ^^A (((2
881 % \vspace{-\baselineskip}
882 %
883 % \DescribeKey{scale}'='<factor>
884 % \DescribeKey{scale}'='{<h-factor>}{<v-factor>}
885 % The normal \Key{scale} key of \pkg{graphicx} only allows for one scale factor which is used for both the horizontal and vertical scaling.
886 % With \pkg{adjustbox} it is also possible to provide the horizontal and vertical scale factors separately.
887 %
888 % \begin{examples}
889 % \begin{examplecode}
890 % \adjustbox{scale=2}{Some text!}
891 % \end{examplecode}
892 % \begin{examplecode}
893 % \adjustbox{scale={2}{1}}{Some text!}
894 % \end{examplecode}
895 % \end{examples}
896 %
897 %
898 % \DescribeKey{reflect}
899 % This key reflects the content by using \Macro\reflectbox internally, which is identical to \Macro\scalebox{-1}[1],
900 % i.e.\ this key is identical to \Key{scale}'='{-1}{1}.
901 %
902 % \begin{examples}
903 % \begin{examplecode}
904 % \adjustbox{reflect}{Some text!}
905 % \end{examplecode}
906 % \end{examples}
907 %
908 %
909 % \DescribeMacro\scalebox{<h-factor>}[<v-factor>]{<content>}
910 % \DescribeMacro\reflectbox{<content>}
911 % These macros is provided by the loaded \pkg{graphicx} package and only mentioned here for the sake of completeness.
912 % See the |grfguide| for more details.
913 %
914 %
915 % ^^A )))2
916 % \clearpage\subsection{Frame} ^^A (((2
917 % The following keys can be used to draw frames around the content.
918 %
919 % \DescribeKey{fbox}
920 % \DescribeKey{fbox}'='<rule width>
921 % \DescribeKey{fbox}'='<rule width>~<sep>
922 % \DescribeKey{fbox}'='<rule width>~<sep>~<margin>
923 % Draws a framed box around the content like \Macro\fbox would do.
924 % Using the optional space separated values the rule width, the separation (inner padding) and the outer margin can be set.
925 % If not they default to the values \Macro\fbox uses by default: \Macro\fboxrule, \Macro\fboxsep and zero margin.
926 %
927 % \begin{examples}
928 % \begin{examplecode}
929 % \adjustbox{fbox}{Like \cs{fbox}}
930 % \end{examplecode}
931 % \begin{examplecode}
932 % \adjustbox{fbox=1pt}{With 1pt rule width}
933 % \end{examplecode}
934 % \begin{examplecode}
935 % \adjustbox{fbox=1pt 2pt}{With 1pt rule width and 2pt separation}
936 % \end{examplecode}
937 % \begin{examplecode}
938 % \adjustbox{fbox={\fboxrule} 1pt}{With normal rule width and 1pt separation}
939 % \end{examplecode}
940 % \begin{examplecode}
941 % \adjustbox{fbox=1pt 1pt 1pt}{With 1pt for rule width, separation and outer margin}
942 % \end{examplecode}
943 % \end{examples}
944 %
945 %
946 % \DescribeKey{frame}
947 % \DescribeKey{frame}'='<rule width>
948 % \DescribeKey{frame}'='<rule width>~<sep>
949 % \DescribeKey{frame}'='<rule width>~<sep>~<margin>
950 % The \Key{frame} key has the same effect as the \Key{fbox} key but is modeled after \LaTeX's \Macro\frame macro (not the version \cls{beamer} defines).
951 % This means it adds a tight frame with zero separation around the content by default. Besides that it accepts the same space separated values.
952 % This key is useful to easily add a tight frame around images where the normal separation wouldn't fit.
953 %
954 % \begin{examples}
955 % \begin{examplecode}
956 % \adjustbox{frame}{Tight box}
957 % \end{examplecode}
958 % \end{examples}
959 %
960 %
961 % \DescribeKey{cfbox}'='<color>
962 % \DescribeKey{cfbox}'='<color>~<rule width>
963 % \DescribeKey{cfbox}'='<color>~<rule width>~<sep>
964 % \DescribeKey{cfbox}'='<color>~<rule width>~<sep>~<margin>
965 % Identical to \Key{fbox} but uses the given color for the frame.
966 % The \pkg{xcolor} package must be loaded manually in order for this key to work.
967 % \begin{example}
968 % \begin{examplecode}
969 % \adjustbox{cfbox=blue 1pt}{Like a blue \cs{fbox} with \cs{fboxrule}=1pt}
970 % \end{examplecode}
971 % \end{example}
972 %
973 %
974 % \DescribeKey{cframe}'='<color>
975 % \DescribeKey{cframe}'='<color>~<rule width>
976 % \DescribeKey{cframe}'='<color>~<rule width>~<sep>
977 % \DescribeKey{cframe}'='<color>~<rule width>~<sep>~<margin>
978 % Identical to \Key{frame} but uses the given color for the frame.
979 % The \pkg{xcolor} package must be loaded manually in order for this key to work.
980 % \begin{example}
981 % \begin{examplecode}
982 % \adjustbox{cframe=blue!50!green}
983 % {Like a blue and green \cs{frame}}
984 % \end{examplecode}
985 % \end{example}
986 %
987 %
988 % \DescribeKey{rndframe}'='<radius for all four corners>
989 % \DescribeKey{rndframe}'='<left corners>~<right corners>
990 % \DescribeKey{rndframe}'='<upper left>~<upper right>~<lower left>~<lower right>
991 % \DescribeKey{rndframe}'='{<options>}{<radius for all four corners>}
992 % \DescribeKey{rndframe}'='{<options>}{<left corners>~<right corners>}
993 % \DescribeKey{rndframe}'='{<options>}{<upper left>~<upper right>~<lower left>~<lower right>}
994 %
995 % \begingroup
996 % \colorlet{keydesc}{keydesc!50!green}
997 % \DescribeKey{color}'='{<color>}
998 % \DescribeKey{color*}'='{<color command>}
999 % \DescribeKey{width}'='{<rule width>}
1000 % \DescribeKey{sep}'='{<rule separation>}
1001 %
1002 % \DescribeKey{clip}
1003 % \DescribeKey{clip}'=true|false'
1004 % \endgroup
1005 %
1006 % \begin{example}
1007 % \begin{examplecode}
1008 % \adjustbox{scale=3,bgcolor=gray,rndframe={color=red,width=2\fboxrule,sep=2\fboxsep}{15pt}}
1009 % {\Huge XXXX}%
1010 % \end{examplecode}
1011 % \end{example}
1012 %
1013 % \DescribeKey{rndcornersbox}
1014 % Like \Key{rndframe} (see argument list there) but only clips the corners without drawing a frame.
1015 %
1016 % \DescribeKey{rndfbox}
1017 % Like \Key{rndframe} (see argument list there) but with preset
1018 % \begingroup
1019 % \colorlet{keydesc}{keydesc!50!green}
1020 % \Key{sep}'='0pt.
1021 % \endgroup
1022 %
1023 % \DescribeMacro\rndcornersbox
1024 % \DescribeMacro\rndframebox
1025 % \DescribeMacro\rndfbox
1026 % Standalone macro versions of the corresponding keys. See there for the list of arguments.
1027 %
1028 % ^^A )))2
1029 % \clearpage\subsection{Vertical Alignment} ^^A (((2
1030 % The following keys can be used to adjust the vertical alignment and size of the content.
1031 %
1032 % \DescribeKey{valign}'='<letter>
1033 % This key allows to vertically align the content to the top, middle and bottom. The uppercase letters |T|, |M| and |B|
1034 % align to the content top (i.e. all depth, no height), the geometric, vertical center (equal height and depth) and to
1035 % the bottom (all height, no depth), respectively. This allows the alignment of content of different size, but will not
1036 % result in good alignment with text. The lowercase letters |t|, |m| and |b| are aligning the content again to the top,
1037 % center and bottom but take the current text size in account.
1038 % The |t| letter leaves a certain height given by the macro\footnote{A macro and not a length is used to allow for
1039 % font size relative values like \texttt{1ex}.} \Macro\adjboxvtop\relax
1040 % (by default set to the height of \Macro\strut\relax, i.e.\ |\ht\strutbox|, which is |.7\baselineskip|),
1041 % while |b| sets a certain depth given (as negative length) by the macro \Macro\adjboxvbottom\relax
1042 % (by default equal to the (negated) \Macro\strut depth, i.e.\ |-\dp\strutbox|, which is |.3\baselineskip|).
1043 % The |m| letter will center towards the vertical center of the text line which is determined by the macro
1044 % \Macro\adjboxvcenter\relax (by default \texttt{1ex}).
1045 %
1046 % The following table shows the different alignments for three different sized blocks:
1047 %
1048 % \bigskip
1049 % \begingroup
1050 % \def\vr{%
1051 % \unskip
1052 % \tikz [gray] {\useasboundingbox (0,0);
1053 % \draw (-13.5em,0) -- (2.25em,0);
1054 % \draw (-13.5em,\adjboxvcenter) -- (2.25em,\adjboxvcenter);
1055 % }%
1056 % \unskip\ignorespaces
1057 % }%
1058 % \centerline{%
1059 % \begin{tabular}{cccm{2em}}
1060 % \toprule
1061 % \texttt{T} & \texttt{M} & \texttt{B} & Text \\
1062 % \adjustbox{valign=T}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1063 % \adjustbox{valign=T}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1064 % \adjustbox{valign=T}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1065 % \adjustbox{valign=M}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1066 % \adjustbox{valign=M}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1067 % \adjustbox{valign=M}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1068 % \adjustbox{valign=B}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1069 % \adjustbox{valign=B}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1070 % \adjustbox{valign=B}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1071 % Mxy \newline \mbox{\vr Mxy}\newline Mxy \\
1072 % \midrule
1073 % \texttt{t} & \texttt{m} & \texttt{b} & Text \\
1074 % \adjustbox{valign=t}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1075 % \adjustbox{valign=t}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1076 % \adjustbox{valign=t}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1077 % \adjustbox{valign=m}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1078 % \adjustbox{valign=m}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1079 % \adjustbox{valign=m}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1080 % \adjustbox{valign=b}{\textcolor{red}{\rule{1em}{2em}\unskip}}\unskip
1081 % \adjustbox{valign=b}{\textcolor{green}{\rule{1em}{3em}\unskip}}\unskip
1082 % \adjustbox{valign=b}{\textcolor{blue}{\rule{1em}{1ex}\unskip}} &
1083 % Mxy \newline \mbox{\vr Mxy}\newline Mxy \\
1084 % \bottomrule
1085 % \end{tabular}}
1086 % \endgroup
1087 %
1088 %
1089 % \DescribeKey{raise}'='<amount>
1090 % \DescribeKey{raise}'='{<amount>}{<height>}
1091 % \DescribeKey{raise}'='{<amount>}{<height>}{<depth>}
1092 % This key uses
1093 % \Macro\raisebox{<amount>}{\ldots} to raise the content upwards for the given \meta{amount} (length).
1094 % A negative length moves the content down.
1095 % The two optional arguments of \Macro\raisebox{<amount>}[<height>][<depth>]{\ldots}\relax are also available
1096 % as optional brace arguments. They can be used to set the official height and depth of the content.
1097 % This is also possible using the \Key{set height} and \Key{set depth} keys.
1098 %
1099 % \begin{examples}
1100 % \begin{examplecode}
1101 % Is \adjustbox{raise=1ex}{higher}
1102 % than the normal text
1103 % \end{examplecode}
1104 % \begin{examplecode}
1105 % Is \adjustbox{raise={1ex}{\height}}{higher}
1106 % than the normal text but sill has
1107 % its original official height
1108 % \end{examplecode}
1109 % \begin{examplecode}
1110 % Is \adjustbox{raise={1ex}{1ex}{0pt}}{higher and
1111 % \rotatebox{-90}{deeper}} but with limited official
1112 % height and no depth.
1113 % \end{examplecode}
1114 % \end{examples}
1115 %
1116 %
1117 % \DescribeKey{set height}'='<height>
1118 % This sets the official height of the content without actual changing it. This can be seen as a form of trimming.
1119 % It uses the same internal code as\\
1120 % \Macro\raisebox{'0pt'}[<height>]{<content>}.
1121 %
1122 % \begin{example}
1123 % \begin{examplecode}
1124 % \adjustbox{set height=.5\height}
1125 % {\shortstack{some stacked\\content}}
1126 % \end{examplecode}
1127 % \end{example}
1128 %
1129 % \DescribeKey{set depth}'='<depth>
1130 % This sets the official depth of the content without actual changing it. This can be seen as a form of trimming.
1131 % It uses the same internal code as\\
1132 % \Macro\raisebox{'0pt'}['\height'][<depth>]{<content>}.
1133 %
1134 % \begin{example}
1135 % \begin{examplecode}
1136 % \adjustbox{set depth=0pt}
1137 % {\shortstack{some stacked\\content
1138 % with \raisebox{-1ex}{depth}}}
1139 % \end{examplecode}
1140 % \end{example}
1141 %
1142 % \DescribeKey{set vsize}'='{<height>}{<depth>}
1143 % This sets the official height of depth of the content without actual changing it.
1144 % This key is simply the combination of \Key{set height} and \Key{set depth}.
1145 %
1146 % \begin{example}
1147 % \begin{examplecode}
1148 % \adjustbox{set vsize={2pt}{1pt}}
1149 % {\shortstack{some stacked\\content
1150 % with \raisebox{-1ex}{depth}}}
1151 % \end{examplecode}
1152 % \end{example}
1153 %
1154 %
1155 % ^^A )))2
1156 % \clearpage\subsection{Horizontal Alignment} ^^A (((2
1157 % The following keys can be used to adjust the horizontal alignment and size of the content.
1158 %
1159 % \DescribeKey{center}
1160 % \DescribeKey{center}'='<width>
1161 % This key places
1162 % the content in a horizontal box which is by default \Macro\linewidth wide (i.e.\ as wide as a normal text paragraph)
1163 % and centers it in it. The effect is very similar to \Macro\centerline. The original content is unchanged, but simply identical
1164 % white space is added as a left and right margin. This is useful if the content is a figure or table and can be used as a replacement
1165 % for \Macro\centering. One important difference is that the content will then have the given width which might influence (sub-)caption
1166 % placement.
1167 % If the content is wider than the available width it will stick out on both sides equally without causing an overfull hbox warning.
1168 % Note that when \Macro\adjustbox paragraph is used at the beginning of a paragraph the normal paragraph indention is added, which
1169 % will push the while box to the right and might cause an overfull line. In such cases a \Macro\noindent must be added beforehand.
1170 % The \env{adjustbox} environment already uses this macro.
1171 %
1172 % \begin{examples}
1173 % \begin{examplecode}
1174 % \adjustbox{center}{Some content}
1175 % \end{examplecode}
1176 % \begin{examplecode}
1177 % \adjustbox{center=5cm}{Some content}
1178 % \end{examplecode}
1179 % \end{examples}
1180 %
1181 %
1182 % \DescribeKey{right}
1183 % \DescribeKey{right}'='<width>
1184 % Like \Key{center} this key
1185 % places the content in a box with the given width (by default \Macro\linewidth) but right aligns it.
1186 % If the content is wider than the available width it will stick out into the left side without causing an overfull hbox warning.
1187 %
1188 % \begin{examples}
1189 % \begin{examplecode}
1190 % \adjustbox{right}{Some content}
1191 % \end{examplecode}
1192 % \begin{examplecode}
1193 % \adjustbox{right=5cm}{Some content}
1194 % \end{examplecode}
1195 % \end{examples}
1196 %
1197 %
1198 % \DescribeKey{left}
1199 % \DescribeKey{left}'='<width>
1200 % Like \Key{center} this key
1201 % places the content in a box with the given width (by default \Macro\linewidth) but left aligns it.
1202 % If the content is wider than the available width it will stick out into the right side without causing an overfull hbox warning.
1203 %
1204 % \begin{examples}
1205 % \begin{examplecode}
1206 % \adjustbox{left}{Some content}
1207 % \end{examplecode}
1208 % \begin{examplecode}
1209 % \adjustbox{left=5cm}{Some content}
1210 % \end{examplecode}
1211 % \end{examples}
1212 %
1213 %
1214 % \DescribeKey{inner}
1215 % \DescribeKey{inner}'='<width>
1216 % Like \Key{center}, \Key{left} and \Key{right} this key
1217 % places the content in a box with the given width (by default \Macro\linewidth) but aligns it towards the inner margin.
1218 % If the content is wider than the available width it will stick into the outer margin without causing an overfull hbox warning.
1219 % In |twoside| mode this key is equal to \Key{left} for odd pages and equal to \Key{right} for even pages.
1220 % For |oneside| mode it is equal to \Key{left}.
1221 % Note that the page-is-odd test might not always lead to correct results for some material close to a page boundary, because \TeX\
1222 % might not have decided on which page it will be placed. This can be improved by loading the \pkg{changepage} package with the
1223 % \opt{strict} option, which uses a reference to determine the correct page number (and requires the usual additional compiler run).
1224 %
1225 %
1226 % \DescribeKey{outer}
1227 % \DescribeKey{outer}'='<width>
1228 % Identical to \Key{inner} but aligns the content towards the outer margin.
1229 % For |oneside| mode it is equal to \Key{right}.
1230 % If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning.
1231 %
1232 %
1233 % \DescribeKey{pagecenter}
1234 % \DescribeKey{pagecenter}'='<width>
1235 % This key centers the content relative to the page and independent from the text area. Afterwards the content has the same distance to the
1236 % left and right page borders. It differs from the \Key{center} key when the left and right page margins are different which is the case in
1237 % |twoside| documents or in environments which change the margins.
1238 %
1239 % Note that the content will look misalign to the text paragraphs before and afterwards and is therefore only
1240 % pleasing for overwide images or similar content.
1241 %
1242 % The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected
1243 % following material will be placed on the same line while maybe overlapping the content.
1244 % Larger values will cause an |Overfull \hbox| warning.
1245 %
1246 % \DescribeKey{pageleftalign}
1247 % \DescribeKey{pageleftalign}'='<width>
1248 % Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it.
1249 %
1250 % \DescribeKey{pagerightalign}
1251 % \DescribeKey{pagerightalign}'='<width>
1252 % Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it.
1253 %
1254 % \DescribeKey{pageinner}
1255 % \DescribeKey{pageinner}'='<width>
1256 % Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the inner side of the page instead of centering it.
1257 % This assumes that the document is compiled in |twoside| mode.
1258 % In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the page.
1259 %
1260 % \DescribeKey{pageouter}
1261 % \DescribeKey{pageouter}'='<width>
1262 % Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the outer side of the page instead of centering it.
1263 % This assumes that the document is compiled in |twoside| mode.
1264 % In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the page.
1265 %
1266 %
1267 % \DescribeKey{textareacenter}
1268 % \DescribeKey{textareacenter}'='<width>
1269 % This key centers the content on the text area (the box with size \Macro\textwidth$\times$\Macro\textheight containing the text on a page)
1270 % even if the box is inside an indending environment like \env{enumerate}. For this it is assumed that the adjusted box is on the start
1271 % of a line or paragraph. If this is not the case the content will be overlapping the material on its left side.
1272 %
1273 % The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected
1274 % following material will be placed on the same line while maybe overlapping the content.
1275 % Larger values will cause an |Overfull \hbox| warning.%
1276 %
1277 %
1278 % \DescribeKey{textareatalign}
1279 % \DescribeKey{textareatalign}'='<width>
1280 % Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it.
1281 %
1282 % \DescribeKey{textareatalign}
1283 % \DescribeKey{textareatalign}'='<width>
1284 % Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it.
1285 %
1286 % \DescribeKey{textareainner}
1287 % \DescribeKey{textareainner}'='<width>
1288 % Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the inner side of the text area instead of centering it.
1289 % This assumes that the document is compiled in |twoside| mode.
1290 % In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the text area.
1291 %
1292 % \DescribeKey{textareaouter}
1293 % \DescribeKey{textareaouter}'='<width>
1294 % Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the outer side of the text area instead of centering it.
1295 % This assumes that the document is compiled in |twoside| mode.
1296 % In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the text area.
1297 %
1298 %
1299 %
1300 % \DescribeKey{noindent}
1301 % This key will issue an \Macro\noindent for the \Macro\adjustbox to avoid a paragraph indention if it starts a paragraph.
1302 % It does not expect a value and will ignore it if provided.
1303 %
1304 %
1305 % \DescribeKey{leavevmode}
1306 % This key will issue an \Macro\leavevmode for the \Macro\adjustbox to enter paragraph mode, i.e.\ it starts a paragraph.
1307 % This is usually done automatically by all Keys, but is provided as a failsafe in case of any bugs.
1308 %
1309 %
1310 % \DescribeMacro\centerbox[<width>]{<content>}
1311 % \vspace{-1.5\baselineskip}\nopagebreak
1312 % \DescribeEnv[<content>]{centerbox}[<width>]
1313 % Macro and environment version of the \Key{center} key. The optional width argument defaults to \Macro\linewidth.
1314 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1315 % placing a |\mbox{}| or the identical |\null| macro before it.
1316 %
1317 %
1318 % \DescribeMacro\leftalignbox[<width>]{<content>}
1319 % \vspace{-1.5\baselineskip}\nopagebreak
1320 % \DescribeEnv[<content>]{leftalignbox}[<width>]
1321 % Macro and environment version of the \Key{left} key. The optional width argument defaults to \Macro\linewidth.
1322 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1323 % placing a |\mbox{}| or the identical |\null| macro before it.
1324 %
1325 %
1326 % \DescribeMacro\rightalignbox[<width>]{<content>}
1327 % \vspace{-1.5\baselineskip}\nopagebreak
1328 % \DescribeEnv[<content>]{rightalignbox}[<width>]
1329 % Macro and environment version of the \Key{rightalign} key. The optional width argument defaults to \Macro\linewidth.
1330 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1331 % placing a |\mbox{}| or the identical |\null| macro before it.
1332 %
1333 %
1334 % \DescribeMacro\innersidebox[<width>]{<content>}
1335 % \vspace{-1.5\baselineskip}\nopagebreak
1336 % \DescribeEnv[<content>]{innersidebox}[<width>]
1337 % Macro and environment version of the \Key{inner} key. The optional width argument defaults to \Macro\linewidth.
1338 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1339 % placing a |\mbox{}| or the identical |\null| macro before it.
1340 %
1341 %
1342 % \DescribeMacro\outersidebox[<width>]{<content>}
1343 % \vspace{-1.5\baselineskip}\nopagebreak
1344 % \DescribeEnv[<content>]{outersidebox}[<width>]
1345 % Macro and environment version of the \Key{outer} key. The optional width argument defaults to \Macro\linewidth.
1346 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1347 % placing a |\mbox{}| or the identical |\null| macro before it.
1348 %
1349 %
1350 % \DescribeMacro\centerpagebox[<width>]{<content>}
1351 % \vspace{-1.5\baselineskip}\nopagebreak
1352 % \DescribeEnv[<content>]{centerpagebox}[<width>]
1353 % Macro and environment version of the \Key{centerpage} key. The optional width argument defaults to \Macro\linewidth.
1354 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1355 % placing a |\mbox{}| or the identical |\null| macro before it.
1356 %
1357 %
1358 % \DescribeMacro\pagecenterbox[<width>]{<content>}
1359 % \vspace{-1.5\baselineskip}\nopagebreak
1360 % \DescribeEnv[<content>]{pagecenterbox}[<width>]
1361 % Macro and environment version of the \Key{pagecenterbox} key. The optional width argument defaults to \Macro\linewidth.
1362 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1363 % placing a |\mbox{}| or the identical |\null| macro before it.
1364 %
1365 % \DescribeMacro\pageleftalignbox[<width>]{<content>}
1366 % \vspace{-1.5\baselineskip}\nopagebreak
1367 % \DescribeEnv[<content>]{pageleftalignbox}[<width>]
1368 % Macro and environment version of the \Key{pageleftalignbox} key. The optional width argument defaults to \Macro\linewidth.
1369 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1370 % placing a |\mbox{}| or the identical |\null| macro before it.
1371 %
1372 % \DescribeMacro\pagerightalignbox[<width>]{<content>}
1373 % \vspace{-1.5\baselineskip}\nopagebreak
1374 % \DescribeEnv[<content>]{pagerightalignbox}[<width>]
1375 % Macro and environment version of the \Key{pagerightalignbox} key. The optional width argument defaults to \Macro\linewidth.
1376 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1377 % placing a |\mbox{}| or the identical |\null| macro before it.
1378 %
1379 % \DescribeMacro\pageinnerbox[<width>]{<content>}
1380 % \vspace{-1.5\baselineskip}\nopagebreak
1381 % \DescribeEnv[<content>]{pageinnerbox}[<width>]
1382 % Macro and environment version of the \Key{pageinnerbox} key. The optional width argument defaults to \Macro\linewidth.
1383 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1384 % placing a |\mbox{}| or the identical |\null| macro before it.
1385 %
1386 % \DescribeMacro\pageouterbox[<width>]{<content>}
1387 % \vspace{-1.5\baselineskip}\nopagebreak
1388 % \DescribeEnv[<content>]{pageouterbox}[<width>]
1389 % Macro and environment version of the \Key{pageouterbox} key. The optional width argument defaults to \Macro\linewidth.
1390 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1391 % placing a |\mbox{}| or the identical |\null| macro before it.
1392 %
1393 % \DescribeMacro\textareacenterbox[<width>]{<content>}
1394 % \vspace{-1.5\baselineskip}\nopagebreak
1395 % \DescribeEnv[<content>]{textareacenterbox}[<width>]
1396 % Macro and environment version of the \Key{textareacenterbox} key. The optional width argument defaults to \Macro\linewidth.
1397 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1398 % placing a |\mbox{}| or the identical |\null| macro before it.
1399 %
1400 % \DescribeMacro\textareatalignbox[<width>]{<content>}
1401 % \vspace{-1.5\baselineskip}\nopagebreak
1402 % \DescribeEnv[<content>]{textareatalignbox}[<width>]
1403 % Macro and environment version of the \Key{textareatalignbox} key. The optional width argument defaults to \Macro\linewidth.
1404 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1405 % placing a |\mbox{}| or the identical |\null| macro before it.
1406 %
1407 % \DescribeMacro\textareatalignbox[<width>]{<content>}
1408 % \vspace{-1.5\baselineskip}\nopagebreak
1409 % \DescribeEnv[<content>]{textareatalignbox}[<width>]
1410 % Macro and environment version of the \Key{textareatalignbox} key. The optional width argument defaults to \Macro\linewidth.
1411 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1412 % placing a |\mbox{}| or the identical |\null| macro before it.
1413 %
1414 % \DescribeMacro\textareainnerbox[<width>]{<content>}
1415 % \vspace{-1.5\baselineskip}\nopagebreak
1416 % \DescribeEnv[<content>]{textareainnerbox}[<width>]
1417 % Macro and environment version of the \Key{textareainnerbox} key. The optional width argument defaults to \Macro\linewidth.
1418 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1419 % placing a |\mbox{}| or the identical |\null| macro before it.
1420 %
1421 % \DescribeMacro\textareaouterbox[<width>]{<content>}
1422 % \vspace{-1.5\baselineskip}\nopagebreak
1423 % \DescribeEnv[<content>]{textareaouterbox}[<width>]
1424 % Macro and environment version of the \Key{textareaouterbox} key. The optional width argument defaults to \Macro\linewidth.
1425 % Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by
1426 % placing a |\mbox{}| or the identical |\null| macro before it.
1427 %
1428 % \clearpage\subsection*{Lapping} ^^A (((3
1429 % The following features can be used to make the content lap over its left or right boundary. This is basically the same
1430 % as trimming, but provides a different, more dedicated interface.
1431 %
1432 %
1433 % \DescribeKey{lap}'='<lap amount>
1434 % \DescribeKey{lap}'='{<length>}{<lap amount>}
1435 % This key will make the content lap over the surrounding elements to the right or left by the given amount..
1436 % A positive amount will make the content lap over to the right
1437 % and a negative one to the left. The optional \meta{length} argument allows to set the final width.
1438 % If not used the resulting width will be the original width minus the absolute lap amount.
1439 % This key internally uses \Macro\lapbox{<lap amount>}{\ldots} and \Macro\lapbox[<length>]{<lap amount>}{\ldots}, respectively.
1440 %
1441 % \begin{examples}
1442 % \begin{examplecode}
1443 % \adjustbox{lap=.5\width}{Some content}
1444 % \end{examplecode}
1445 % \begin{examplecode}
1446 % \adjustbox{lap=-.5\width}{Some content}
1447 % \end{examplecode}
1448 % \begin{examplecode}
1449 % \adjustbox{lap=\width}{Some content}
1450 % \end{examplecode}
1451 % \begin{examplecode}
1452 % \adjustbox{lap=-\width}{Some content}
1453 % \end{examplecode}
1454 % \begin{examplecode}
1455 % \adjustbox{lap={\width}{\width}}{Some content}
1456 % \end{examplecode}
1457 % \begin{examplecode}
1458 % \adjustbox{lap={\width}{-\width}}{Some content}
1459 % \end{examplecode}
1460 % \end{examples}
1461 %
1462 %
1463 % \DescribeKey{rlap}
1464 % \DescribeKey{llap}
1465 % \DescribeKey{clap}
1466 % This makes the content to be officially 0pt wide and lap over to the right or left, respectively, like the \LaTeX\ macros \Macro\rlap, \Macro\llap and \Macro\clap do.
1467 % These are shortcuts for \Key{lap}'='\AlsoMacro\width, \Key{lap}'=-'\AlsoMacro\width and \Key{lap}'={0pt}{-0.5'\AlsoMacro\width'}', respectively.
1468 % The values for these keys are ignored and should not be used.
1469 %
1470 % \begin{examples}
1471 % \begin{examplecode}
1472 % \adjustbox{rlap}{Some content}
1473 % \end{examplecode}
1474 % \begin{examplecode}
1475 % \adjustbox{llap}{Some content}
1476 % \end{examplecode}
1477 % \begin{examplecode}
1478 % \adjustbox{clap}{Some content}
1479 % \end{examplecode}
1480 % \end{examples}
1481 %
1482 %
1483 % \DescribeMacro\lapbox[<width>]{<lap amount>}{<content>}
1484 % This macro is a generalisation of the \LaTeX\ core macros \Macro\rlap{<content>} and \Macro\llap{<content>} which lap the
1485 % text to the right or left without taking any official space. The \Macro\lapbox macro can be used to only partially lap
1486 % the content to the right (positive amount) or left (negative amount). As with all macros of this package the original width
1487 % can be references using \Macro\width. The resulting official width of the box is normally the original width minus the absolute
1488 % lap amount. However, it can also be set explicitly using the option argument.
1489 % It is also possible to use lap amount which absolute values are larger than the original width. In this case the resulting
1490 % official width will be zero by default and the content will padded with the required white space.
1491 % Note that the lap amount always states the distance between the right side of the official box and the right side of the actual
1492 % content for positive amounts or the distance between the left side of the official box and the left side of the actual content
1493 % for negative values.
1494 %
1495 % \begin{examples}
1496 % General lapping:
1497 % \begin{examplecode}
1498 % \lapbox{1cm}{Some Text}
1499 % \end{examplecode}
1500 % \vspace{-2\smallskipamount}%
1501 % \begin{examplecode}
1502 % \lapbox{-1cm}{Some Text}
1503 % \end{examplecode}
1504 % \vspace{-2\smallskipamount}%
1505 % \begin{examplecode}
1506 % \lapbox[4cm]{1cm}{Some Text}
1507 % \end{examplecode}
1508 % \vspace{-2\smallskipamount}%
1509 % \begin{examplecode}
1510 % \lapbox[3cm]{2cm}{Some Text}
1511 % \end{examplecode}
1512 % \vspace{\smallskipamount}%
1513 % Like \Macro\rlap:
1514 % \vspace{-\smallskipamount}%
1515 % \begin{examplecode}
1516 % \lapbox[0pt]{\width}{Some Text}
1517 % \end{examplecode}
1518 % \vspace{\smallskipamount}%
1519 % Like \Macro\llap:
1520 % \vspace{-\smallskipamount}%
1521 % \begin{examplecode}
1522 % \lapbox[0pt]{-\width}{Some Text}
1523 % \end{examplecode}
1524 % \vspace{\smallskipamount}%
1525 % A centering \Macro\clap macro can be achieved using:
1526 % \vspace{-\smallskipamount}%
1527 % \begin{examplecode}
1528 % \lapbox[0pt]{-.5\width}{Some Text}
1529 % \end{examplecode}
1530 % \vspace{-2\smallskipamount}%
1531 % \begin{examplecode}
1532 % \lapbox[0pt]{.5\width}{Some Text}
1533 % \end{examplecode}
1534 %
1535 % \end{examples}
1536 %
1537 %
1538 % ^^A )))3
1539 % ^^A )))2
1540 % \clearpage\subsection{Support for \pkg{graphicx} keys} ^^A (((2
1541 %
1542 % \DescribeKey{bbllx}'='<length>
1543 % \DescribeKey{bblly}'='<length>
1544 % \DescribeKey{bburx}'='<length>
1545 % \DescribeKey{bbury}'='<length>
1546 % \DescribeKey{decodearray}
1547 % \DescribeKey{intent}
1548 % \DescribeKey{interpolate}
1549 % \DescribeKey{maskarray}
1550 % \DescribeKey{natheight}'='<length>
1551 % \DescribeKey{natwidth}'='<length>
1552 % \DescribeKey{ocobjnum}
1553 % \DescribeKey{ocobjref}
1554 % \DescribeKey{page}'='<page numbers>
1555 % \DescribeKey{pagebox}
1556 % \DescribeKey{quiet}
1557 % \DescribeKey{resetcolor}
1558 % \DescribeKey{resolution}
1559 % \DescribeKey{xmpfile}
1560 % The above \pkg{graphicx} keys are also supported by \cs{adjustbox}. This is done by relying on the original
1561 % \pkg{graphicx} code, i.e. the key code is copied into the \pkg{adjustbox} namespace. These keys are therefore
1562 % mostly for use with images and might not work well with other content.
1563 % For more details on these keys see the \pkg{graphicx} manual.
1564 %
1565 % ^^A )))2
1566 % \clearpage\subsection{Colors} ^^A (((2
1567 % \vspace{-\baselineskip}
1568 %
1569 % \DescribeKey{color}'='<color>
1570 % \DescribeKey{color}'='{<model>}{<color>}
1571 % This key sets the color for all material. Both the content and further material added by other keys will be affected.
1572 % The color change is immediate and will occur before basically every other key takes effect.
1573 % The order in which this key is used is therefore meaningless.
1574 % Using this key several times will cause several color changes with the last one be used for the remaining material.
1575 % Note that \Key{color} will not influence any \Key{fgcolor} or \Key{bgcolor} beside the fact that it changes the
1576 % \emph{current color} accessible using the special name `|.|'.
1577 %
1578 % \DescribeKey{color*}'='<color macro>
1579 % Like \Key{color} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
1580 % See the \pkg{xcolor} manual for more details. A \Macro\blendcolors will affect both \Key{fgcolor} and \Key{bgcolor}.
1581 %
1582 %
1583 % \DescribeKey{fgcolor}'='<color>
1584 % \DescribeKey{fgcolor}'='{<model>}{<color>}
1585 % This key sets the color for the content.
1586 % The value is passed to an internal \Macro\color macro.
1587 % This is done using \Key{innercode} because the color must be set before the content is boxed.
1588 % Further material added using keys, e.g.\ a \Key{frame}, is not affected by this key.
1589 % The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded otherwise an error will be raised.
1590 %
1591 % \DescribeKey{fgcolor*}'='<color macro>
1592 % Like \Key{fgcolor} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
1593 % See the \pkg{xcolor} manual for more details.
1594 %
1595 %
1596 % \DescribeKey{bgcolor}'='<color>
1597 % \DescribeKey{bgcolor}'='{<model>}{<color>}
1598 % This key adds a colored background to the content. The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded
1599 % as well in order for this to work. The value is passed to an internal \Macro\color macro.
1600 % \begin{examples}
1601 % \begin{examplecode}
1602 % \adjustbox{bgcolor=blue}{Text with blue background.}
1603 % \end{examplecode}
1604 % \begin{examplecode}
1605 % \adjustbox{bgcolor={rgb}{0 0 1}}{Text with blue background in the RGB color model.}
1606 % \end{examplecode}
1607 % \begin{examplecode}
1608 % \adjustbox{margin=1ex,bgcolor=green}{green with a little more margin}
1609 % \end{examplecode}
1610 % \begin{examplecode}
1611 % \adjustbox{margin=1ex,bgcolor=green,margin=1pt,bgcolor=yellow}{Emulation of colored frame}
1612 % \end{examplecode}
1613 % \end{examples}
1614 %
1615 % \DescribeKey{bgcolor*}'='<color macro>
1616 % Like \Key{bgcolor} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors.
1617 % See the \pkg{xcolor} manual for more details.
1618 %
1619 % \begin{examples}
1620 % \begin{examplecode}
1621 % \color{blue}Blue text
1622 % \adjustbox{bgcolor*=\blendcolors{!10!yellow}\color{.}}{with a yellow-bluish background}
1623 % \end{examplecode}
1624 % \begin{examplecode}
1625 % \color{green}Green text
1626 % \adjustbox{bgcolor*=\blendcolors{!10!yellow}\color{.}}{with a yellow-greenish background}
1627 % \end{examplecode}
1628 % \end{examples}
1629 %
1630 % \DescribeMacro{\bgcolorbox}[<model>]{<color>}
1631 % \DescribeMacro{\bgcolorbox}*{<color macro>}
1632 % \vspace{-1.5\baselineskip}\nopagebreak
1633 % \DescribeEnv[<content>]{bgcolorbox}[<model>]{<color>}
1634 % \vspace{-1.5\baselineskip}\nopagebreak
1635 % \DescribeEnv[<content>]{bgcolorbox*}{<color macro>}
1636 % Standalone macro and environment versions of the \Key{bgcolorbox} and \Key{bgcolorbox*} keys.
1637 %
1638 %
1639 %
1640 % ^^A )))2
1641 % \clearpage\subsection{Background and Forground Images and Text} ^^A (((2
1642 % The following keys, macros and environment allow to add background and foreground layers.
1643 % These layers are placed on the baseline of the original content and are horizontally centered, but can be adjusted
1644 % using own \Macro\adjustbox or \Macro\includegraphics keys.
1645 % The following dimension registers can be used to refer to the dimensions of the original content.
1646 %
1647 % \DescribeMacros
1648 % \hbox{\Macro\pwidth~~~\Macro\pheight~~~\Macro\pdepth~~~\Macro\ptotalheight}%
1649 % \endDescribeMacros
1650 % These dimension registers hold the width, height, depth and total height (height+depth) of the parent box and can be used
1651 % to resize a background or foreground layer accordantly. They are only defined inside the key=value arguments of the
1652 % following keys, macros and environments.
1653 %
1654 % \DescribeKey{bgimage}'='<image filename>
1655 % \DescribeKey{bgimage}'='{<key=value pairs for image>}{<image filename>}
1656 % Adds a background image to the content. The image is stretched if required to fit exactly to the content.
1657 % It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done).
1658 % \begin{examples}
1659 % \begin{examplecode}
1660 % \adjustbox{bgimage=example-grid-100x100bp}{Some text}
1661 % \end{examplecode}
1662 % \end{examples}
1663 %
1664 % \DescribeKey{bgimage*}'='<image filename>
1665 % \DescribeKey{bgimage*}'='{<key=value pairs for image>}{<image filename>}
1666 % Adds a background image to the content like \Key{bgimage} but the image is not stretched to fit the content.
1667 % Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
1668 % The image is placed on the baseline of the content and horizontally centered. It can be lowered to the lower edge of
1669 % the content using \Key{raise}'=-'\AlsoMacro\pdepth and left aligned using \Key{left}'='\AlsoMacro\pwidth etc.
1670 %
1671 % \DescribeMacro{\bgimagebox}[<key=value pairs>]{<image filename>}
1672 % \DescribeMacro{\bgimagebox}*[<key=value pairs>]{<image filename>}
1673 % \DescribeEnv[<content>]{bgimagebox}[<key=value pairs>]{<image filename>}
1674 % \DescribeEnv[<content>]{bgimagebox*}[<key=value pairs>]{<image filename>}
1675 % Standalone macro and environment versions of the \Key{bgimage} and \Key{bgimage*} keys.
1676 %
1677 %
1678 % \DescribeKey{fgimage}'='<image filename>
1679 % \DescribeKey{fgimage}'='{<key=value pairs for image>}{<image filename>}
1680 % Adds a foreground image to the content. The image is stretched to fit exactly to the content.
1681 % It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done).
1682 % The image is assumed to have transparent elements, otherwise the existing content is fully covered.
1683 %
1684 % \DescribeKey{fgimage*}'='<image filename>
1685 % \DescribeKey{fgimage*}'='{<key=value pairs for image>}{<image filename>}
1686 % Adds a foreground image to the content like \Key{fgimage} but the image is not stretched to fit the content.
1687 % Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
1688 % The image is placed on the baseline of the content and horizontally centered.
1689 %
1690 % \DescribeMacro{\fgimagebox}[<key=value pairs>]{<image filename>}
1691 % \DescribeMacro{\fgimagebox}*[<key=value pairs>]{<image filename>}
1692 % \DescribeEnv[<content>]{fgimagebox}[<key=value pairs>]{<image filename>}
1693 % \DescribeEnv[<content>]{fgimagebox*}[<key=value pairs>]{<image filename>}
1694 % Standalone macro and environment versions of the \Key{fgimage} and \Key{fgimage*} keys.
1695 %
1696 %
1697 %
1698 % \DescribeKey{background}'='<background content>
1699 % \DescribeKey{background}'='{<key=value pairs for image>}{<background content>}
1700 % Adds the given content as background layer to the main content. The background content is stretched to fit the size of
1701 % the main content. It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the
1702 % background content (before the resizing is done).
1703 % \begin{examples}
1704 % \begin{examplecode}
1705 % \adjustbox{background={\color{red}xxx}}{Some text}
1706 % \end{examplecode}
1707 % \end{examples}
1708 %
1709 % \DescribeKey{background*}'='<background content>
1710 % \DescribeKey{background*}'='{<key=value pairs for image>}{<background content>}
1711 % Like \Key{background} but does not resizes the background content.
1712 % Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
1713 %
1714 % \DescribeMacro{\backgroundbox}[<key=value pairs>]{<background content>}
1715 % \DescribeMacro{\backgroundbox}*[<key=value pairs>]{<background content>}
1716 % \DescribeEnv[<content>]{backgroundbox}[<key=value pairs>]{<background content>}
1717 % \DescribeEnv[<content>]{backgroundbox*}[<key=value pairs>]{<background content>}
1718 % Standalone macro and environment versions of the \Key{background} and \Key{background*} keys.
1719 %
1720 %
1721 % \DescribeKey{foreground}'='<foreground content>
1722 % \DescribeKey{foreground}'='{<key=value pairs for content>}{<foreground content>}
1723 % Adds the given content as foreground layer to the main content. The foreground content is stretched to fit the size of
1724 % the main content. It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the
1725 % foreground content (before the resizing is done).
1726 % \begin{examples}
1727 % \begin{examplecode}
1728 % \adjustbox{foreground={\color{red}xxx}}{Some text}
1729 % \end{examplecode}
1730 % \end{examples}
1731 %
1732 % \DescribeKey{foreground*}'='<foreground content>
1733 % \DescribeKey{foreground*}'='{<key=value pairs for content>}{<foreground content>}
1734 % Like \Key{foreground} but does not resizes the foreground content.
1735 % Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys.
1736 %
1737 % \DescribeMacro{\foregroundbox}[<key=value pairs>]{<foreground content>}
1738 % \DescribeMacro{\foregroundbox}*[<key=value pairs>]{<foreground content>}
1739 % \DescribeEnv[<content>]{foregroundbox}[<key=value pairs>]{<foreground content>}
1740 % \DescribeEnv[<content>]{foregroundbox*}[<key=value pairs>]{<foreground content>}
1741 % Standalone macro and environment versions of the \Key{foreground} and \Key{foreground*} keys.
1742 %
1743 %
1744 %
1745 % ^^A )))2
1746 % \clearpage\subsection{Density / Pixel size} ^^A (((2
1747 % The following keys allow to adjust the effective length of |pdftex| special |px| (pixel) unit.
1748 % This can be required for images which do not have the correct DPI meta-data included.
1749 %
1750 %
1751 % \DescribeKey{dpi}'='<number (dots per inch)>
1752 % The \Key{dpi} key provides a simple interface to set the pixel size to the given DPI (dots per inch) value.
1753 % For |pdflatex| the length unit |px| can be used to specify pixels. However, the equivalent dimension (length) of one pixel must be
1754 % set using the \Macro\pdfpxdimen length register. To set a specific DPI value this length must be set using
1755 % \Macro\setlength\AlsoMacro\pdfpxdimen{'1in/'<dots>}, which is done by the \Key{dpi}'='<dots> key.
1756 % Note that the key won't affect the setting for the content but only for the further used keys.
1757 % However, it is possible to use \Macro\setkeys{adjbox}{'dpi='<number>} inside the content or anywhere else in the document to
1758 % set \Macro\pdfpxdimen using this interface.
1759 %
1760 % \begin{example}
1761 % \begin{examplecode}
1762 % \adjustbox{dpi=72,trim=10px,frame}{%
1763 % \setkeys{adjbox}{dpi=72}%
1764 % \textcolor{green}{\rule{50px}{50px}}%
1765 % }
1766 % \end{examplecode}
1767 % \end{example}
1768 %
1769 % \DescribeKey{pxdim}'='<length>
1770 % Alternatively
1771 % to the \Key{dpi} key the \Macro\pdfpxdimen length can be set directly to the given value. Afterwards |1px| will stand
1772 % for the given \meta{length}.
1773 %
1774 % \begin{example}
1775 % \begin{examplecode}
1776 % \adjustbox{pxdim=2pt,trim=2px,frame}
1777 % {\textcolor{green}{\rule{20pt}{20pt}}}
1778 % \end{examplecode}
1779 % \end{example}
1780 %
1781 %
1782 % ^^A )))2
1783 % \clearpage\subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner} ^^A (((2
1784 % The following keys set the way the content is processed before it is stored it in a box.
1785 % These keys will overwrite each other and only the latest used key will take effect.
1786 % Because they affect the inner content directly their order relative to other, normal keys is not meaningful.
1787 % Also they are only defined for \env{adjustbox} but do not apply for \Macro\includegraphics.
1788 % Because they are therefore only used inside a mandatory argument and never in an optional these keys allow for optional bracket arguments.
1789 %
1790 % \DescribeKey{minipage}'='<width>
1791 % \DescribeKey{minipage}'='[<position>][<height>][<inner position>]{<width>}
1792 % This key wraps the inner content in a \env{minipage} with the given \meta{width} before it is stored as horizontal box.
1793 % Its order relative to other keys is not meaningful (except that future keys of this sub-section will overwrite it).
1794 % This allows for line breaks and footnotes in the \env{adjustbox}.
1795 % All optional arguments of \env{minipage} are supported. I only the width is given it does not have to be enclosed in braces.
1796 % The \meta{position} argument must be "t" for top baseline, "b" for bottom baseline and "c" for center alignment relative to other
1797 % text, i.e.\ defines the resulting baseline. If a \meta{height} is defined the \meta{inner position} defaults to \meta{position} but
1798 % can also be "s" to stretch the content over the whole height. This requires the content to include some vertical stretchable material.
1799 % Note that all length arguments can include arithmetic expressions like for other keys.
1800 %
1801 % \begin{examples}
1802 % \begin{examplecode}
1803 % \adjustbox{minipage=5cm,angle=-10}{%
1804 % Some example code which will
1805 % be automatically broken or can include \\
1806 % line breaks\footnote{AND footnotes!!}\\
1807 % or verbatim \verb+@%^&}_+!%
1808 % }
1809 % \end{examplecode}
1810 % \begin{examplecode}
1811 % Before \begin{adjustbox}{minipage=[b][3cm][s]{5cm}}
1812 % Some example code
1813 %
1814 % \vfill
1815 % with line breaks\footnote{AND footnotes!!}
1816 %
1817 % \vfill
1818 % or verbatim \verb+@%^&}_+!%
1819 % \end{adjustbox} After
1820 % \end{examplecode}
1821 % \end{examples}
1822 %
1823 %
1824 % \DescribeKey{varwidth}'='<width>
1825 % Adds a \env{varwidth} environment from the \pkg{varwidth} package around the content. This is similar to the
1826 % \env{minipage} environment but the final width of the content will be as large as the widest line in the content up to
1827 % the maximum amount given by the width argument.
1828 % This environment key is vert useful if the content produces some paragraph material which can't be stored in an
1829 % horizontal box directly.
1830 %
1831 %
1832 % \DescribeKey{tabular}'='[<position>]{<column specification>}
1833 % \DescribeKey{tabular*}'='[<position>]{<width>}{<column specification>}
1834 % \DescribeKey{array}'='[<position>]{<column specification>}
1835 % Places the content in a \env{tabular}, \env{tabular*} or \env{array} environment, respectively.
1836 % These keys require different implementations for macro (\Macro\adjustbox) and environment mode (\env{adjustbox} environment) in order to insert
1837 % the end code correctly. Note that the environment mode is more efficient and fully stable, while the macro mode requires the last row to end with
1838 % an explicit |\\| (which can be followed by \Macro\hline or any other macro which uses \Macro\noalign internally). In macro mode the |\\| is internally redefined
1839 % to check for the closing brace. While this was successful tested for normal usages it might still cause issues with unusual or complicated cases.
1840 % Note that these environments are taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
1841 %
1842 % \begin{examples}
1843 % \begin{examplecode}
1844 % \adjustbox{tabular=lll}{%
1845 % \hline
1846 % A & B & C \\\hline
1847 % a & b & c \\\hline
1848 % }
1849 % \end{examplecode}
1850 % \begin{examplecode}
1851 % \begin{adjustbox}{tabular=lll}
1852 % A & B & C \\
1853 % a & b & c
1854 % \end{adjustbox}
1855 % \end{examplecode}
1856 % \end{examples}
1857 %
1858 %
1859 % \DescribeKey{stack}
1860 % \DescribeKey{stack}'='<horizontal alignment>
1861 % \DescribeKey{stack}'='{<horizontal alignment>}{<vertical alignment>}
1862 % \Descsep
1863 % \DescribeMacro\stackbox!\optionaloff![<horizontal alignment>][<vertical alignment>]{<content>}
1864 % \Descsep
1865 % \DescribeEnv[<content>]{stackbox}[<horizontal alignment>][<vertical alignment>]
1866 % The \Key{stack} key and its corresponding macro and environment can be used to stack multiple lines similar to the \Macro\shortstack macro, but
1867 % both the horizontal and vertical alignment can be selected by a single letter each. Also a proper baseline skip is inserted.
1868 % This is implemented using the \env{varwidth} environment which is based on the \env{minipage} environment.
1869 % Its maximal width arguments is fixed internally to \Macro\linewidth.
1870 %
1871 % Possible horizontal alignments are: "l" (left), "r" (right), "c" (centered, default), "j" (justified).
1872 % Possible vertical alignments are the same as for \env{minipage}: "t" (top baseline), "b" (bottom baseline, default), "c" (vertical centered).
1873 % Because these arguments are always single letters the "{ }" around them can be skipped, so that the value can simple be two concatenated letters.
1874 %
1875 % \begin{example}
1876 % \begin{examplecode}
1877 % .\adjustbox{stack}{A\\B\\CC}.
1878 % \end{examplecode}
1879 % \begin{examplecode}
1880 % .\adjustbox{stack=r}{A\\B\\CC}.
1881 % \end{examplecode}
1882 % \begin{examplecode}
1883 % .\adjustbox{stack=ct}{A\\B\\CC}.
1884 % \end{examplecode}
1885 % \end{example}
1886 %
1887 %
1888 % \DescribeKey{innerenv}'='<environment name>
1889 % \DescribeKey{innerenv}'='{<environment name>}<environment options>
1890 % Wraps the inner content in the given \meta{environment} before it is stored as horizontal box.
1891 % It should be kept in mind that there is some internal code between the begin of the environment and the content. For this reason
1892 % a \env{tabular}, \env{array} or similar environment will not work here, because that code will be taken as part of the first cell.
1893 % Note that such a environment is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
1894 %
1895 % \begin{example}
1896 % \begin{examplecode}
1897 % \newenvironment{myenv}[2][]{Before [#1](#2)}{After}
1898 % \adjustbox{innerenv={myenv}[ex]{amble}}{Content}
1899 % \end{examplecode}
1900 % \newenvironment{myenv}[2][]{Before [#1](#2)}{After}
1901 % \begin{examplecode}
1902 % \adjustbox{innerenv={myenv}{amble}}{Content}
1903 % \end{examplecode}
1904 % \end{example}
1905 %
1906 %
1907 % \DescribeKey{innercode}'='{<begin code>}{<end code>}
1908 % Places the given code before and after the inner content before it is stored as horizontal box.
1909 % Note that such code is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported.
1910 %
1911 % \begin{example}
1912 % \begin{examplecode}
1913 % \adjustbox{innercode={\color{green}}{!}}{Content}
1914 % \end{examplecode}
1915 % \end{example}
1916 %
1917 % ^^A )))2
1918 % \clearpage\subsection{Floats and non-float replacements} ^^A (((2
1919 % The following keys can be used to turn an adjusted box into a float or a non-floating replacement which also allows
1920 % for a caption. These keys must be used last and no other normal keys must be used afterwards, otherwise an error will
1921 % occur because the added floating environment is boxed again.
1922 %
1923 %
1924 % \DescribeKey{caption}=<caption text>
1925 % \DescribeKey{caption}=[<short caption>]{<long caption>}
1926 % Defines a caption which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
1927 % The position of the caption defaults to top for a |table| (non-)float and bottom for every other type.
1928 %
1929 % \DescribeKey{captionabove}=<caption text>
1930 % \DescribeKey{captionabove}=[<short caption>]{<long caption>}
1931 % Like the \Key{caption} key but forces the placement of the caption above the content.
1932 % The vertical skip above and below a normal below caption are reversed in this case to get proper
1933 % spacing. However, this is not done if the \pkg{caption} package is loaded.
1934 % It is recommended to load this package with the |tableposition=above| option.
1935 %
1936 %
1937 % \DescribeKey{captionbelow}=<caption text>
1938 % \DescribeKey{captionbelow}=[<short caption>]{<long caption>}
1939 % Like the \Key{caption} key but forces the placement of the caption below the content.
1940 %
1941 %
1942 % \DescribeKey{label}=<label>
1943 % Defines a label which will be used by a following \Key{figure}, \Key{float} or \Key{nofloat} key.
1944 %
1945 %
1946 % \DescribeKey{figure}
1947 % \DescribeKey{figure}=<placement>
1948 % Turns the adjusted box into a \env{figure}.
1949 % A previously used \Key{caption} and \Key{label} will be added.
1950 % This is a specialised version of \Key{float}={figure}.
1951 %
1952 %
1953 % \DescribeKey{float}=<float type>
1954 % \DescribeKey{float}={<float type>}[<position>]
1955 % Turns the adjusted box into a float of the given type, i.e.\ |figure|, |table| or any other custom defined float.
1956 % A previously used \Key{caption} and \Key{label} will be added.
1957 %
1958 %
1959 % \DescribeKey{nofloat}=<float type>
1960 % This will add a non-floating replacement of the given float type (|figure|, |table|, etc.).
1961 % The will place the content always at the current
1962 % position which can lead to bad page-breaking. A caption will be in the same format as for real floats of the same
1963 % type.
1964 % A previously used \Key{caption} and \Key{label} will be added.
1965 %
1966 % \DescribeEnv[<content>]{adjnofloat}{<float type>}
1967 % This environment is used internally by \Key{nofloat} to create a non-floating replacement of the given float type
1968 % (|figure|, |table|, etc.). It can also be used directly with other code or be redefined to change the
1969 % behavior of \Key{nofloat}.
1970 % Any redefinition should include |\adjbox@nofloatcaptionsetup{#1}| to set the caption type.
1971 % The environment will be used in plain form, i.e.\ \Macro\adjnofloat\ldots\Macro\endadjnofloat, so
1972 % if a group is required in a redefinition it should be added manually using \Macro\begingroup and \Macro\endgroup.
1973 %
1974 %
1975 %
1976 % ^^A )))2
1977 % \Needspace*{8\baselineskip}
1978 % \clearpage\subsection{Adding own Code or Environments} ^^A (((2
1979 % \vspace{-\baselineskip}
1980 %
1981 % \DescribeKey{env}'='<environment name>
1982 % \DescribeKey{env}'='{<environment name>}<environment options>
1983 % Adds an \meta{environment} around the content and the already existing code around it which was added by other keys beforehand.
1984 % Potential \meta{environment options} (or any other code) can follow the environment name if it was set inside braces.
1985 % At this stage the content is already boxed and format macros won't have any effect on any included text. For this the \Key{innerenv} key needs to be used instead.
1986 %
1987 % \DescribeKey{addcode}'='{<code before>}{<code afters>}
1988 % Adds some \meta{code before} and some \meta{code after} the content and the
1989 % already existing code around it which was added by other keys beforehand.
1990 % At this stage the content is already boxed and format macros won't have any effect on any included text.
1991 % This key sets
1992 % the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content
1993 % beforehand.
1994 %
1995 % \DescribeKey{Addcode}'='{<code before>}{<code afters>}
1996 % Identical to \Key{addcode} but does not sets the size of the content first.
1997 %
1998 % \DescribeKey{appcode}'='<code afterwards>
1999 % Appends the given \LaTeX\ code after the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code
2000 % added by the previous keys.
2001 %
2002 % It is recommended to wrap complex code into braces.
2003 %
2004 % \DescribeKey{precode}'='<code before>
2005 % Prepends the given \LaTeX\ code before the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code
2006 % added by the previous keys. The content is wrapped into curly braces, so the given code can use it as a macro argument.
2007 % This key sets the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content
2008 % beforehand.
2009 %
2010 % It is recommended to wrap complex code into braces.
2011 %
2012 %
2013 % \DescribeKey{Precode}'='{<code before>}
2014 % Identical to \Key{precode} but does not sets the size of the content first.
2015 %
2016 %
2017 % \DescribeKey{execute}'='<code>
2018 % Simply executes the code immediately. This is done in the key processing phase and is intended mostly for debugging purposes.
2019 % Previous (normal) keys won't have an effect yet.
2020 %
2021 % \DescribeKey{Execute}'='<code>
2022 % Simply executes the code immediately. This is done in the key processing phase for inner environments (see \autoref{sec:inner}) and is intended mostly for debugging purposes.
2023 % Only previously used special keys for modifying the boxing of the content will have an effect yet. % All other keys are not yet processed.
2024 %
2025 %
2026 % ^^A )))2
2027 % \clearpage\subsection{Change or discard content} ^^A (((2
2028 % \vspace{-\baselineskip}
2029 %
2030 % \DescribeKey{phantom}
2031 % \DescribeKey{phantom}'=h'
2032 % \DescribeKey{phantom}'=v'
2033 % This key replaces the content with an empty phantom box of the same dimension.
2034 % If the "h" or "v" value is used the box will only have the same horizontal size or vertical sizes (height and depth)
2035 % while using zero for the other dimension(s). For this the standard \LaTeX\ macros \Macro\phantom, \Macro\hphantom and
2036 % \Macro\vphantom are used internally.
2037 %
2038 %
2039 % \DescribeMacro\phantombox{<width>}{<height>}{<depth>}
2040 % This macro produces an empty box with the given width, height and depth.
2041 % It is equivalent to \Macro\phantom{\AlsoMacro\rule['-'<depth>]{<width>}{<height>'+'<depth>}} but more efficient and more user friendly.
2042 %
2043 % \begin{example}
2044 % \begin{examplecode}
2045 % Before \fbox{\phantombox{1cm}{2ex}{1ex}} After
2046 % \end{examplecode}
2047 % \end{example}
2048 %
2049 %
2050 % \DescribeKey{gobble}
2051 % \DescribeKey{discard}
2052 % These two keys are aliases and will discard the content after it was fully processed. Any keys used after one of this
2053 % keys will operate on an empty content. These keys can be used in combination of the \Key{gstore ...} keys to only
2054 % measure but not typeset some content.
2055 %
2056 % \DescribeKey{content}'='<new content>
2057 % This key discards the current content completely after it was fully processed and all earlier keys were applied
2058 % and sets the content to the given \meta{new content}. This can be used to implement some draft box or censoring
2059 % features.
2060 %
2061 % \newlength\somelengtha
2062 % \newlength\somelengthb
2063 % \begin{example}
2064 % \begin{examplecode}
2065 % \adjustbox{frame,rotate=-30,gstore sizes=\somelengtha{}{}\somelengthb,
2066 % content={Censored!},rotate=30,totalheight=\somelengtha,width=\somelengthb,frame}
2067 % {The real content}
2068 % \end{examplecode}
2069 % \end{example}
2070 %
2071 %
2072 %
2073 % ^^A )))2
2074 % \clearpage\subsection{Store box content } ^^A (((2
2075 %
2076 % \DescribeKey{gstore}'='<\textbackslash boxregister>
2077 % \DescribeKey{gstore*}'='<\textbackslash boxregister>
2078 % These keys globally store the current content into the given box register.
2079 % With the normal version the content is still preserved and can be further adjusted.
2080 % With the starred version the content will be consumed and further keys will be applied to an empty content.
2081 %
2082 % \DescribeKey{gstore width}'='<\textbackslash lengthregister>
2083 % \DescribeKey{gstore height}'='<\textbackslash lengthregister>
2084 % \DescribeKey{gstore depth}'='<\textbackslash lengthregister>
2085 % \DescribeKey{gstore totalheight}'='<\textbackslash lengthregister>
2086 % These key globally store the width, height, depth and totalheight into a length register, respectively.
2087 % The content will not be altered by these keys. There are no starred versions like for \Key{gstore}.
2088 % If the content should only be measured but not typeset the \Key{gobble}/\Key{discard} key can be used afterwards.
2089 %
2090 % \DescribeKey{gstore sizes}'='<\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister><\textbackslash lengthregister>
2091 % Stores all four size values (width, height, depth and totalheight) of the content in the given length registers.
2092 % This key should be used if more than one dimension should be stored, because it is much more efficient than using
2093 % multiple of the above keys.
2094 % If a dimension is not required it can be replaced by an empty argument, i.e.\ `|{}|'.
2095 % Trailing dimensions can be skipped altogether if they are not required.
2096 %
2097 %
2098 % ^^A )))2
2099 % \clearpage\subsection{Process content} ^^A (((2
2100 %
2101 % \DescribeKey{process}
2102 % This key processes the keys and content encountered so far (i.e.\ all keys to its left) and sets the dimension macros to the sizes of the result.
2103 % It is only required for certain key combinations, mostly the ones taken from \pkg{graphicx}, which are otherwise processed together.
2104 %
2105 % ^^A )))2
2106 % \clearpage\subsection{Experimental Keys} ^^A (((2
2107 % The following features are experimental and may not work correctly yet.
2108 % At the moment the \pkg{storebox} package must be loaded manually for this keys.
2109 %
2110 % \DescribeMacro\splitbox{<split width>}{<split height>}{<content>}
2111 % This macro boxes the given content and splits it in multiple fragments of the given width and height.
2112 % This is done row by row starting from the upper left corner. The last column and row can have a smaller size than requested.
2113 % Every fragment is placed using \Macro\splitboxcmd{<fragment box>} which is empty by default but can be redefined to e.g.\ draw
2114 % a frame around each fragment. After every row except the last the macro \Macro\splitboxnewline is inserted which defaults to |\\|,
2115 % but can also be redefined freely. After the last row the macro \Macro\splitboxlastnewline is inserted which defaults to \Macro\splitboxnewline.
2116 %
2117 % The \Macro\splitbox content is stored using \Macro\storebox from the \pkg{storebox} package and therefore the whole content should only
2118 % be stored once in the output file if the format is supported by that package (currently only PDF).
2119 %
2120 % \DescribeEnv[<content>]{splitbox}{<split width>}{<split height>}
2121 % Environment version of \Macro\splitbox.
2122 %
2123 % \DescribeKey{split}'='{<split width>}{<split height>}
2124 % The \Key{split} key can be used with \Macro\adjustbox and uses \Macro\splitbox internally.
2125 %
2126 % \DescribeMacro\pagebreakbox{<content>}
2127 % The \Macro\pagebreakbox macro will split the content into multiple parts so that if fits on the current page.
2128 % If it is larger than the rest of the current page and the full next page it is broken again until the last part fits on a page.
2129 % This doesn't take any baselines into account and text line in the content may be split in two.
2130 % This might be compensated manually by redefining the \Macro\pagebreakboxoffset macro (default: `|\ht\strutbox|'), which adjust the vertical offset
2131 % of the first part.
2132 %
2133 % \DescribeEnv{pagebreakbox}
2134 % Environment version of \Macro\pagebreakbox.
2135 %
2136 % \DescribeKey{pagebreak}
2137 % The key version of \Macro\pagebreakbox. There should no be any further keys used afterwards, because they will interfere with the page breaks.
2138 %
2139 %
2140 % ^^A )))2
2141 % ^^A )))
2142 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2143 % \clearpage\section{Defining own Keys} ^^A (((
2144 % The following macros can be used to define own keys or redefine existing ones.
2145 %
2146 % \DescribeMacro\newadjustboxkey{<key>}[<default value>]{<code>}
2147 % \DescribeMacro\newadjustboxkey*{<key>}[<default value>]{<code>}
2148 % Defines the new \env{adjustbox} key with the given default value if no value is provided.
2149 % The value can be accessed inside the code as |#1|
2150 % Without a default value an error is raised if the value is missing.
2151 % An error is raised if the key is already defined.
2152 %
2153 % The normal form will add the code to the internal token register just before the previous content which is
2154 % wrapped inside braces: \MacroArgs<code>{<previous content>}. Subsequent keys will receive this as content.
2155 % The code can therefore read the content as macro argument. If the dimension of the content need to be accessed
2156 % it should be boxed first using \Macro\collectbox{<code>}. Then the dimension are available using the usual
2157 % macros and the content can be typeset using \Macro\BOXCONTENT. See the \pkg{collectbox} for additional information.
2158 %
2159 % The starred form simply executes the given code in the internal group without changing the token register.
2160 % In this case the content is not directly accessible and all subsequent keys are not yet processed.
2161 % This form is useful to locally change settings for the current \Macro\adjustbox macro or \env{adjustbox} environment.
2162 %
2163 %
2164 % \DescribeMacro\renewadjustboxkey{<key>}[<default value>]{<code>}
2165 % \DescribeMacro\renewadjustboxkey*{<key>}[<default value>]{<code>}
2166 % Like \Macro\newadjustboxkey but will redefine an existing key.
2167 % An error is raised if the key is not already defined.
2168 %
2169 %
2170 % \DescribeMacro\provideadjustboxkey{<key>}[<default value>]{<code>}
2171 % \DescribeMacro\provideadjustboxkey*{<key>}[<default value>]{<code>}
2172 % Like \Macro\newadjustboxkey but will define the key only if it is not already defined.
2173 %
2174 %
2175 % \DescribeMacro\defadjustboxkey{<key>}[<default value>]{<code>}
2176 % \DescribeMacro\defadjustboxkey*{<key>}[<default value>]{<code>}
2177 % Like \Macro\newadjustboxkey but will always define the key independent if it is already defined or not.
2178 %
2179 %
2180 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2181 % \StopEventually{}
2182 % \clearpage% ^^A )))
2183 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2184 % \clearpage\section{Implementation} ^^A (((
2185 % \setcounter{lstnumber}{1}
2186 %
2187 % \iffalse
2188 %<*adjustbox.sty>
2189 % \fi
2190 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191 % \subsection{Package header, options and dependencies} ^^A (((
2192 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2193 % \begin{macrocode}
2194 %<!COPYRIGHT>
2195 \ProvidesPackage{adjustbox}[%
2196 %<!DATE>
2197 %<!VERSION>
2198 %<*DRIVER>
2199 2099/01/01 develop
2200 %</DRIVER>
2201 Adjusting TeX boxes (trim, clip, ...)]
2202 % \end{macrocode}
2203 %
2204 % Load the packages required for the options.
2205 % \begin{macrocode}
2206 \RequirePackage{xkeyval}
2207 \RequirePackage{adjcalc}
2208 % \end{macrocode}
2209 %
2210 % Declare normal options.
2211 % \begin{macrocode}
2212 \def\adjbox@fam{adjbox}
2213 \DeclareOptionX<Adjbox>{export}{\def\adjbox@fam{Gin}}
2214 \DeclareOptionX<Adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
2215 \DeclareOptionX<Adjbox>{patch}{%
2216 \PackageWarning{adjustbox}{%
2217 The 'patch' option is now deprecated.\MessageBreak
2218 Use the new \string\adjustimage\space or \string\adjincludegraphics\space macros instead%
2219 \@gobble
2220 }%
2221 }
2222 \DeclareOptionX<Adjbox>{minimal}{\let\adjustbox@minimal\endinput}
2223 % \end{macrocode}
2224 %
2225 % Declare the options which must be passed to \pkg{adjcalc} in a special form,
2226 % because they require extra packages. This must be this way because \pkg{adjcalc}
2227 % is already loaded.
2228 % \begin{macrocode}
2229 \DeclareOptionX<Adjbox>{pgfmath}{\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
2230 \DeclareOptionX<Adjbox>{calc}{\AtEndOfPackage{\RequirePackage{calc}\adjcalcset{calc}}}
2231 \DeclareOptionX<Adjbox>{etex}{\AtEndOfPackage{\adjcalcset{etex}}}
2232 \DeclareOptionX<Adjbox>{defaultunit}{\AtEndOfPackage{\adjcalcset{defaultunit={#1}}}}
2233 % \end{macrocode}
2234 %
2235 % Handle the special \opt{pgf} and \opt{PGF} options.
2236 % \begin{macrocode}
2237 \DeclareOptionX<Adjbox>{pgf}{\PassOptionsToPackage{pgf}{trimclip}}
2238 \DeclareOptionX<Adjbox>{PGF}{\PassOptionsToPackage{pgf}{trimclip}\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
2239 % \end{macrocode}
2240 %
2241 % Pass |pkg{graphicx}| options down.
2242 % \begin{macrocode}
2243 \DeclareOptionX<Adjbox>{draft}{\PassOptionsToPackage{draft}{graphicx}}
2244 \DeclareOptionX<Adjbox>{final}{\PassOptionsToPackage{final}{graphicx}}
2245 \DeclareOptionX<Adjbox>{hiderotate}{\PassOptionsToPackage{hiderotate}{graphicx}}
2246 \DeclareOptionX<Adjbox>{hidescale}{\PassOptionsToPackage{hidescale}{graphicx}}
2247 \DeclareOptionX<Adjbox>{hiresbb}{\PassOptionsToPackage{hiresbb}{graphicx}}
2248 \DeclareOptionX<Adjbox>{demo}{\PassOptionsToPackage{demo}{graphicx}}
2249 % \end{macrocode}
2250 %
2251 % Pass all driver options to \pkg{trimclip} and all unknown options to \pkg{graphicx}.
2252 % \begin{macrocode}
2253 \DeclareOptionX*{%
2254 \IfFileExists{tc-\CurrentOption.def}{%
2255 \PassOptionsToPackage\CurrentOption{trimclip}%
2256 }{%
2257 \PassOptionsToPackage\CurrentOption{graphicx}%
2258 }%
2259 }
2260 % \end{macrocode}
2261 %
2262 % Process all options.
2263 % \begin{macrocode}
2264 \ProcessOptionsX*<Adjbox>\relax
2265 % \end{macrocode}
2266 %
2267 % Load the required packages.
2268 % \begin{macrocode}
2269 \RequirePackage{trimclip}
2270 \RequirePackage{graphicx}[1999/02/16]
2271 \RequirePackage{collectbox}[2012/05/17]
2272 % \end{macrocode}
2273 %
2274 % Fall-back code for older \pkg{collectbox} versions:
2275 % \begin{macrocode}
2276 \@ifpackagelater{collectbox}{2012/05/17}{}{%
2277 \let\@Collectbox\@collectbox
2278 }
2279 % \end{macrocode}
2280 %
2281 % ^^A )))
2282 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2283 % \subsection{Basic commands} ^^A (((
2284 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2285 %
2286 % \begin{macro}{\adjustboxset}
2287 % \begin{macrocode}
2288 \newcommand*\adjustboxset{%
2289 \@ifstar
2290 {\adjbox@addkeysafter}%
2291 {\adjbox@addkeysbefore}%
2292 }
2293 % \end{macrocode}
2294 % \end{macro}
2295 %
2296 % \begin{macro}{\adjbox@addkeysbefore}[1]{<keys>}
2297 % \begin{macrocode}
2298 \def\adjbox@addkeysbefore#1{%
2299 \ifx\@nnil#1\@nnil
2300 \let\adjbox@keysbefore\@empty
2301 \else
2302 \expandafter\def\expandafter\adjbox@keysbefore\expandafter{\adjbox@keysbefore,#1}%
2303 \let\adjbox@setkeys\adjbox@setkeys@ba
2304 \fi
2305 }
2306 \let\adjbox@keysbefore\@empty
2307 % \end{macrocode}
2308 % \end{macro}
2309 %
2310 % \begin{macro}{\adjbox@addkeysafter}[1]{<keys>}
2311 % \begin{macrocode}
2312 \def\adjbox@addkeysafter#1{%
2313 \begingroup
2314 \def\@tempa{#1}%
2315 \ifx\@tempa\@empty
2316 \endgroup
2317 \let\adjbox@keysafter\@empty
2318 \else
2319 \expandafter\expandafter
2320 \expandafter\endgroup
2321 \expandafter\expandafter
2322 \expandafter\def
2323 \expandafter\expandafter
2324 \expandafter\adjbox@keysafter
2325 \expandafter\expandafter
2326 \expandafter{\expandafter\@tempa\expandafter,\adjbox@keysafter}%
2327 \let\adjbox@setkeys\adjbox@setkeys@ba
2328 \fi
2329 }
2330 \let\adjbox@keysafter\@empty
2331 % \end{macrocode}
2332 % \end{macro}
2333 %
2334 %
2335 %
2336 % \begin{macro}{\adjustbox}[1]{<keys>}
2337 % Now processes the keys before the box is read to allow for parbox or similar modes.
2338 %
2339 % This code was originally adapted from the \Macro\Gin@ii macro from the |graphicx| package.
2340 % The \emph{temp switch a} is set to |true| to indicate to |graphicx| that the
2341 % scaling should be done internal, so this package doesn't have to do it.
2342 % The content including macro \Macro\adjustbox@content is but into place,
2343 % the saved options are activated and the final size is set.
2344 % The typesetting of the content is finally done by executing the token register.
2345 % \begin{macrocode}
2346 \newcommand\adjustbox{%
2347 \begingroup
2348 \collectboxcheckenv{adjustbox}%
2349 \@adjustbox
2350 }
2351 \long\def\@adjustbox#1{%
2352 \edef\adjbox@line{\the\inputlineno}%
2353 \let\collectbox@mode\relax
2354 \let\collectbox@noindent\relax
2355 \let\adjbox@collectbox\@collectbox
2356 \let\adjbox@begininnercode\@empty
2357 \let\adjbox@endinnercode\@empty
2358 \chardef\adjbox@innerlevel\z@
2359 \ifcollectboxenv
2360 \let\adjustbox@noindent\noindent
2361 \let\adjustbox@unskip\unskip
2362 \let\adjustbox@ignorespaces\ignorespaces
2363 \else
2364 \let\adjustbox@noindent\relax
2365 \let\adjustbox@unskip\relax
2366 \let\adjustbox@ignorespaces\relax
2367 \fi
2368 \let\XKV@checksanitizea\adjbox@kvsanitize
2369 \adjbox@setkeys{#1}%
2370 \expandafter
2371 \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}%
2372 }
2373 \def\adjbox@setkeys@ba{%
2374 \expandafter\expandafter
2375 \expandafter\adjbox@@setkeys@ba
2376 \expandafter\expandafter
2377 \expandafter{\expandafter\adjbox@keysbefore\expandafter}%
2378 \expandafter{\adjbox@keysafter}%
2379 }
2380 \def\adjbox@@setkeys@ba#1#2#3{%
2381 \setkeys*{ADJBOX}{#1,#3,#2}%
2382 }
2383 \def\adjbox@setkeys{%
2384 \setkeys*{ADJBOX}%
2385 }
2386 % \end{macrocode}
2387 % \end{macro}
2388 %
2389 %
2390 % \begin{macro}{\adjustbox@}[1]{<keys>}
2391 % Second part of \Macro\adjustbox, after the content has been boxed.
2392 % This sets the dimension macros, processes the keys and finally typesets the content.
2393 % \begin{macrocode}
2394 \def\adjustbox@#1{%
2395 \adjbox@Width\width
2396 \adjbox@Height\height
2397 \adjbox@Depth\depth
2398 \adjbox@Totalheight\totalheight
2399 \let\Width\adjbox@Width
2400 \let\Height\adjbox@Height
2401 \let\Depth\adjbox@Depth
2402 \let\Totalheight\adjbox@Totalheight
2403 \let\Gin@esetsize\adjbox@esetsize
2404 \let\@collectbox\@Collectbox
2405 \@tempswatrue
2406 \toks@{{\adjustbox@content}}%
2407 \def\setlength{\adjsetlength}%
2408 \setkeys{adjbox,Gin,adjcalc}{#1}%
2409 \adjbox@esetsize
2410 \adjustbox@noindent
2411 \the\toks@
2412 \endgroup
2413 }
2414 % \end{macrocode}
2415 % \end{macro}
2416 %
2417 % \begin{macrocode}
2418 \begingroup
2419 \catcode`\, 3
2420 \catcode`\= 3
2421 \gdef\adjbox@comma@iii{,}%
2422 \gdef\adjbox@equal@iii{=}%
2423 \catcode`\, 4
2424 \catcode`\= 4
2425 \gdef\adjbox@comma@iv{,}%
2426 \gdef\adjbox@equal@iv{=}%
2427 \catcode`\, 7
2428 \catcode`\= 7
2429 \gdef\adjbox@comma@vii{,}%
2430 \gdef\adjbox@equal@vii{=}%
2431 \catcode`\, 8
2432 \catcode`\= 8
2433 \gdef\adjbox@comma@viii{,}%
2434 \gdef\adjbox@equal@viii{=}%
2435 \catcode`\, 10
2436 \catcode`\= 10
2437 \gdef\adjbox@comma@x{,}%
2438 \gdef\adjbox@equal@x{=}%
2439 \catcode`\, 11
2440 \catcode`\= 11
2441 \gdef\adjbox@comma@xi{,}%
2442 \gdef\adjbox@equal@xi{=}%
2443 \catcode`\, 13
2444 \catcode`\= 13
2445 \gdef\adjbox@comma@xiii{,}%
2446 \gdef\adjbox@equal@xiii{=}%
2447 \catcode`\, 12
2448 \catcode`\= 12
2449 \gdef\adjbox@comma@xii{,}%
2450 \gdef\adjbox@equal@xii{=}%
2451 % \end{macrocode}
2452 %
2453 % \begin{macro}{\adjbox@kvsanitize}
2454 % \begin{macrocode}
2455 \gdef\adjbox@kvsanitize#1#2{%
2456 \def\@tempa{\expandafter\noexpand\adjbox@comma@xiii}%
2457 \def\@tempb{}%
2458 \ifnum\catcode`\,=12 \else
2459 \ifnum\catcode`\,=13 \else
2460 \@ifundefined{adjbox@comma@\romannumeral\catcode`\,}{%
2461 \PackageError{adjustbox}
2462 {Invalid comma catcode \the\catcode`\,}{}%
2463 }{}%
2464 \edef\@tempb{\csname adjbox@comma@\romannumeral\the\catcode`\,\endcsname}%
2465 \fi
2466 \fi
2467 \edef\@tempa{\@tempa\@tempb}%
2468 \XKV@tempa@toks{#1}%
2469 \expandafter\adjbox@replacecatcodes\expandafter,\@tempa\@nnil
2470 \def\@tempa{\expandafter\noexpand\adjbox@equal@xiii}%
2471 \def\@tempb{}%
2472 \ifnum\catcode`\==12 \else
2473 \ifnum\catcode`\==13 \else
2474 \@ifundefined{adjbox@equal@\romannumeral\catcode`\=}{%
2475 \PackageError{adjustbox}
2476 {Invalid equal sign catcode \the\catcode`\=}{}%
2477 }{}%
2478 \def\@tempb{\@tempa\csname adjbox@equal@\romannumeral\the\catcode`\,\endcsname}%
2479 \fi
2480 \fi
2481 \edef\@tempa{\@tempa\@tempb}%
2482 \expandafter\adjbox@replacecatcodes\expandafter=\@tempa\@nnil
2483 \edef#2{\the\XKV@tempa@toks}%
2484 }
2485 % \end{macrocode}
2486 % \end{macro}
2487 %
2488 % \begin{macro}{\adjbox@replacecatcodes}
2489 % \begin{macrocode}
2490 \gdef\adjbox@replacecatcodes#1#2{%
2491 \ifx\@nnil#2\relax\else
2492 \def\@tempa##1#2{%
2493 \ifx\@nnil##1\relax\else
2494 \XKV@tempa@toks{##1}%
2495 \expandafter\@tempb
2496 \fi
2497 }%
2498 \def\@tempb##1#2{%
2499 \ifx\@nnil##1\relax\else
2500 \XKV@tempa@toks\expandafter{\the\XKV@tempa@toks#1##1}%
2501 \expandafter\@tempb
2502 \fi
2503 }%
2504 \expandafter\@tempa\the\XKV@tempa@toks#2\@nnil#2\relax
2505 \expandafter\adjbox@replacecatcodes\expandafter#1%
2506 \fi
2507 }
2508 % \end{macrocode}
2509 % \end{macro}
2510 %
2511 % \begin{macrocode}
2512 \endgroup
2513 % \end{macrocode}
2514 %
2515 %
2516 % \begin{macro}{\adjustbox@content}
2517 % The default content, which is simply the collected box.
2518 % This macro can be redefined if required.
2519 % \begin{macrocode}
2520 \def\adjustbox@content{%
2521 \usebox\collectedbox
2522 }
2523 % \end{macrocode}
2524 % \end{macro}
2525 %
2526 %
2527 % \begin{macro}{\smallestside}
2528 % \begin{macrocode}
2529 \def\smallestside{\ifdim\width<\totalheight \width\else\totalheight\fi}%
2530 % \end{macrocode}
2531 % \end{macro}
2532 %
2533 %
2534 % \begin{macro}{\largestside}
2535 % \begin{macrocode}
2536 \def\largestside{\ifdim\width>\totalheight \width\else\totalheight\fi}%
2537 % \end{macrocode}
2538 % \end{macro}
2539 %
2540 %
2541 % \begin{macro}{\Smallestside}
2542 % \begin{macrocode}
2543 \def\Smallestside{\ifdim\Width<\Totalheight \Width\else\Totalheight\fi}%
2544 % \end{macrocode}
2545 % \end{macro}
2546 %
2547 %
2548 % \begin{macro}{\Largestside}
2549 % \begin{macrocode}
2550 \def\Largestside{\ifdim\Width>\Totalheight \Width\else\Totalheight\fi}%
2551 % \end{macrocode}
2552 % \end{macro}
2553 %
2554 %
2555 % \begin{macro}{\adjbox@Width}
2556 % \begin{macro}{\adjbox@Height}
2557 % \begin{macro}{\adjbox@Depth}
2558 % \begin{macro}{\adjbox@Totalheight}
2559 % Dimension registers for original sizes.
2560 % \begin{macrocode}
2561 \newdimen\adjbox@Width
2562 \newdimen\adjbox@Height
2563 \newdimen\adjbox@Depth
2564 \newdimen\adjbox@Totalheight
2565 % \end{macrocode}
2566 % \end{macro}
2567 % \end{macro}
2568 % \end{macro}
2569 % \end{macro}
2570 %
2571 % \begin{macro}{\adjbox@pwidth}
2572 % \begin{macro}{\adjbox@pheight}
2573 % \begin{macro}{\adjbox@pdepth}
2574 % \begin{macro}{\adjbox@ptotalheight}
2575 % Dimension registers for parent sizes; used for keys which use an internal adjustbox.
2576 % \begin{macrocode}
2577 \newdimen\adjbox@pwidth
2578 \newdimen\adjbox@pheight
2579 \newdimen\adjbox@pdepth
2580 \newdimen\adjbox@ptotalheight
2581 % \end{macrocode}
2582 % \end{macro}
2583 % \end{macro}
2584 % \end{macro}
2585 % \end{macro}
2586 %
2587 % \begin{macro}{\adjbox@parentdims}
2588 % \begin{macrocode}
2589 \def\adjbox@parentdims{%
2590 \let\pwidth\adjbox@pwidth
2591 \let\pheight\adjbox@pheight
2592 \let\pdepth\adjbox@pdepth
2593 \let\ptotalheight\adjbox@ptotalheight
2594 \pwidth\width
2595 \pheight\height
2596 \pdepth\depth
2597 \ptotalheight\totalheight
2598 }%
2599 % \end{macrocode}
2600 % \end{macro}
2601 %
2602 %
2603 % \begin{macro}{\adjbox@esetsize}
2604 % Replacement of \Macro\Gin@esetsize.
2605 % Now always called in external mode. Checks if any size is set and, as an optimation, does nothing otherwise.
2606 %
2607 % OLD:
2608 % When called in \emph{external} mode (switch is true) then the content is wrapped in
2609 % the internal form of \Macro\resizebox. In \emph{internal} mode, i.e.\ resizing is done by the graphic driver,
2610 % the same code is added around the inner macro. This ensures the same behaviour as \Macro\includegraphics.
2611 % \begin{macrocode}
2612 \def\adjbox@esetsize{%
2613 \ifcase0%
2614 \ifx\Gin@ewidth\Gin@exclamation\else 1\fi
2615 \ifx\Gin@eheight\Gin@exclamation\else 1\fi
2616 \relax
2617 \else
2618 \edef\@tempa{\toks@{\noexpand
2619 \Gscale@@box\noexpand\Gin@eresize
2620 {\Gin@ewidth}{\Gin@eheight}{\the\toks@}}}%
2621 \@tempa
2622 \let\Gin@ewidth\Gin@exclamation
2623 \let\Gin@eheight\Gin@exclamation
2624 \fi
2625 }
2626 % \end{macrocode}
2627 % \end{macro}
2628 %
2629 % \begin{macro}{\adjustimage}
2630 % Simple wrapper to use \Macro\adjustbox for images.
2631 % It uses the internal code of \Macro\includegraphics instead
2632 % to allow later redefinition of that macro.
2633 % \begin{macrocode}
2634 \newcommand*\adjustimage[2]{%
2635 \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
2636 }
2637 % \end{macrocode}
2638 % \end{macro}
2639 %
2640 % \begin{macro}{\adjincludegraphics}[2]{<keys>}{<filename>}
2641 % Simple wrapper to use \Macro\adjustbox for images in the same format of \Macro\includegraphics.
2642 % This allows to simply do |\let\includegraphics\adjincludegraphics|, which is done by the \opt{Export} option.
2643 % \begin{macrocode}
2644 \newcommand*\adjincludegraphics[2][]{%
2645 \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
2646 }
2647 % \end{macrocode}
2648 % \end{macro}
2649 %
2650 %
2651 % End input of file if the \opt{minimal} option was used.
2652 % \begin{macrocode}
2653 {\csname adjustbox@minimal\endcsname}
2654 % \end{macrocode}
2655 %
2656 %
2657 % ^^A )))
2658 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2659 % \subsection{Macros to define new adjustbox environments/macros} ^^A (((
2660 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2661 %
2662 % \begin{macro}{\newadjustboxenv}
2663 % \begin{macrocode}
2664 \newcommand*\newadjustboxenv{%
2665 \begingroup
2666 \@ifstar{%
2667 \let\@@@newadjustboxenv\@@@newadjustboxenv@
2668 \def\new@adjustbox{\newenvironment}%
2669 \newadjustboxenv@
2670 }{%
2671 \def\new@adjustbox{\newcommand}%
2672 \newadjustboxenv@
2673 }%
2674 }
2675 % \end{macrocode}
2676 % \end{macro}
2677 %
2678 %
2679 % \begin{macro}{\renewadjustboxenv}
2680 % \begin{macrocode}
2681 \newcommand*\renewadjustboxenv{%
2682 \begingroup
2683 \@ifstar{%
2684 \let\@@@newadjustboxenv\@@@newadjustboxenv@
2685 \def\new@adjustbox{\renewenvironment}%
2686 \newadjustboxenv@
2687 }{%
2688 \def\new@adjustbox{\renewcommand}%
2689 \newadjustboxenv@
2690 }%
2691 }
2692 % \end{macrocode}
2693 % \end{macro}
2694 %
2695 %
2696 % \begin{macro}{\provideadjustboxenv}
2697 % \begin{macrocode}
2698 \newcommand*\provideadjustboxenv{%
2699 \begingroup
2700 \@ifstar{%
2701 \let\@@@newadjustboxenv\@@@newadjustboxenv@
2702 \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}%
2703 \newadjustboxenv@
2704 }{%
2705 \def\new@adjustbox{\providecommand}%
2706 \newadjustboxenv@
2707 }%
2708 }
2709 % \end{macrocode}
2710 % \end{macro}%
2711 %
2712 %
2713 % \begin{macro}{\declareadjustboxenv}
2714 % \begin{macrocode}
2715 \newcommand*\declareadjustboxenv{%
2716 \begingroup
2717 \@ifstar{%
2718 \let\@@@newadjustboxenv\@@@newadjustboxenv@
2719 \def\new@adjustbox##1{%
2720 \expandafter\let\csname ##1\endcsname\@undefined
2721 \newenvironment{##1}%
2722 }%
2723 \newadjustboxenv@
2724 }{%
2725 \def\new@adjustbox##1{%
2726 \let##1\@undefined
2727 \newcommand{##1}%
2728 }%
2729 \newadjustboxenv@
2730 }%
2731 }
2732 % \end{macrocode}
2733 % \end{macro}
2734 %
2735 %
2736 % \begin{macro}{\newadjustboxcmd}
2737 % \begin{macrocode}
2738 \newcommand*\newadjustboxcmd{%
2739 \begingroup
2740 \let\@@@newadjustboxenv\@@@newadjustboxcmd
2741 \def\new@adjustbox{\newcommand}%
2742 \newadjustboxenv@
2743 }
2744 % \end{macrocode}
2745 % \end{macro}
2746 %
2747 %
2748 % \begin{macro}{\renewadjustboxcmd}
2749 % \begin{macrocode}
2750 \newcommand*\renewadjustboxcmd{%
2751 \begingroup
2752 \let\@@@newadjustboxenv\@@@newadjustboxcmd
2753 \def\new@adjustbox{\renewcommand}%
2754 \newadjustboxenv@
2755 }
2756 % \end{macrocode}
2757 % \end{macro}
2758 %
2759 %
2760 % \begin{macro}{\provideadjustboxcmd}
2761 % \begin{macrocode}
2762 \newcommand*\provideadjustboxcmd{%
2763 \begingroup
2764 \let\@@@newadjustboxenv\@@@newadjustboxcmd
2765 \def\new@adjustbox{\providecommand}%
2766 \newadjustboxenv@
2767 }
2768 % \end{macrocode}
2769 % \end{macro}%
2770 %
2771 %
2772 % \begin{macro}{\provideadjustboxcmd}
2773 % \begin{macrocode}
2774 \newcommand*\declareadjustboxcmd{%
2775 \begingroup
2776 \let\@@@newadjustboxenv\@@@newadjustboxcmd
2777 \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}%
2778 \newadjustboxenv@
2779 }
2780 % \end{macrocode}
2781 % \end{macro}%
2782 %
2783 %
2784 % \begin{macro}{\adjustbox@provideenvironment}[1]{<environment name>}
2785 % Tests if the environment already exists and calls the internal
2786 % macro of \Macro\newenvironment if not. Otherwise, the two optional
2787 % and two mandatory arguments are gobbled.
2788 % \begin{macrocode}
2789 \def\adjustbox@provideenvironment#1{%
2790 \@ifundefined{#1}%
2791 {\new@environment{#1}}%
2792 {\adjustbox@gobble@oomm}%
2793 }
2794 % \end{macrocode}
2795 % \end{macro}
2796 %
2797 %
2798 % \begin{macro}{\adjustbox@gobble@oomm}
2799 % Gobbles the first optional argument.
2800 % \begin{macrocode}
2801 \newcommand*\adjustbox@gobble@oomm[1][]{%
2802 \adjustbox@gobble@@oomm
2803 }
2804 % \end{macrocode}
2805 % \end{macro}
2806 %
2807 %
2808 % \begin{macro}{\adjustbox@gobble@@oomm}
2809 % Gobbles the second optional and two mandatory arguments.
2810 % \begin{macrocode}
2811 \newcommand*\adjustbox@gobble@@oomm[3][]{%
2812 }
2813 % \end{macrocode}
2814 % \end{macro}
2815 %
2816 %
2817 % \begin{macro}{\newadjustboxenv@}[1]{<environment name>}
2818 % \begin{macrocode}
2819 \def\newadjustboxenv@#1{%
2820 \@ifnextchar{[}%
2821 {\@newadjustboxenv{#1}}%
2822 {\@@@newadjustboxenv{#1}{[0]}}%
2823 }
2824 % \end{macrocode}
2825 % \end{macro}
2826 %
2827 %
2828 % \begin{macro}{\@newadjustboxenv}[2]{<environment name>}{<optional argument>}
2829 % \begin{macrocode}
2830 \def\@newadjustboxenv#1[#2]{%
2831 \@ifnextchar{[}%
2832 {\@@newadjustboxenv{#1}{#2}}%
2833 {\@@@newadjustboxenv{#1}{[#2]}}%
2834 }
2835 % \end{macrocode}
2836 % \end{macro}
2837 %
2838 %
2839 % \begin{macro}{\@@newadjustboxenv}[3]{<environment name>}{<previous optional argument>}{<optional argument>}
2840 % \begin{macrocode}
2841 \def\@@newadjustboxenv#1#2[#3]{%
2842 \@@@newadjustboxenv{#1}{[#2][#3]}%
2843 }
2844 % \end{macrocode}
2845 % \end{macro}
2846 %
2847 %
2848 % \begin{macro}{\@@@newadjustboxenv@}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
2849 % \begin{macrocode}
2850 \def\@@@newadjustboxenv@#1#2#3{%
2851 \expandafter
2852 \endgroup
2853 \new@adjustbox{#1}#2{%
2854 \begingroup
2855 \@collectboxisenv{#1}%
2856 \@adjustbox{#3}%
2857 }{%
2858 \collectboxenvend
2859 }%
2860 }
2861 % \end{macrocode}
2862 % \end{macro}
2863 %
2864 %
2865 % \begin{macro}{\@@@newadjustboxenv}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
2866 % \begin{macrocode}
2867 \def\@@@newadjustboxenv#1#2#3{%
2868 \expandafter
2869 \endgroup
2870 \expandafter
2871 \expandafter\new@adjustbox\csname #1\endcsname#2{%
2872 \begingroup
2873 \collectboxcheckenv{#1}%
2874 \@adjustbox{#3}%
2875 }%
2876 }
2877 % \end{macrocode}
2878 % \end{macro}
2879 %
2880 %
2881 % \begin{macro}{\@@@newadjustboxcmd}[3]{<environment name>}{<optional arguments in brackets>}{<keys>}
2882 % \begin{macrocode}
2883 \def\@@@newadjustboxcmd#1#2#3{%
2884 \expandafter
2885 \endgroup
2886 \new@adjustbox{#1}#2{%
2887 \begingroup
2888 \@adjustbox{#3}%
2889 }%
2890 }
2891 % \end{macrocode}
2892 % \end{macro}
2893 %
2894 % \begin{macro}{\newadjustimage}
2895 % \begin{macrocode}
2896 \newcommand*\newadjustimage{%
2897 \begingroup
2898 \let\@@@newadjustboxenv\@@@newadjustimage
2899 \def\new@adjustbox{\newcommand}%
2900 \newadjustboxenv@
2901 }
2902 % \end{macrocode}
2903 % \end{macro}
2904 %
2905 % \begin{macro}{\renewadjustimage}
2906 % \begin{macrocode}
2907 \newcommand*\renewadjustimage{%
2908 \begingroup
2909 \let\@@@newadjustboxenv\@@@newadjustimage
2910 \def\new@adjustbox{\renewcommand}%
2911 \newadjustboxenv@
2912 }
2913 % \end{macrocode}
2914 % \end{macro}%
2915 %
2916 % \begin{macro}{\provideadjustimage}
2917 % \begin{macrocode}
2918 \newcommand*\provideadjustimage{%
2919 \begingroup
2920 \let\@@@newadjustboxenv\@@@newadjustimage
2921 \def\new@adjustbox{\providecommand}%
2922 \newadjustboxenv@
2923 }
2924 % \end{macrocode}
2925 % \end{macro}
2926 %
2927 % \begin{macro}{\declareadjustimage}
2928 % \begin{macrocode}
2929 \newcommand*\declareadjustimage{%
2930 \begingroup
2931 \let\@@@newadjustboxenv\@@@newadjustimage
2932 \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}%
2933 \newadjustboxenv@
2934 }
2935 % \end{macrocode}
2936 % \end{macro}
2937 %
2938 % \begin{macro}{\@@@newadjustimage}[3]{<macro name>}{<optional arguments in brackets>}{<keys>}
2939 % \begin{macrocode}
2940 \def\@@@newadjustimage#1#2#3{%
2941 \expandafter
2942 \endgroup
2943 \new@adjustbox{#1}#2{%
2944 \begingroup
2945 \def\@tempa####1{%
2946 \def\IMAGEFILENAME{####1}%
2947 \@adjustbox{#3}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}%
2948 }%
2949 \@tempa
2950 }%
2951 }
2952 % \end{macrocode}
2953 % \end{macro}
2954 %
2955 %
2956 % \begin{macro}{\NewAdjustImage}
2957 % \begin{macrocode}
2958 \newcommand*\adjustbox@NewAdjustImage[4]{%
2959 \adjustbox@checkforxparse
2960 #1{#2}{#3}{%
2961 \begingroup
2962 \def\@tempa####1{%
2963 \def\IMAGEFILENAME{####1}%
2964 \@adjustbox{#4}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}%
2965 }%
2966 \@tempa
2967 }%
2968 }
2969 % \end{macrocode}
2970 % \end{macro}
2971 %
2972 %
2973 % \begin{macro}{\NewAdjustImage}
2974 % \begin{macrocode}
2975 \newcommand*\NewAdjustImage{%
2976 \adjustbox@NewAdjustImage\NewDocumentCommand
2977 }
2978 % \end{macrocode}
2979 % \end{macro}
2980 %
2981 %
2982 % \begin{macro}{\RenewDocumentCommand}
2983 % \begin{macrocode}
2984 \newcommand*\RenewAdjustImage{%
2985 \adjustbox@NewAdjustImage\RenewDocumentCommand
2986 }
2987 % \end{macrocode}
2988 % \end{macro}
2989 %
2990 %
2991 % \begin{macro}{\ProvideAdjustImage}
2992 % \begin{macrocode}
2993 \newcommand*\ProvideAdjustImage{%
2994 \adjustbox@NewAdjustImage\ProvideDocumentCommand
2995 }
2996 % \end{macrocode}
2997 % \end{macro}
2998 %
2999 %
3000 % \begin{macro}{\DeclareAdjustImage}
3001 % \begin{macrocode}
3002 \newcommand*\DeclareAdjustImage{%
3003 \adjustbox@NewAdjustImage\ProvideDocumentCommand
3004 }
3005 % \end{macrocode}
3006 % \end{macro}
3007 %
3008 %
3009 % \begin{macro}{\NewAdjustImage}
3010 % \begin{macrocode}
3011 \def\adjustbox@checkforxparse{%
3012 \begingroup
3013 \expandafter\ifx\csname [email protected]\endcsname\relax
3014 \PackageError{adjustbox}{%
3015 The 'xparse' package must be loaded separately in\MessageBreak
3016 order to use the following macros: \MessageBreak
3017 \string\NewAdjustImage,
3018 \string\RenewAdjustImage, \MessageBreak
3019 \string\ProvideAdjustImage,
3020 \string\DeclareAdjustImage}{}
3021 \fi
3022 \endgroup
3023 \let\adjustbox@checkforxparse\relax
3024 }
3025 % \end{macrocode}
3026 % \end{macro}
3027 %
3028 %
3029 % ^^A )))
3030 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3031 % \subsection{Internal code adding macros} ^^A (((
3032 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3033 %
3034 % \begin{macro}{\adjbox@Gin@add}[1]{<code>}
3035 % \begin{macrocode}
3036 \def\adjbox@Gin@add#1{%
3037 \def\@tempa{#1}%
3038 \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
3039 }
3040 \def\adjbox@Gin@Add{%
3041 \Gin@esetsize
3042 \@tempswatrue
3043 \adjbox@Gin@add
3044 }
3045 % \end{macrocode}
3046 % \end{macro}
3047 %
3048 %
3049 % \begin{macro}{\newadjustboxkey}
3050 % \begin{macrocode}
3051 \newcommand\newadjustboxkey{%
3052 \@adjustboxkey\adjustbox@newkey
3053 }
3054 % \end{macrocode}
3055 % \end{macro}
3056 %
3057 %
3058 % \begin{macro}{\renewadjustboxkey}
3059 % \begin{macrocode}
3060 \newcommand\renewadjustboxkey{%
3061 \@adjustboxkey\adjustbox@renewkey
3062 }
3063 % \end{macrocode}
3064 % \end{macro}
3065 %
3066 %
3067 % \begin{macro}{\provideadjustboxkey}
3068 % \begin{macrocode}
3069 \newcommand\provideadjustboxkey{%
3070 \@adjustboxkey\adjustbox@providekey
3071 }
3072 % \end{macrocode}
3073 % \end{macro}
3074 %
3075 %
3076 % \begin{macro}{\defadjustboxkey}
3077 % \begin{macrocode}
3078 \newcommand\defadjustboxkey{%
3079 \@adjustboxkey\@secondoftwo
3080 }
3081 % \end{macrocode}
3082 % \end{macro}
3083 %
3084 %
3085 % \begin{macro}{\@adjustboxkey}[1]{<key name>}
3086 % \begin{macrocode}
3087 \def\@adjustboxkey#1{%
3088 \@ifstar
3089 {\@adjustboxkey@i#1*}%
3090 {\@adjustboxkey@i#1\relax}%
3091 }
3092 % \end{macrocode}
3093 % \end{macro}
3094 %
3095 %
3096 % \begin{macro}{\@adjustboxkey@i}
3097 % \begin{macrocode}
3098 \def\@adjustboxkey@i#1#2#3{%
3099 \@ifnextchar{[}%
3100 {\@adjustboxkey@ii#1#2{#3}}%
3101 {\@adjustboxkey@ii#1#2{#3}[\@nnil]}%
3102 }
3103 % \end{macrocode}
3104 % \end{macro}
3105 %
3106 %
3107 % \begin{macro}{\@adjustboxkey@ii}
3108 % \begin{macrocode}
3109 \def\@adjustboxkey@ii#1#2#3[#4]#5{%
3110 \ifx\@nnil#4\relax
3111 \@adjustboxkey@iii#1#2{#3}{}{#5}%
3112 \else
3113 \@adjustboxkey@iii#1#2{#3}{[#4]}{#5}%
3114 \fi
3115 }
3116 % \end{macrocode}
3117 % \end{macro}
3118 %
3119 %
3120 % \begin{macro}{\@adjustboxkey@iv}
3121 % \begin{macrocode}
3122 \def\@adjustboxkey@iii#1#2#3#4#5{%
3123 #1{#3}{%
3124 \ifx*#2\relax
3125 \define@key\adjbox@fam{#3}#4{#5}%
3126 \else
3127 \define@key\adjbox@fam{#3}#4{%
3128 \adjbox@Gin@Add{\@Collectbox{#5}}%
3129 }%
3130 \fi
3131 }{}%
3132 }
3133 % \end{macrocode}
3134 % \end{macro}
3135 %
3136 %
3137 % \begin{macro}{\define@adjboxkey}
3138 % \begin{macrocode}
3139 \def\define@adjboxkey#1#2{%
3140 \define@key\adjbox@fam{#1}{%
3141 \adjbox@Gin@Add{#2}%
3142 }%
3143 }
3144 % \end{macrocode}
3145 % \end{macro}
3146 %
3147 %
3148 % \begin{macro}{\define@adjboxkey@defvalue}
3149 % \begin{macrocode}
3150 \def\define@adjboxkey@defvalue#1#2#3{%
3151 \define@key\adjbox@fam{#1}[{#2}]{%
3152 \adjbox@Gin@Add{#3}%
3153 }%
3154 }
3155 % \end{macrocode}
3156 % \end{macro}
3157 %
3158 %
3159 % \begin{macro}{\define@adjboxkey@novalue}
3160 % \begin{macrocode}
3161 \def\define@adjboxkey@novalue#1#2{%
3162 \define@key\adjbox@fam{#1}[\@nil]{%
3163 \adjbox@novalue{##1}%
3164 \adjbox@Gin@Add{#2}%
3165 }%
3166 }
3167 % \end{macrocode}
3168 % \end{macro}
3169 %
3170 %
3171 % \begin{macro}{\adjbox@novalue}
3172 % \begin{macrocode}
3173 \def\adjbox@novalue#1{%
3174 \ifx\@nil#1\else
3175 \PackageWarning{adjustbox}{%
3176 Key '\XKV@tkey' does not await a value.\MessageBreak
3177 Given value will be ignored%
3178 }%
3179 \fi
3180 }
3181 % \end{macrocode}
3182 % \end{macro}
3183 %
3184 %
3185 % \begin{macro}{\adjustbox@newkey}
3186 % \begin{macrocode}
3187 \def\adjustbox@newkey#1#2{%
3188 \@ifundefined{KV@\adjbox@fam @#1}{#2}{%
3189 \PackageError{adjustbox}{Key '#1' already defined}{}%
3190 }%
3191 }
3192 % \end{macrocode}
3193 % \end{macro}
3194 %
3195 % \begin{macro}{\adjustbox@renewkey}
3196 % \begin{macrocode}
3197 \def\adjustbox@renewkey#1{%
3198 \@ifundefined{KV@\adjbox@fam @#1}{%
3199 \PackageError{adjustbox}{Key '#1' undefined}{}%
3200 }%
3201 }
3202 % \end{macrocode}
3203 % \end{macro}
3204 %
3205 % \begin{macro}{\adjustbox@providekey}
3206 % \begin{macrocode}
3207 \def\adjustbox@providekey#1#2{%
3208 \@ifundefined{KV@\adjbox@fam @#1}{#2}{}%
3209 }
3210 % \end{macrocode}
3211 % \end{macro}
3212 %
3213 %
3214 %
3215 % \begin{macro}{\adjbox@let@key}
3216 % Aliases one key to another.
3217 % \begin{macrocode}
3218 \def\adjbox@let@key#1#2#3{%
3219 \expandafter\let\csname KV@#1@#2\expandafter\endcsname\csname KV@#1@#3\endcsname
3220 \expandafter\let\csname KV@#1@#2@default\expandafter\endcsname\csname KV@#1@#3@default\endcsname
3221 }
3222 % \end{macrocode}
3223 % \end{macro}
3224 %
3225 %
3226 % \begin{macro}{\adjbox@copy@key}
3227 % Aliases one key to another.
3228 % \begin{macrocode}
3229 \def\adjbox@copy@key#1{%
3230 \expandafter\let
3231 \csname KV@ADJBOX@#1\expandafter\endcsname
3232 \csname KV@Gin@#1\endcsname
3233 \expandafter\let
3234 \csname KV@ADJBOX@#1@default\expandafter\endcsname
3235 \csname KV@Gin@#1@default\endcsname
3236 }
3237 % \end{macrocode}
3238 % \end{macro}
3239 %
3240 %
3241 % ^^A )))
3242 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3243 % \subsection{Keys for trimming, clipping, viewport and margin} ^^A (((
3244 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3245 %
3246 %
3247 % \begin{key}{adjbox}{viewport}
3248 % \begin{macrocode}
3249 \define@key{adjbox}{viewport}{%
3250 \def\adjustbox@content{%
3251 \@trimclip{%
3252 \ifGin@clip
3253 \expandafter\@clipvpbox
3254 \else
3255 \expandafter\@viewportbox
3256 \fi
3257 }{#1}%
3258 }%
3259 }
3260 % \end{macrocode}
3261 % \end{key}
3262 %
3263 %
3264 % \begin{key}{adjbox}{Viewport}
3265 % \begin{macrocode}
3266 \define@adjboxkey{Viewport}{\trimbox@s{#1}}%
3267 % \end{macrocode}
3268 % \end{key}
3269 %
3270 %
3271 % \begin{key}{adjbox}{trim}
3272 % \begin{macrocode}
3273 \define@key{adjbox}{trim}{%
3274 \def\adjustbox@content{%
3275 \@trimclip{%
3276 \ifGin@clip
3277 \expandafter\@clipbox
3278 \else
3279 \expandafter\@trimbox
3280 \fi
3281 }{#1}%
3282 }%
3283 }
3284 % \end{macrocode}
3285 % \end{key}
3286 %
3287 %
3288 % \begin{key}{adjbox}{Trim}
3289 % \begin{macrocode}
3290 \define@adjboxkey{Trim}{\trimbox@{#1}}%
3291 % \end{macrocode}
3292 % \end{key}
3293 %
3294 %
3295 % \begin{key}{adjbox}{Clip}
3296 % \begin{macrocode}
3297 \define@adjboxkey{Clip}{\clipbox@{#1}}
3298 % \end{macrocode}
3299 % \end{key}
3300 %
3301 % \begin{key}{adjbox}{rndcorners}
3302 % \begin{macrocode}
3303 \define@adjboxkey{rndcorners}{\rndcornersbox@{#1}}
3304 % \end{macrocode}
3305 % \end{key}
3306 %
3307 % \begin{key}{adjbox}{rndframe}
3308 % \begin{macrocode}
3309 \define@adjboxkey{rndframe}{%
3310 \@ifnextchar\bgroup{%
3311 \adjbox@rndframe{sep=\z@}%
3312 }{%
3313 \adjbox@rndframe{sep=\z@}{}%
3314 }#1\@nnil
3315 }
3316 % \end{macrocode}
3317 % \end{key}
3318 %
3319 % \begin{key}{adjbox}{rndfbox}
3320 % \begin{macrocode}
3321 \define@adjboxkey{rndfbox}{%
3322 \@ifnextchar\bgroup{%
3323 \adjbox@rndframe{}%
3324 }{%
3325 \adjbox@rndframe{}{}%
3326 }#1\@nnil
3327 }
3328
3329 \def\adjbox@rndframe#1#2#3\@nnil{%
3330 \rndfbox[{#1,#2}]{#3}%
3331 }
3332 % \end{macrocode}
3333 % \end{key}
3334 %
3335 %
3336 % \begin{key}{adjbox}{Clip*}
3337 % \begin{macrocode}
3338 \define@adjboxkey{Clip*}{\clipbox@s{#1}}
3339 % \end{macrocode}
3340 % \end{key}
3341 %
3342 %
3343 % \begin{key}{adjbox}{margin}
3344 % \begin{macrocode}
3345 \define@adjboxkey{margin}{\marginbox@{#1}}
3346 % \end{macrocode}
3347 % \end{key}
3348 %
3349 % \begin{key}{adjbox}{margin*}
3350 % \begin{macrocode}
3351 \define@adjboxkey{margin*}{\marginbox@s{#1}}
3352 % \end{macrocode}
3353 % \end{key}
3354 %
3355 % \begin{key}{adjbox}{padding}
3356 % Alias for \Key{margin}.
3357 % \begin{macrocode}
3358 \adjbox@let@key\adjbox@fam{padding}{margin}
3359 % \end{macrocode}
3360 % \end{key}
3361 %
3362 % \begin{key}{adjbox}{padding*}
3363 % Alias for \Key{margin*}.
3364 % \begin{macrocode}
3365 \adjbox@let@key\adjbox@fam{padding*}{margin*}
3366 % \end{macrocode}
3367 % \end{key}
3368 %
3369 %
3370 % \begin{macrocode}
3371 \adjbox@copy@key{bbllx}
3372 \adjbox@copy@key{bblly}
3373 \adjbox@copy@key{bburx}
3374 \adjbox@copy@key{bbury}
3375 \adjbox@copy@key{bb}
3376 \adjbox@copy@key{command}
3377 \adjbox@copy@key{decodearray}
3378 \adjbox@copy@key{draft}
3379 \adjbox@copy@key{ext}
3380 \adjbox@copy@key{intent}
3381 \adjbox@copy@key{interpolate}
3382 \adjbox@copy@key{maskarray}
3383 \adjbox@copy@key{natheight}
3384 \adjbox@copy@key{natwidth}
3385 \adjbox@copy@key{ocobjnum}
3386 \adjbox@copy@key{ocobjref}
3387 \adjbox@copy@key{origin}
3388 \adjbox@copy@key{pagebox}
3389 \adjbox@copy@key{page}
3390 \adjbox@copy@key{quiet}
3391 \adjbox@copy@key{read}
3392 \adjbox@copy@key{resetcolor}
3393 \adjbox@copy@key{resolution}
3394 \adjbox@copy@key{type}
3395 \adjbox@copy@key{xmpfile}
3396 % \end{macrocode}
3397 %
3398 %
3399 % ^^A )))
3400 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3401 % \subsection{Round corners} ^^A (((
3402 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3403 %
3404 % \begin{macro}{\rndcornersbox}
3405 % \begin{macrocode}
3406 \newcommand\rndcornersbox{%
3407 \collectboxcheckenv{rndcornersbox}%
3408 \rndcornersbox@
3409 }
3410 \def\rndcornersbox@#1{%
3411 \collectbox{\@trimclip\@clipcornersofbox{#1}}%
3412 }
3413 % \end{macrocode}
3414 % \end{macro}
3415 %
3416 % \begin{macro}{\rndframebox}
3417 % \begin{macrocode}
3418 \newcommand\rndframebox{%
3419 \collectboxcheckenv{rndframebox}%
3420 \rndframebox@
3421 }
3422 \newcommand*\rndframebox@[2][]{%
3423 \collectbox{\@trimclip{\rndframearoundbox@{sep=\z@,#1}}{#2}}%
3424 }
3425 % \end{macrocode}
3426 % \end{macro}
3427 %
3428 % \begin{macro}{\rndfbox}
3429 % \begin{macrocode}
3430 \newcommand\rndfbox{%
3431 \collectboxcheckenv{rndfbox}%
3432 \rndfbox@
3433 }
3434 \newcommand*\rndfbox@[2][]{%
3435 \collectbox{\@trimclip{\rndframearoundbox@{#1}}{#2}}%
3436 }
3437 % \end{macrocode}
3438 % \end{macro}
3439 %
3440 %
3441 % \begin{macro}{\rndframearoundbox@}
3442 % \begin{macrocode}
3443 \newif\ifadjbox@rndframe@clip
3444 \def\rndframearoundbox@#1#2#3#4#5#6{%
3445 \setkeys{adjbox@rndframe}{#1}%
3446 \@rndframearoundbox{#2}{#3}{#4}{#5}{#6}{\ifadjbox@rndframe@clip\relax\fi}%
3447 }
3448 \define@key{adjbox@rndframe}{width}{%
3449 \adjsetlength\fboxrule{#1}%
3450 }
3451 \define@key{adjbox@rndframe}{sep}{%
3452 \adjsetlength\fboxsep{#1}%
3453 }
3454 \define@key{adjbox@rndframe}{color}{%
3455 \def\adjbox@rndframe@color{\color{#1}}%
3456 }
3457 \define@key{adjbox@rndframe}{color*}{%
3458 \def\adjbox@rndframe@color{#1}%
3459 }
3460 \let\adjbox@rndframe@color\relax
3461 \define@key{adjbox@rndframe}{clip}[true]{%
3462 \csname adjbox@rndframe@clip#1\endcsname
3463 }
3464 % \end{macrocode}
3465 % \end{macro}
3466 %
3467 %
3468 % \begin{macrocode}
3469 % \DescribeKey{color}'='{<color>}
3470 % \DescribeKey{color*}'='{<color command>}
3471 % \DescribeKey{width}'='{<rule width>}
3472 % \DescribeKey{sep}'='{<rule separation>}
3473 % \end{macrocode}
3474 %
3475 % ^^A )))
3476 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3477 % \subsection{Scaling and rotating keys} ^^A (((
3478 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3479 %
3480 % \begin{key}{adjbox}{scale}
3481 % \begin{macrocode}
3482 \define@key\adjbox@fam{scale}{%
3483 \@ifnextchar\bgroup{%
3484 \adjbox@scale@xy
3485 }{%
3486 \adjbox@scale@x
3487 }#1\@nnil
3488 }
3489 % \end{macrocode}
3490 % \end{key}
3491 %
3492 % \begin{macro}{\adjbox@scale@x}
3493 % \begin{macrocode}
3494 \def\adjbox@scale@x#1\@nnil{%
3495 \adjbox@scale@xy{#1}{#1}\@nnil%
3496 }
3497 % \end{macrocode}
3498 % \end{macro}
3499 %
3500 % \begin{macro}{\adjbox@scale@xy}
3501 % \begin{macrocode}
3502 \def\adjbox@scale@xy#1#2\@nnil{%
3503 \if@tempswa
3504 \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
3505 \else
3506 \def\Gin@req@sizes{%
3507 \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
3508 \Gin@req@height\Gin@scaley\Gin@nat@height
3509 \Gin@req@width\Gin@scalex\Gin@nat@width}%
3510 \fi
3511 \@tempswatrue
3512 }
3513 % \end{macrocode}
3514 % \end{macro}
3515 %
3516 %
3517 % \begin{key}{adjbox}{reflect}
3518 % Taken from the \Key{scale} key of the \pkg{graphicx} package.
3519 % Open question: why is \Macro\Gin@esetsize not called?
3520 % \begin{macrocode}
3521 \define@key\adjbox@fam{reflect}[]{%
3522 \adjbox@scale@xy{-1}{1}\@nnil
3523 }
3524 % \end{macrocode}
3525 % \end{key}
3526 %
3527 %
3528 % \begin{key}{adjbox}{rotate}
3529 % New alias of existing |angle| key.
3530 % \begin{macrocode}
3531 \expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
3532 % \end{macrocode}
3533 % \end{key}
3534 %
3535 %
3536 %
3537 % ^^A )))
3538 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3539 % \subsection{Horizontal alignment keys} ^^A (((
3540 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3541 %
3542 %
3543 % \begin{macro}{\adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>}
3544 % \begin{macrocode}
3545 \def\adjbox@halign#1#2#3{%
3546 \@collectbox{\@adjbox@halign{#1}{#2}{#3}}%
3547 }
3548 % \end{macrocode}
3549 % \end{macro}
3550 %
3551 %
3552 % \begin{macro}{\@adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>}
3553 % \begin{macrocode}
3554 \def\@adjbox@halign#1#2#3{%
3555 \begingroup
3556 \adjsetlength\@tempdima{#1}%
3557 \leavevmode\hb@xt@\the\@tempdima{#2\BOXCONTENT#3}%
3558 \endgroup
3559 }
3560 % \end{macrocode}
3561 % \end{macro}
3562 %
3563 % \begin{key}{adjbox}{center}[1]{<official width>}
3564 % \begin{macrocode}
3565 \define@adjboxkey@defvalue{center}{\linewidth}{\adjbox@halign{#1}\hss\hss}
3566 % \end{macrocode}
3567 % \end{key}
3568 %
3569 % \begin{key}{adjbox}{left}[1]{<official width>}
3570 % \begin{macrocode}
3571 \define@adjboxkey@defvalue{left}{\linewidth}{\adjbox@halign{#1}\relax\hss}
3572 % \end{macrocode}
3573 % \end{key}
3574 %
3575 % \begin{key}{adjbox}{right}[1]{<official width>}
3576 % \begin{macrocode}
3577 \define@adjboxkey@defvalue{right}{\linewidth}{\adjbox@halign{#1}\hss\relax}
3578 % \end{macrocode}
3579 % \end{key}
3580 %
3581 %
3582 % \begin{macro}{\centerbox}[1]{<official width>}
3583 % \begin{macrocode}
3584 \newcommand\centerbox[1][\linewidth]{%
3585 \collectboxcheckenv{centerbox}%
3586 \noindent
3587 \adjbox@halign{#1}\hss\hss
3588 }
3589 % \end{macrocode}
3590 % \end{macro}
3591 %
3592 %
3593 % \begin{macro}{\leftalignbox}[1]{<official width>}
3594 % \begin{macrocode}
3595 \newcommand\leftalignbox[1][\linewidth]{%
3596 \collectboxcheckenv{leftalignbox}%
3597 \noindent
3598 \adjbox@halign{#1}\relax\hss
3599 }
3600 % \end{macrocode}
3601 % \end{macro}
3602 %
3603 %
3604 % \begin{macro}{\rightalignbox}[1]{<official width>}
3605 % \begin{macrocode}
3606 \newcommand\rightalignbox[1][\linewidth]{%
3607 \collectboxcheckenv{rightalignbox}%
3608 \noindent
3609 \adjbox@halign{#1}\hss\relax
3610 }
3611 % \end{macrocode}
3612 % \end{macro}
3613 %
3614 %
3615 % \begin{key}{adjbox}{outer}[1]{<official width>}
3616 % \begin{macrocode}
3617 \define@adjboxkey@defvalue{outer}{\linewidth}{%
3618 \outersidebox[{#1}]%
3619 }
3620 % \end{macrocode}
3621 % \end{key}
3622 %
3623 %
3624 % \begin{key}{adjbox}{inner}[1]{<official width>}
3625 % \begin{macrocode}
3626 \define@adjboxkey@defvalue{inner}{\linewidth}{%
3627 \innersidebox[{#1}]%
3628 }
3629 % \end{macrocode}
3630 % \end{key}
3631 %
3632 %
3633 % \begin{macro}{\outersidebox}[1]{<official width>}
3634 % \begin{macrocode}
3635 \newcommand\outersidebox[1][\linewidth]{%
3636 \collectboxcheckenv{outersidebox}%
3637 \noindent
3638 \adjbox@halign{#1}{%
3639 \checkoddpage
3640 \ifoddpageoroneside
3641 \hss
3642 \else
3643 \relax
3644 \fi
3645 }{%
3646 \ifoddpageoroneside
3647 \relax
3648 \else
3649 \hss
3650 \fi
3651 }%
3652 }
3653 % \end{macrocode}
3654 % \end{macro}
3655 %
3656 %
3657 % \begin{macro}{\innersidebox}[1]{<official width>}
3658 % \begin{macrocode}
3659 \newcommand\innersidebox[1][\linewidth]{%
3660 \collectboxcheckenv{innersidebox}%
3661 \noindent
3662 \adjbox@halign{#1}{%
3663 \checkoddpage
3664 \ifoddpageoroneside
3665 \relax
3666 \else
3667 \hss
3668 \fi
3669 }{%
3670 \ifoddpageoroneside
3671 \hss
3672 \else
3673 \relax
3674 \fi
3675 }%
3676 }
3677 % \end{macrocode}
3678 % \end{macro}
3679 %
3680 %
3681 % \begin{key}{adjbox}{pagecenter}[1]{<official width>}
3682 % \begin{macrocode}
3683 \define@key\adjbox@fam{pagecenter}[\linewidth]{%
3684 \noindent\leavevmode
3685 \adjbox@Gin@Add{\pagecenterbox[{#1}]}%
3686 }%
3687 % \end{macrocode}
3688 % \end{key}
3689 %
3690 %
3691 % \begin{key}{adjbox}{pageleftalign}[1]{<official width>}
3692 % \begin{macrocode}
3693 \define@key\adjbox@fam{pageleftalign}[\linewidth]{%
3694 \noindent\leavevmode
3695 \adjbox@Gin@Add{\pageleftalignbox[{#1}]}%
3696 }%
3697 % \end{macrocode}
3698 % \end{key}
3699 %
3700 %
3701 % \begin{key}{adjbox}{pagerightalign}[1]{<official width>}
3702 % \begin{macrocode}
3703 \define@key\adjbox@fam{pagerightalign}[\linewidth]{%
3704 \noindent\leavevmode
3705 \adjbox@Gin@Add{\pagerightalignbox[{#1}]}%
3706 }%
3707 % \end{macrocode}
3708 % \end{key}
3709 %
3710 %
3711 % \begin{key}{adjbox}{pageinner}[1]{<official width>}
3712 % \begin{macrocode}
3713 \define@key\adjbox@fam{pageinner}[\linewidth]{%
3714 \noindent\leavevmode
3715 \adjbox@Gin@Add{\pageinnerbox[{#1}]}%
3716 }
3717 % \end{macrocode}
3718 % \end{key}
3719 %
3720 %
3721 % \begin{key}{adjbox}{pageouter}[1]{<official width>}
3722 % \begin{macrocode}
3723 \define@key\adjbox@fam{pageouter}[\linewidth]{%
3724 \noindent\leavevmode
3725 \adjbox@Gin@Add{\pageouterbox[{#1}]}%
3726 }
3727 % \end{macrocode}
3728 % \end{key}
3729 %
3730 %
3731 % \begin{key}{adjbox}{textareacenter}[1]{<official width>}
3732 % \begin{macrocode}
3733 \define@key\adjbox@fam{textareacenter}[\linewidth]{%
3734 \noindent\leavevmode
3735 \adjbox@Gin@Add{\textareacenterbox[{#1}]}%
3736 }%
3737 % \end{macrocode}
3738 % \end{key}
3739 %
3740 %
3741 % \begin{key}{adjbox}{textarealeftalign}[1]{<official width>}
3742 % \begin{macrocode}
3743 \define@key\adjbox@fam{textarealeftalign}[\linewidth]{%
3744 \noindent\leavevmode
3745 \adjbox@Gin@Add{\textarealeftalignbox[{#1}]}%
3746 }%
3747 % \end{macrocode}
3748 % \end{key}
3749 %
3750 %
3751 % \begin{key}{adjbox}{textarearightalign}[1]{<official width>}
3752 % \begin{macrocode}
3753 \define@key\adjbox@fam{textarearightalign}[\linewidth]{%
3754 \noindent\leavevmode
3755 \adjbox@Gin@Add{\textarearightalignbox[{#1}]}%
3756 }%
3757 % \end{macrocode}
3758 % \end{key}
3759 %
3760 %
3761 % \begin{key}{adjbox}{textareainner}[1]{<official width>}
3762 % \begin{macrocode}
3763 \define@key\adjbox@fam{textareainner}[\linewidth]{%
3764 \noindent\leavevmode
3765 \adjbox@Gin@Add{\textareainnerbox[{#1}]}%
3766 }
3767 % \end{macrocode}
3768 % \end{key}
3769 %
3770 %
3771 % \begin{key}{adjbox}{textareaouter}[1]{<official width>}
3772 % \begin{macrocode}
3773 \define@key\adjbox@fam{textareaouter}[\linewidth]{%
3774 \noindent\leavevmode
3775 \adjbox@Gin@Add{\textareaouterbox[{#1}]}%
3776 }
3777 % \end{macrocode}
3778 % \end{key}
3779 %
3780 %
3781 % \begin{macro}{\pagecenterbox}[1]{<official width>}
3782 % \begin{macrocode}
3783 \newcommand\pagecenterbox[1][\linewidth]{%
3784 \collectboxcheckenv{pagecenterbox}%
3785 \noindent\leavevmode\checkoddpage
3786 \@collectbox{\@pagecenterbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi+.5\paperwidth-.5\@tempdimc-\@totalleftmargin}}%
3787 }
3788 % \end{macrocode}
3789 % \end{macro}
3790 %
3791 %
3792 % \begin{macro}{\@pagecenterbox}[2]{<official width>}{<lap amount>}
3793 % \begin{macrocode}
3794 \def\@pagecenterbox#1#2{%
3795 \adjsetlength\@tempdimc{#1}%
3796 \ifdim\@tempdimc<\z@
3797 \@tempdimc=\z@
3798 \fi
3799 \adjsetlength\@tempdima{#2}%
3800 \ifdim\@tempdima<\z@
3801 \@tempdimb=-\@tempdima
3802 \else
3803 \@tempdimb=\@tempdima
3804 \fi
3805 \ifdim\@tempdima<\z@
3806 \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}\hss}\hskip\@tempdimc}%
3807 \else
3808 \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}}\hss}%
3809 \fi
3810 }
3811 % \end{macrocode}
3812 % \end{macro}
3813 %
3814 %
3815 % \begin{macro}{\textareacenterbox}[1]{<official width>}
3816 % \begin{macrocode}
3817 \newcommand\textareacenterbox[1][\linewidth]{%
3818 \collectboxcheckenv{textareacenterbox}%
3819 \noindent\leavevmode
3820 \@collectbox{\@pagecenterbox{#1}{-\@totalleftmargin+.5\textwidth-.5\linewidth}}%
3821 }
3822 % \end{macrocode}
3823 % \end{macro}%
3824 %
3825 %
3826 % \begin{macro}{\pageleftalignbox}[1]{<official width>}
3827 % \begin{macrocode}
3828 \newcommand\pageleftalignbox[1][\linewidth]{%
3829 \collectboxcheckenv{pageleftalignbox}%
3830 \noindent\leavevmode\checkoddpage
3831 \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin}}%
3832 }
3833 % \end{macrocode}
3834 % \end{macro}%
3835 %
3836 %
3837 % \begin{macro}{\pagerightalignbox}[1]{<official width>}
3838 % Note: \Macro\@tempdimc holds the official width inside \Macro\@lapbox.
3839 % \begin{macrocode}
3840 \newcommand\pagerightalignbox[1][\linewidth]{%
3841 \collectboxcheckenv{pagerightalignbox}%
3842 \noindent\leavevmode\checkoddpage
3843 \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin+\paperwidth-(#1)}}%
3844 }
3845 % \end{macrocode}
3846 % \end{macro}%
3847 %
3848 %
3849 % \begin{macro}{\textarealeftalignbox}[1]{<official width>}
3850 % \begin{macrocode}
3851 \newcommand\textarealeftalignbox[1][\linewidth]{%
3852 \collectboxcheckenv{textarealeftalignbox}%
3853 \noindent\leavevmode\checkoddpage
3854 \@collectbox{\@textarealeftalignbox{#1}}%
3855 }
3856 % \end{macrocode}
3857 % \end{macro}%
3858 %
3859 %
3860 % \begin{macro}{\@textarealeftalignbox}[1]{<official width>}
3861 % \begin{macrocode}
3862 \def\@textarealeftalignbox#1{%
3863 \adjsetlength\@tempdima{\@totalleftmargin}%
3864 \adjsetlength\@tempdimc{#1}%
3865 \ifdim\@tempdimc<\z@
3866 \@tempdimc=\z@
3867 \fi
3868 \leavevmode
3869 \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdima{\usebox\collectedbox\hss}\hskip\@tempdimc}%
3870 }
3871 % \end{macrocode}
3872 % \end{macro}%
3873 %
3874 %
3875 % \begin{macro}{\textarearightalignbox}[1]{<official width>}
3876 % \begin{macrocode}
3877 \newcommand\textarearightalignbox[1][\linewidth]{%
3878 \collectboxcheckenv{textarearightalignbox}%
3879 \noindent\leavevmode\checkoddpage
3880 \@collectbox{\@textarearightalignbox{#1}{+\textwidth}}%
3881 }
3882 % \end{macrocode}
3883 % \end{macro}%
3884 %
3885 %
3886 % \begin{macro}{\@textarearightalignbox}[1]{<official width>}
3887 % \begin{macrocode}
3888 \def\@textarearightalignbox#1#2{%
3889 \adjsetlength\@tempdimc{#1}%
3890 \ifdim\@tempdimc<\z@
3891 \@tempdimc=\z@
3892 \fi
3893 \adjsetlength\@tempdima{-\@totalleftmargin+\textwidth-\@tempdimc}%
3894 \ifdim\@tempdima<\z@
3895 \@tempdima=-\@tempdima
3896 \fi
3897 \leavevmode
3898 \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdima{\hss\usebox\collectedbox}\hss}%
3899 }
3900 % \end{macrocode}
3901 % \end{macro}%
3902 %
3903 %
3904 % \begin{macro}{pageinnerbox}
3905 % \begin{macrocode}
3906 \newcommand\pageinnerbox{%
3907 \noindent\leavevmode\checkoddpage
3908 \ifoddpageoroneside
3909 \expandafter\pageleftalignbox
3910 \else
3911 \expandafter\pagerightalignbox
3912 \fi
3913 }%
3914 % \end{macrocode}
3915 % \end{macro}
3916 %
3917 %
3918 % \begin{macro}{pageouterbox}
3919 % \begin{macrocode}
3920 \newcommand\pageouterbox{%
3921 \noindent\leavevmode\checkoddpage
3922 \ifoddpageoroneside
3923 \expandafter\pagerightalignbox
3924 \else
3925 \expandafter\pageleftalignbox
3926 \fi
3927 }%
3928 % \end{macrocode}
3929 % \end{macro}
3930 %
3931 %
3932 % \begin{macro}{textareaouterbox}
3933 % \begin{macrocode}
3934 \newcommand\textareainnerbox{%
3935 \noindent\leavevmode\checkoddpage
3936 \ifoddpageoroneside
3937 \expandafter\textarealeftalignbox
3938 \else
3939 \expandafter\textarearightalignbox
3940 \fi
3941 }%
3942 % \end{macrocode}
3943 % \end{macro}
3944 %
3945 %
3946 % \begin{macro}{textareaouterbox}
3947 % \begin{macrocode}
3948 \newcommand\textareaouterbox{%
3949 \noindent\leavevmode\checkoddpage
3950 \ifoddpageoroneside
3951 \expandafter\textarearightalignbox
3952 \else
3953 \expandafter\textarealeftalignbox
3954 \fi
3955 }%
3956 % \end{macrocode}
3957 % \end{macro}%
3958 %
3959 %
3960 % \begin{macrocode}
3961 \IfFileExists{ifoddpage.sty}{%
3962 \RequirePackage{ifoddpage}%
3963 }{%
3964 \def\checkoddpage{%
3965 \PackageError{adjustbox}{%
3966 The used key, macro or environment requires \MessageBreak
3967 the 'ifoddpage' package which is not installed!}{}%
3968 }
3969 }%
3970 % \end{macrocode}
3971 %
3972 %
3973 % \begin{key}{adjbox}{noindent}
3974 % \begin{macrocode}
3975 \define@key\adjbox@fam{noindent}[]{%
3976 \noindent
3977 }
3978 % \end{macrocode}
3979 % \end{key}%
3980 %
3981 % \begin{key}{adjbox}{leavevmode}
3982 % \begin{macrocode}
3983 \define@key\adjbox@fam{leavevmode}[]{%
3984 \leavevmode
3985 }
3986 % \end{macrocode}
3987 % \end{key}%
3988 %
3989 % \begin{macro}{\adjbox@fam}{process}
3990 % \begin{macrocode}
3991 \define@key\adjbox@fam{process}[]{%
3992 \sbox\collectedbox{\adjbox@esetsize\the\toks@}%
3993 \collectbox@setdims
3994 \def\adjustbox@content{\usebox\collectedbox}%
3995 \toks@{{\adjustbox@content}}
3996 }
3997 % \end{macrocode}
3998 % \end{macro}
3999 %
4000 % ^^A )))
4001 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4002 % \subsection{Vertical alignment keys} ^^A (((
4003 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4004 %
4005 % \begin{key}{adjbox}{raise}
4006 % \begin{macrocode}
4007 \define@key\adjbox@fam{raise}{%
4008 \@ifnextchar\bgroup{%
4009 \adjbox@raise
4010 }{%
4011 \adjbox@raise{#1}{}{}%
4012 }#1{}{}{}\@nnil
4013 }
4014 % \end{macrocode}
4015 % \end{key}
4016 %
4017 %
4018 % \begin{macro}{\adjbox@raise}
4019 % \begin{macrocode}
4020 \def\adjbox@raise#1#2#3#4\@nnil{%
4021 \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
4022 }
4023 % \end{macrocode}
4024 % \end{macro}
4025 %
4026 %
4027 % \begin{macro}{\adjbox@raisebox}[3]{raise amount}{height}{depth}
4028 % \begin{macrocode}
4029 \def\adjbox@raisebox#1#2#3{%
4030 \@collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
4031 }
4032 % \end{macrocode}
4033 % \end{macro}
4034 %
4035 %
4036 % \begin{macro}{\adjbox@@raisebox}[3]{raise amount}{height}{depth}
4037 % \begin{macrocode}
4038 \def\adjbox@@raisebox#1#2#3{%
4039 \ifx\@nnil#1\@nnil
4040 \setbox\@tempboxa\copy\collectedbox
4041 \else
4042 \adjsetlength\@tempdima{#1}%
4043 \setbox\@tempboxa\hbox{\raise\@tempdima\copy\collectedbox}%
4044 \fi
4045 \ifx\@nnil#2\@nnil\else
4046 \adjsetlength\@tempdima{#2}%
4047 \ht\@tempboxa\@tempdima
4048 \fi
4049 \ifx\@nnil#3\@nnil\else
4050 \adjsetlength\@tempdima{#3}%
4051 \dp\@tempboxa\@tempdima
4052 \fi
4053 \leavevmode
4054 \box\@tempboxa
4055 }
4056 % \end{macrocode}
4057 % \end{macro}
4058 %
4059 %
4060 % \begin{key}{adjbox}{valign}
4061 % \begin{macrocode}
4062 \define@key\adjbox@fam{valign}{%
4063 \expandafter\adjbox@Gin@Add\expandafter{\csname adjbox@valign@#1\endcsname}%
4064 }
4065 % \end{macrocode}
4066 % \end{key}
4067 %
4068 %
4069 % \begin{macro}{\adjboxvtop}
4070 % \begin{macrocode}
4071 \def\adjboxvtop{\ht\strutbox}
4072 % \end{macrocode}
4073 % \end{macro}
4074 % \begin{macro}{\adjboxvcenter}
4075 % \begin{macrocode}
4076 \def\adjboxvcenter{1ex}
4077 % \end{macrocode}
4078 % \end{macro}
4079 % \begin{macro}{\adjboxvbottom}
4080 % \begin{macrocode}
4081 \def\adjboxvbottom{-\dp\strutbox}
4082 % \end{macrocode}
4083 % \end{macro}
4084 %
4085 %
4086 % \begin{macro}{\adjbox@valign@t}
4087 % \begin{macrocode}
4088 \def\adjbox@valign@t{%
4089 \adjbox@raisebox{-\height+\adjboxvtop}{}{}%
4090 }
4091 % \end{macrocode}
4092 % \end{macro}
4093 %
4094 %
4095 % \begin{macro}{\adjbox@valign@T}
4096 % \begin{macrocode}
4097 \def\adjbox@valign@T{%
4098 \adjbox@raisebox{-\height}{}{}%
4099 }
4100 % \end{macrocode}
4101 % \end{macro}
4102 %
4103 %
4104 % \begin{macro}{\adjbox@valign@M}
4105 % \begin{macrocode}
4106 \def\adjbox@valign@M{%
4107 \adjbox@raisebox{.5\depth-.5\height}{}{}%
4108 }
4109 % \end{macrocode}
4110 % \end{macro}
4111 %
4112 %
4113 % \begin{macro}{\adjbox@valign@m}
4114 % \begin{macrocode}
4115 \def\adjbox@valign@m{%
4116 \adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}%
4117 }
4118 % \end{macrocode}
4119 % \end{macro}
4120 %
4121 %
4122 % \begin{macro}{\adjbox@valign@c}
4123 % \begin{macrocode}
4124 \def\adjbox@valign@c#1{%
4125 \leavevmode
4126 \hbox{%
4127 $\vcenter{\hbox{#1}}\m@th$%
4128 }%
4129 }
4130 % \end{macrocode}
4131 % \end{macro}
4132 %
4133 %
4134 % \begin{macro}{\adjbox@valign@b}
4135 % \begin{macrocode}
4136 \def\adjbox@valign@b{%
4137 \adjbox@raisebox{\depth+\adjboxvbottom}{}{}%
4138 }
4139 % \end{macrocode}
4140 % \end{macro}
4141 %
4142 %
4143 % \begin{macro}{\adjbox@valign@B}
4144 % \begin{macrocode}
4145 \def\adjbox@valign@B{%
4146 \adjbox@raisebox{\depth}{}{}%
4147 }
4148 % \end{macrocode}
4149 % \end{macro}
4150 %
4151 %
4152 % ^^A )))
4153 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4154 % \subsection{Set vertical sizes} ^^A (((
4155 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156 %
4157 % \begin{key}{adjbox}{set height}
4158 % \begin{macrocode}
4159 \define@adjboxkey{set height}{\adjbox@raisebox{}{#1}{}}
4160 % \end{macrocode}
4161 % \end{key}
4162 %
4163 %
4164 % \begin{key}{adjbox}{set depth}
4165 % \begin{macrocode}
4166 \define@adjboxkey{set depth}{\adjbox@raisebox{}{}{#1}}
4167 % \end{macrocode}
4168 % \end{key}
4169 %
4170 % \begin{key}{adjbox}{set vsize}
4171 % Uses the same code like \Key{raise} but with the raise value of 0pt,
4172 % i.e.\ only sets the height and depth.
4173 % \begin{macrocode}
4174 \define@adjboxkey{set vsize}{\adjbox@raisebox{}#1}
4175 % \end{macrocode}
4176 % \end{key}
4177 %
4178 %
4179 % ^^A )))
4180 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4181 % \subsection{Vertical spacing} ^^A (((
4182 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4183 %
4184 % \begin{key}{adjbox}{vspace}
4185 % \begin{macrocode}
4186 \define@key\adjbox@fam{vspace}{%
4187 \adjbox@vskip#1 {} \@nnil{}%
4188 }
4189 % \end{macrocode}
4190 % \end{key}
4191 %
4192 % \begin{key}{adjbox}{vspace*}
4193 % \begin{macrocode}
4194 \define@key\adjbox@fam{vspace*}{%
4195 \adjbox@vskip#1 {} \@nnil*%
4196 }
4197 % \end{macrocode}
4198 % \end{key}
4199 %
4200 % \begin{macro}{\adjbox@vskip}
4201 % \begin{macrocode}
4202 \def\adjbox@vskip#1 #2 #3\@nnil#4{%
4203 \ifx\@nnil#2\@nnil
4204 \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#1}}%
4205 \else
4206 \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#2}}%
4207 \fi
4208 }
4209 % \end{macrocode}
4210 % \end{macro}
4211 %
4212 %
4213 % ^^A )))
4214 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4215 % \subsection{Minimum and maximum size keys and macros} ^^A (((
4216 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4217 %
4218 % \begin{key}{adjbox}{min width}
4219 % \begin{macrocode}
4220 \define@adjboxkey{min width}{\@minsizebox\height{#1}!}
4221 % \end{macrocode}
4222 % \end{key}
4223 %
4224 %
4225 % \begin{key}{adjbox}{max width}
4226 % \begin{macrocode}
4227 \define@adjboxkey{max width}{\@maxsizebox\height{#1}!}
4228 % \end{macrocode}
4229 % \end{key}
4230 %
4231 %
4232 % \begin{key}{adjbox}{min height}
4233 % \begin{macrocode}
4234 \define@adjboxkey{min height}{\@minsizebox\height!{#1}}
4235 % \end{macrocode}
4236 % \end{key}
4237 %
4238 %
4239 % \begin{key}{adjbox}{max height}
4240 % \begin{macrocode}
4241 \define@adjboxkey{max height}{\@maxsizebox\height!{#1}}
4242 % \end{macrocode}
4243 % \end{key}
4244 %
4245 %
4246 % \begin{key}{adjbox}{min totalheight}
4247 % \begin{macrocode}
4248 \define@adjboxkey{min totalheight}{\@minsizebox\totalheight!{#1}}
4249 % \end{macrocode}
4250 % \end{key}
4251 %
4252 %
4253 % \begin{key}{adjbox}{max totalheight}
4254 % \begin{macrocode}
4255 \define@adjboxkey{max totalheight}{\@maxsizebox\totalheight!{#1}}
4256 % \end{macrocode}
4257 % \end{key}
4258 %
4259 %
4260 %
4261 % \begin{macro}{\adjbox@Gin@sizeadd}
4262 % Checks if key-value is actually two arguments. If not it is doubled.
4263 % E.g.: \verb+min size=\A+ is the same as \verb+min size={\A}{\A}+
4264 % \begin{macrocode}
4265 \def\adjbox@Gin@sizeadd#1#2\@nnil{%
4266 \@ifnextchar\bgroup{%
4267 \adjbox@Gin@Add{#1#2}%
4268 \remove@to@nnil
4269 }{%
4270 \adjbox@Gin@Add{#1{#2}{#2}}%
4271 \remove@to@nnil
4272 }#2\@nnil
4273 }
4274 % \end{macrocode}
4275 % \end{macro}
4276 %
4277 %
4278 % \begin{key}{adjbox}{min size}
4279 % \begin{macrocode}
4280 \define@key\adjbox@fam{min size}{%
4281 \adjbox@Gin@sizeadd{\@minsizebox\height}#1\@nnil
4282 }
4283 % \end{macrocode}
4284 % \end{key}
4285 %
4286 %
4287 % \begin{key}{adjbox}{max size}
4288 % \begin{macrocode}
4289 \define@key\adjbox@fam{max size}{%
4290 \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\@nnil
4291 }
4292 % \end{macrocode}
4293 % \end{key}
4294 %
4295 %
4296 % \begin{key}{adjbox}{min totalsize}
4297 % \begin{macrocode}
4298 \define@key\adjbox@fam{min totalsize}{%
4299 \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\@nnil
4300 }
4301 % \end{macrocode}
4302 % \end{key}
4303 %
4304 %
4305 % \begin{key}{adjbox}{max totalsize}
4306 % \begin{macrocode}
4307 \define@key\adjbox@fam{max totalsize}{%
4308 \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\@nnil
4309 }
4310 % \end{macrocode}
4311 % \end{key}
4312 %
4313 %
4314 % \begin{key}{adjbox}{warn width}
4315 % \begin{macrocode}
4316 \define@adjboxkey@defvalue{warn width}{\linewidth}{\@Collectbox{\adjbox@warnwidth{#1}}}
4317 % \end{macrocode}
4318 % \end{key}
4319 %
4320 % \begin{macro}{\adjbox@warnwidth}
4321 % Warn if width is wider than the given width plus |\hfuzz|.
4322 % \begin{macrocode}
4323 \def\adjbox@warnwidth#1{%
4324 \@tempdima=#1\relax
4325 \advance\@tempdima by -\width
4326 \@tempdima=-\@tempdima
4327 \ifdim\@tempdima>\hfuzz
4328 \typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
4329 \ifnum\adjbox@line=\inputlineno
4330 line \adjbox@line
4331 \else
4332 lines \adjbox@line--\the\inputlineno
4333 \fi
4334 }%
4335 \fi
4336 \BOXCONTENT
4337 }
4338 % \end{macrocode}
4339 % \end{macro}
4340 %
4341 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4342 %
4343 % \begin{macro}{\minsizebox}
4344 % \begin{macrocode}
4345 \newcommand*\minsizebox{%
4346 \collectboxcheckenv{minsizebox}%
4347 \@ifstar{\@minsizebox\totalheight}{\@minsizebox\height}%
4348 }
4349 % \end{macrocode}
4350 % \end{macro}
4351 %
4352 % \begin{environment}{minsizebox*}
4353 % \begin{macrocode}
4354 \expandafter\newcommand\expandafter*\csname minsizebox*\endcsname{%
4355 \@collectboxisenv{minsizebox*}%
4356 \@minsizebox\totalheight
4357 }
4358 % \end{macrocode}
4359 % \end{environment}
4360 %
4361 %
4362 % \begin{macro}{\@minsizebox}
4363 % \begin{macrocode}
4364 \newcommand*\@minsizebox[3]{%
4365 \@collectbox{\@minmaxsizebox>#1{#2}{#3}}%
4366 }
4367 % \end{macrocode}
4368 % \end{macro}
4369 %
4370 %
4371 % \begin{macro}{\maxsizebox}
4372 % \begin{macrocode}
4373 \newcommand*\maxsizebox{%
4374 \collectboxcheckenv{maxsizebox}%
4375 \@ifstar{\@maxsizebox\totalheight}{\@maxsizebox\height}%
4376 }
4377 % \end{macrocode}
4378 % \end{macro}
4379 %
4380 % \begin{environment}{maxsizebox*}
4381 % \begin{macrocode}
4382 \expandafter\newcommand\expandafter*\csname maxsizebox*\endcsname{%
4383 \@collectboxisenv{maxsizebox*}%
4384 \@maxsizebox\totalheight
4385 }
4386 % \end{macrocode}
4387 % \end{environment}
4388 %
4389 %
4390 % \begin{macro}{\@maxsizebox}
4391 % \begin{macrocode}
4392 \newcommand*\@maxsizebox[3]{%
4393 \@collectbox{\@minmaxsizebox<#1{#2}{#3}}%
4394 }
4395 % \end{macrocode}
4396 % \end{macro}
4397 %
4398 %
4399 % \begin{macro}{\@minmaxsizebox}[4]{Compare sign \texttt{<} or \texttt{>}}{\cs{height} or \cs{totalheight}}{width}{height}
4400 % Used for all min/max-size boxes including the starred version. The first two arguments determine the style.
4401 %
4402 % The width and height values are expanded to allow for \Macro\ifdim or similar conditionals.
4403 % \begin{macrocode}
4404 \newcommand*\@minmaxsizebox[4]{%
4405 \edef\@tempa{#3}%
4406 \edef\@tempb{#4}%
4407 \ifx\@tempa\Gin@exclamation\else
4408 \adjsetlength\@tempdima{#3}%
4409 \fi
4410 \ifx\@tempb\Gin@exclamation\else
4411 \adjsetlength\@tempdimb{#4}%
4412 \fi
4413 \ifcase0%
4414 % \end{macrocode}
4415 % Do nothing if both values are `|!|', otherwise use case 1 if the height is to large/small (|#1|)
4416 % than the \Macro\height or \Macro\totalheight (|#2|).
4417 % \begin{macrocode}
4418 \ifx\@tempa\Gin@exclamation
4419 \ifx\@tempb\Gin@exclamation
4420 \else
4421 \ifdim\@tempdimb#1#2%
4422 1%
4423 \fi
4424 \fi
4425 \else
4426 % \end{macrocode}
4427 % 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.
4428 % \begin{macrocode}
4429 \ifx\@tempb\Gin@exclamation
4430 \ifdim\@tempdima#1\width
4431 2%
4432 \fi
4433 \else
4434 % \end{macrocode}
4435 % If both values are given.
4436 % Use case 0-3 depending if the width and/or height is to large/small.
4437 % \begin{macrocode}
4438 \ifdim\@tempdima#1\width
4439 \ifdim\@tempdimb#1#2%
4440 3%
4441 \else
4442 2%
4443 \fi
4444 \else
4445 \ifdim\@tempdimb#1#2%
4446 1%
4447 \fi
4448 \fi
4449 \fi
4450 \fi
4451 % \end{macrocode}
4452 % Case 0: no scaling is needed. Insert content unchanged.
4453 % \begin{macrocode}
4454 \relax% 0
4455 \BOXCONTENT
4456 % \end{macrocode}
4457 % Case 1: height needs scaling. Calculate factor and scale the content with it.
4458 % \begin{macrocode}
4459 \or
4460 \Gscale@div\@tempa\@tempdimb#2%
4461 \Gscale@box\@tempa[\@tempa]\BOXCONTENT
4462 % \end{macrocode}
4463 % Case 2: width needs scaling. Calculate factor and scale the content with it.
4464 % \begin{macrocode}
4465 \or
4466 \Gscale@div\@tempa\@tempdima\width
4467 \Gscale@box\@tempa[\@tempa]\BOXCONTENT
4468 % \end{macrocode}
4469 % Case 3: both width and height need scaling.
4470 % Both scale factors are calculated and the more extreme value is used.
4471 % \begin{macrocode}
4472 \or
4473 \Gscale@div\@tempa\@tempdima\width
4474 \Gscale@div\@tempb\@tempdimb#2%
4475 \ifdim\@tempa\p@#1\@tempb\p@
4476 \let\@tempb\@tempa
4477 \else
4478 \let\@tempa\@tempb
4479 \fi
4480 \Gscale@box\@tempa[\@tempb]\BOXCONTENT
4481 \fi
4482 }
4483 % \end{macrocode}
4484 % \end{macro}
4485 %
4486 %
4487 % ^^A )))
4488 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4489 % \subsection{Frame keys} ^^A (((
4490 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4491 %
4492 %
4493 % \begin{key}{adjbox}{frame}
4494 % As 0--3 arguments: rule width, (inner) separation and margin.
4495 % \begin{macrocode}
4496 \define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
4497 \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
4498 }
4499 % \end{macrocode}
4500 % \end{key}
4501 %
4502 %
4503 % \begin{key}{adjbox}{fbox}
4504 % Same as \Key{frame} but with different default separation.
4505 % \begin{macrocode}
4506 \define@key\adjbox@fam{fbox}[{{\fboxrule}}]{%
4507 \adjbox@frame{}#1 {} {} {} \relax\relax\@nnil
4508 }
4509 % \end{macrocode}
4510 % \end{key}
4511 %
4512 %
4513 % \begin{macro}{\adjbox@frame}
4514 % \begin{macrocode}
4515 \def\adjbox@frame#1#2 #3 #4 #5\relax{%
4516 \adjbox@Gin@Add{%
4517 \@Collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}%
4518 }%
4519 \remove@to@nnil
4520 }
4521 % \end{macrocode}
4522 % \end{macro}
4523 %
4524 %
4525 % \begin{key}{adjbox}{cframe}
4526 % \begin{macrocode}
4527 \define@key\adjbox@fam{cframe}{%
4528 \adjbox@checkcolor
4529 \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil
4530 }
4531 % \end{macrocode}
4532 % \end{key}
4533 %
4534 % \begin{key}{adjbox}{cfbox}
4535 % \begin{macrocode}
4536 \define@key\adjbox@fam{cfbox}{%
4537 \adjbox@checkcolor
4538 \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil
4539 }
4540 % \end{macrocode}
4541 % \end{key}
4542 %
4543 % \begin{macro}{\adjbox@cframe}
4544 % \begin{macrocode}
4545 \def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{%
4546 \adjbox@Gin@Add{%
4547 \@Collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}%
4548 }%
4549 \remove@to@nnil
4550 }
4551 % \end{macrocode}
4552 % \end{macro}
4553 %
4554 %
4555 % \begin{macro}{\adjbox@checkcolor}
4556 % \begin{macrocode}
4557 \def\adjbox@checkcolor{%
4558 \ifcase0%
4559 \expandafter\ifx\csname [email protected]\endcsname\relax
4560 \expandafter\ifx\csname [email protected]\endcsname\relax
4561 \expandafter\ifx\csname [email protected]\endcsname\relax 1\fi\fi\fi
4562 \relax
4563 \global\let\adjbox@checkcolor\relax
4564 \else
4565 \PackageError{adjustbox}{Using a macro, environment or key with color\MessageBreak
4566 requires a color package to be loaded manually.\MessageBreak
4567 Recommended is 'xcolor' but 'color' is ok, too}{}.
4568 \fi
4569 }
4570 % \end{macrocode}
4571 % \end{macro}
4572 %
4573 %
4574 % \begin{macro}{\adjbox@@frame}[4]{content}{rule width}{separation}{margin}
4575 % \begin{macrocode}
4576 \def\adjbox@@frame#1#2#3#4{%
4577 \leavevmode
4578 \ifx\@nnil#2\@nnil\else
4579 \adjsetlength\fboxrule{#2}%
4580 \fi
4581 \ifx\@nnil#3\@nnil\else
4582 \adjsetlength\fboxsep{#3}%
4583 \fi
4584 \adjsetlength\tc@llx{\fboxrule + \fboxsep}%
4585 \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
4586 \ifx\@nnil#4\@nnil\else
4587 \setbox\collectedbox
4588 \fi
4589 \hbox\bgroup\color@setgroup
4590 \BOXCONTENT
4591 \hskip-\width
4592 #1%
4593 \adjbox@boxframe\width\height\depth
4594 \color@endgroup\egroup
4595 \ifx\@nnil#4\@nnil\else
4596 \adjsetlength\tc@llx{#4}%
4597 \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
4598 \BOXCONTENT
4599 \fi
4600 }
4601 % \end{macrocode}
4602 % \end{macro}
4603 %
4604 %
4605 % \begin{macro}{\adjbox@boxframe}[3]{width}{height}{depth}
4606 % Tries to reuse the definition of the \pkg{xcolor} package.
4607 % If it isn't loaded its definition is defined here.
4608 %
4609 % This code was taken from the \pkg{xcolor} package under the free LPPL license.
4610 % \begin{macrocode}
4611 \let\adjbox@boxframe\boxframe
4612 \providecommand\adjbox@boxframe[3]{%
4613 \hbox{%
4614 \dimen@ #2%
4615 \advance \dimen@ #3\relax
4616 \lower #3\vbox {%
4617 \hrule \@height \fboxrule
4618 \@tempdima -0.5\fboxrule
4619 \ifodd\fboxrule
4620 \advance \@tempdima \m@ne sp
4621 \fi
4622 \kern \@tempdima
4623 \hbox {%
4624 \advance \dimen@ -\fboxrule
4625 \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
4626 \@tempdima #1%
4627 \advance \@tempdima -\tw@ \fboxrule
4628 \kern \@tempdima
4629 \vrule \@width \fboxrule \@height \dimen@ \@depth \z@
4630 }%
4631 \kern -0.5\fboxrule
4632 \hrule \@height \fboxrule
4633 }%
4634 }%
4635 }
4636 % \end{macrocode}
4637 % \end{macro}
4638 %
4639 %
4640 % ^^A )))
4641 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4642 % \subsection{Density keys} ^^A (((
4643 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4644 %
4645 % \begin{key}{adjbox}{dpi}
4646 % \begin{macrocode}
4647 \define@key\adjbox@fam{dpi}{%
4648 \adjsetlength\pdfpxdimen{1in/(#1)}%
4649 }
4650 % \end{macrocode}
4651 % \end{key}
4652 %
4653 % \begin{key}{adjbox}{pxdim}
4654 % \begin{macrocode}
4655 \define@key\adjbox@fam{pxdim}{%
4656 \adjsetlength\pdfpxdimen{#1}%
4657 }
4658 % \end{macrocode}
4659 % \end{key}
4660 %
4661 %
4662 % ^^A )))
4663 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4664 % \subsection{Code keys} ^^A (((
4665 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4666 %
4667 % \begin{macrocode}
4668 \define@key\adjbox@fam{execute}{%
4669 #1%
4670 }
4671 % \end{macrocode}
4672 %
4673 % \begin{macrocode}
4674 \define@key\adjbox@fam{@debug}[]{%
4675 \showthe\toks@
4676 }
4677 % \end{macrocode}
4678 %
4679 % \begin{macrocode}
4680 \define@key{ADJBOX}{Execute}{%
4681 #1%
4682 }
4683 % \end{macrocode}
4684 %
4685 %
4686 % \begin{key}{adjbox}{addcode}
4687 % Adds code before and after the current boxed content.
4688 % Syntax:~\Key{addcode}'='{<code before>}{<code afterwards>}
4689 % \begin{macrocode}
4690 \define@key{adjbox}{Addcode}{%
4691 \adjust@@addcode#1{}\@nnil%
4692 }
4693 \define@key{adjbox}{addcode}{%
4694 \Gin@esetsize
4695 \@tempswatrue
4696 \adjust@@addcode#1{}\@nnil%
4697 }
4698 \long\def\adjust@@addcode#1#2#3\@nnil{%
4699 \ifx\@nnil#3\@nnil
4700 \adjust@addcode{#1}{#2}%
4701 \else
4702 \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
4703 \fi
4704 }
4705 % \end{macrocode}
4706 % \end{key}
4707 %
4708 % \begin{key}{adjbox}{precode}
4709 % \begin{macrocode}
4710 \define@key{adjbox}{precode}{%
4711 \Gin@esetsize
4712 \@tempswatrue
4713 \adjust@addcode{#1}{}%
4714 }
4715 % \end{macrocode}
4716 % \end{key}
4717 %
4718 % \begin{key}{adjbox}{Precode}
4719 % Same as \Key{precode} but does not set the size yet.
4720 % \begin{macrocode}
4721 \define@key{adjbox}{Precode}{%
4722 \adjust@addcode{#1}{}%
4723 }
4724 % \end{macrocode}
4725 % \end{key}
4726 %
4727 % \begin{key}{adjbox}{appcode}
4728 % \begin{macrocode}
4729 \define@key{adjbox}{appcode}{%
4730 \toks@\expandafter{\the\toks@#1}%
4731 }
4732 % \end{macrocode}
4733 % \end{key}
4734 %
4735 % \begin{macro}{\adjust@addcode}
4736 % \begin{macrocode}
4737 \long\def\adjust@addcode#1#2{%
4738 \def\@tempa{#1}%
4739 \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
4740 }%
4741 % \end{macrocode}
4742 % \end{macro}
4743 %
4744 %
4745 % \begin{key}{adjbox}{env}
4746 % Adds environment around boxed content
4747 % \begin{macrocode}
4748 \define@key\adjbox@fam{env}{%
4749 \@ifnextchar\bgroup{%
4750 \adjbox@addenv
4751 }{%
4752 \adjbox@addenv{#1}\@nnil%
4753 \remove@to@nnil
4754 }#1\@nnil
4755 }
4756 % \end{macrocode}
4757 % \end{key}
4758 %
4759 % \begin{macro}{\adjust@addenv}
4760 % \begin{macrocode}
4761 \def\adjbox@addenv#1#2\@nnil{%
4762 \def\@tempa{\begin{#1}#2}%
4763 \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
4764 }%
4765 % \end{macrocode}
4766 % \end{macro}
4767 %
4768 %
4769 % ^^A )))
4770 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4771 % \subsection{Background keys and macros} ^^A (((
4772 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4773 %
4774 % \begin{key}{ADJBOX}{color}
4775 % Sets the foreground color, i.e.\ the color used for the content.
4776 % |#1| are the argument to color, i.e. either \MacroArgs<color>
4777 % or \MacroArgs{<model>}{<color>}.
4778 % \begin{macrocode}
4779 \define@key{ADJBOX}{color}{%
4780 \adjbox@checkcolor
4781 \@ifnextchar\bgroup{%
4782 \adjbox@color
4783 }{%
4784 \adjbox@color{}{#1}%
4785 }#1\@nnil
4786 }
4787 % \end{macrocode}
4788 % \end{key}
4789 %
4790 % \begin{macro}{\adjbox@color}
4791 % Check for the optional color argument.
4792 % \begin{macrocode}
4793 \def\adjbox@color#1#2#3\@nnil{%
4794 \ifx\@nnil#1\@nnil
4795 \color{#2}%
4796 \else
4797 \color[{#1}]{#2}%
4798 \fi
4799 }
4800 % \end{macrocode}
4801 % \end{macro}
4802 %
4803 % \begin{key}{ADJBOX}{color*}
4804 % Sets the color using a given color command.
4805 % \begin{macrocode}
4806 \define@key{ADJBOX}{color*}{%
4807 #1%
4808 }
4809 % \end{macrocode}
4810 % \end{key}
4811 %
4812 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4813 %
4814 % \begin{key}{adjbox}{fgcolor}
4815 % Changes the foreground color.
4816 % |#1| are the argument to color, i.e. either \MacroArgs<color>
4817 % or \MacroArgs{<model>}{<color>}.
4818 % \begin{macrocode}
4819 \define@key{ADJBOX}{fgcolor}{%
4820 \adjbox@checkcolor
4821 \@ifnextchar\bgroup{%
4822 \adjbox@fgcolor
4823 }{%
4824 \adjbox@fgcolor{}{#1}%
4825 }#1\@nnil
4826 }
4827 % \end{macrocode}
4828 % \end{key}
4829 %
4830 % \begin{macro}{\adjbox@fgcolor}
4831 % Parses the two possible arguments and adds the color macro
4832 % to the token register.
4833 % \begin{macrocode}
4834 \def\adjbox@fgcolor#1#2#3\@nnil{%
4835 \ifx\@nnil#1\@nnil
4836 \adjbox@innercode{\color{#2}}{}%
4837 \else
4838 \adjbox@innercode{\color[{#1}]{#2}}{}%
4839 \fi
4840 }
4841 % \end{macrocode}
4842 % \end{macro}
4843 %
4844 %
4845 %
4846 % \begin{key}{adjbox}{fgcolor*}
4847 % Adds a colored box in the background. It awaits a direct color macro,
4848 % which gives the user more flexibility.
4849 % \begin{macrocode}
4850 \define@key{ADJBOX}{fgcolor*}{%
4851 \adjbox@checkcolor
4852 \adjbox@innercode{#1}{}%
4853 }
4854 % \end{macrocode}
4855 % \end{key}
4856 %
4857 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4858 %
4859 % \begin{key}{adjbox}{bgcolor}
4860 % Adds a colored box in the background.
4861 % |#1| are the argument to color, i.e. either \MacroArgs<color>
4862 % or \MacroArgs{<model>}{<color>}.
4863 % \begin{macrocode}
4864 \define@key\adjbox@fam{bgcolor}{%
4865 \adjbox@checkcolor
4866 \@ifnextchar\bgroup{%
4867 \adjbox@bgcolor
4868 }{%
4869 \adjbox@bgcolor{}{#1}%
4870 }#1\@nnil
4871 }
4872 % \end{macrocode}
4873 % \end{key}
4874 %
4875 %
4876 % \begin{macro}{\adjbox@bgcolor}
4877 % Parses the two possible arguments and adds the background color macro
4878 % to the token register.
4879 % \begin{macrocode}
4880 \def\adjbox@bgcolor#1#2#3\@nnil{%
4881 \ifx\@nnil#1\@nnil
4882 \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}%
4883 \else
4884 \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
4885 \fi
4886 }
4887 % \end{macrocode}
4888 % \end{macro}
4889 %
4890 %
4891 % \begin{key}{adjbox}{bgcolor*}
4892 % Adds a colored box in the background. It awaits a direct color macro,
4893 % which gives the user more flexibility.
4894 % \begin{macrocode}
4895 \define@key\adjbox@fam{bgcolor*}{%
4896 \adjbox@checkcolor
4897 \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{#1}}}%
4898 }
4899 % \end{macrocode}
4900 % \end{key}
4901 %
4902 %
4903 % \begin{macro}{\@bgcolorbox}
4904 % This places a colored box (vrule) with the same dimensions than
4905 % the content, then compensates for the horizontal shift and places
4906 % the content. This is simpler and more direct than using \Macro\rlap
4907 % or a box macro from the \pkg{xcolor} package.
4908 %
4909 % The argument contains the color macro, e.g.\ \Macro\color{<color>}.
4910 % \begin{macrocode}
4911 \def\@bgcolorbox#1{%
4912 \leavevmode
4913 \hbox{%
4914 \hbox{%
4915 #1%
4916 \vrule\@width\width\@height\height\@depth\depth%
4917 }%
4918 \hskip-\width
4919 \BOXCONTENT
4920 }%
4921 }%
4922 % \end{macrocode}
4923 % \end{macro}
4924 %
4925 %
4926 % \begin{macro}{\bgcolorbox}
4927 % \begin{macrocode}
4928 \expandafter\newcommand\expandafter\bgcolorbox\expandafter{%
4929 \expandafter
4930 \@ifstar
4931 \csname bgcolorbox*\endcsname
4932 \bgcolorbox@
4933 }
4934 % \end{macrocode}
4935 % \end{macro}
4936 %
4937 %
4938 % \begin{macro}{\bgcolorbox@}
4939 % \begin{macrocode}
4940 \newcommand\bgcolorbox@[2][\@nnil]{%
4941 \collectboxcheckenv{bgcolorbox}%
4942 \ifx\@nnil#1\relax
4943 \expandafter\@firstoftwo
4944 \else
4945 \expandafter\@secondoftwo
4946 \fi
4947 {\@collectbox{\@bgcolorbox{\color{#2}}}}%
4948 {\@collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
4949 }
4950 % \end{macrocode}
4951 % \end{macro}
4952 %
4953 % \begin{macro}{bgcolorbox*}
4954 % \begin{macrocode}
4955 \@namedef{bgcolorbox*}#1{%
4956 \collectboxcheckenv{bgcolorbox*}%
4957 \@collectbox{\@bgcolorbox{#1}}%
4958 }
4959 % \end{macrocode}
4960 % \end{macro}
4961 %
4962 %
4963 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4964 %
4965 % \begin{macro}{\fgimagebox}
4966 % \begin{macrocode}
4967 \expandafter\newcommand\expandafter\fgimagebox\expandafter{%
4968 \expandafter
4969 \@ifstar
4970 \csname fgimagebox*\endcsname
4971 \fgimagebox@
4972 }
4973 % \end{macrocode}
4974 % \end{macro}
4975 %
4976 % \begin{macro}{\fgimagebox@}
4977 % \begin{macrocode}
4978 \newcommand\fgimagebox@[2][]{%
4979 \collectboxcheckenv{fgimagebox}%
4980 \@collectbox{\@foregroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
4981 }
4982 % \end{macrocode}
4983 % \end{macro}
4984 %
4985 % \begin{macro}{fgimagebox*}
4986 % \begin{macrocode}
4987 \expandafter\newcommand\csname fgimagebox*\endcsname[2][]{%
4988 \collectboxcheckenv{fgimagebox*}%
4989 \@collectbox{\@foregroundbox\adjustimage{#1}{#2}}%
4990 }
4991 % \end{macrocode}
4992 % \end{macro}
4993 %
4994 %
4995 %
4996 % \begin{key}{adjbox}{fgimage}
4997 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
4998 % \begin{macrocode}
4999 \define@key{adjbox}{fgimage}{%
5000 \@ifnextchar\bgroup{%
5001 \adjbox@fgimage
5002 }{%
5003 \adjbox@fgimage{}{#1}%
5004 }#1{}\@nnil
5005 {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
5006 }
5007 % \end{macrocode}
5008 % \end{key}
5009 %
5010 % \begin{key}{adjbox}{fgimage*}
5011 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5012 % \begin{macrocode}
5013 \define@key{adjbox}{fgimage*}{%
5014 \@ifnextchar\bgroup{%
5015 \adjbox@fgimage
5016 }{%
5017 \adjbox@fgimage{}{#1}%
5018 }#1{}\@nnil{}%
5019 }
5020 % \end{macrocode}
5021 % \end{key}
5022 %
5023 %
5024 % \begin{macro}{\adjbox@fgimage}
5025 % \begin{macrocode}
5026 \def\adjbox@fgimage#1#2#3\@nnil#4{%
5027 \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustimage{#1#4}{#2}}}%
5028 }
5029 % \end{macrocode}
5030 % \end{macro}
5031 %
5032 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5033 %
5034 % \begin{macro}{\bgimagebox}
5035 % \begin{macrocode}
5036 \expandafter\newcommand\expandafter\bgimagebox\expandafter{%
5037 \expandafter
5038 \@ifstar
5039 \csname bgimagebox*\endcsname
5040 \bgimagebox@
5041 }
5042 % \end{macrocode}
5043 % \end{macro}
5044 %
5045 % \begin{macro}{\bgimagebox@}
5046 % \begin{macrocode}
5047 \newcommand\bgimagebox@[2][]{%
5048 \collectboxcheckenv{bgimagebox}%
5049 \@collectbox{\@backgroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
5050 }
5051 % \end{macrocode}
5052 % \end{macro}
5053 %
5054 % \begin{macro}{bgimagebox*}
5055 % \begin{macrocode}
5056 \expandafter\newcommand\csname bgimagebox*\endcsname[2][]{%
5057 \collectboxcheckenv{bgimagebox*}%
5058 \@collectbox{\@backgroundbox\adjustimage{#1}{#2}}%
5059 }
5060 % \end{macrocode}
5061 % \end{macro}
5062 %
5063 %
5064 %
5065 % \begin{key}{adjbox}{bgimage}
5066 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5067 % \begin{macrocode}
5068 \define@key{adjbox}{bgimage}{%
5069 \@ifnextchar\bgroup{%
5070 \adjbox@bgimage
5071 }{%
5072 \adjbox@bgimage{}{#1}%
5073 }#1{}\@nnil
5074 {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
5075 }
5076 % \end{macrocode}
5077 % \end{key}
5078 %
5079 % \begin{key}{adjbox}{bgimage*}
5080 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5081 % \begin{macrocode}
5082 \define@key{adjbox}{bgimage*}{%
5083 \@ifnextchar\bgroup{%
5084 \adjbox@bgimage
5085 }{%
5086 \adjbox@bgimage{}{#1}%
5087 }#1{}\@nnil{}%
5088 }
5089 % \end{macrocode}
5090 % \end{key}
5091 %
5092 %
5093 % \begin{macro}{\adjbox@bgimage}
5094 % \begin{macrocode}
5095 \def\adjbox@bgimage#1#2#3\@nnil#4{%
5096 \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustimage{#1#4}{#2}}}%
5097 }
5098 % \end{macrocode}
5099 % \end{macro}
5100 %
5101 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5102 %
5103 % \begin{key}{adjbox}{foreground}
5104 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5105 % \begin{macrocode}
5106 \define@key{adjbox}{foreground}{%
5107 \@ifnextchar\bgroup{%
5108 \adjbox@foreground
5109 }{%
5110 \adjbox@foreground{}{#1}%
5111 }#1{}{}\@nnil
5112 {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
5113 }
5114 % \end{macrocode}
5115 % \end{key}
5116 %
5117 %
5118 % \begin{key}{adjbox}{foreground*}
5119 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5120 % \begin{macrocode}
5121 \define@key{adjbox}{foreground*}{%
5122 \@ifnextchar\bgroup{%
5123 \adjbox@foreground
5124 }{%
5125 \adjbox@foreground{}{#1}%
5126 }#1{}{}\@nnil{}%
5127 }
5128 % \end{macrocode}
5129 % \end{key}
5130 %
5131 %
5132 % \begin{macro}{\adjbox@foreground}
5133 % \begin{macrocode}
5134 \def\adjbox@foreground#1#2#3\@nnil#4{%
5135 \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustbox{#1#4}{#2}}}%
5136 }
5137 % \end{macrocode}
5138 % \end{macro}
5139 %
5140 %
5141 % \begin{macro}{\@foregroundbox}
5142 % \begin{macrocode}
5143 \def\@foregroundbox#1#2#3{%
5144 \leavevmode
5145 \hbox to \width{%
5146 \BOXCONTENT
5147 \hskip-\width
5148 \hss
5149 \adjbox@parentdims
5150 #1{#2}{#3}%
5151 \hss
5152 }%
5153 }
5154 % \end{macrocode}
5155 % \end{macro}
5156 %
5157 % \begin{macro}{\foregroundbox}
5158 % \begin{macrocode}
5159 \expandafter\newcommand\expandafter\foregroundbox\expandafter{%
5160 \expandafter
5161 \@ifstar
5162 \csname foregroundbox*\endcsname
5163 \foregroundbox@
5164 }
5165 % \end{macrocode}
5166 % \end{macro}
5167 %
5168 % \begin{macro}{\foregroundbox@}
5169 % \begin{macrocode}
5170 \newcommand\foregroundbox@[2][]{%
5171 \collectboxcheckenv{foregroundbox}%
5172 \@collectbox{\@foregroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
5173 }
5174 % \end{macrocode}
5175 % \end{macro}
5176 %
5177 % \begin{macro}{foregroundbox*}
5178 % \begin{macrocode}
5179 \expandafter\newcommand\csname foregroundbox*\endcsname[2][]{%
5180 \collectboxcheckenv{foregroundbox*}%
5181 \@collectbox{\@foregroundbox\adjustbox{#1}{#2}}%
5182 }
5183 % \end{macrocode}
5184 % \end{macro}
5185 %
5186 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5187 %
5188 % \begin{key}{adjbox}{background}
5189 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5190 % \begin{macrocode}
5191 \define@key{adjbox}{background}{%
5192 \@ifnextchar\bgroup{%
5193 \adjbox@background
5194 }{%
5195 \adjbox@background{}{#1}%
5196 }#1{}{}\@nnil
5197 {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
5198 }
5199 % \end{macrocode}
5200 % \end{key}
5201 %
5202 % \begin{key}{adjbox}{background*}
5203 % One or two arguments, the first optional one are further \Macro\includegraphics keys.
5204 % \begin{macrocode}
5205 \define@key{adjbox}{background*}{%
5206 \@ifnextchar\bgroup{%
5207 \adjbox@background
5208 }{%
5209 \adjbox@background{}{#1}%
5210 }#1{}{}\@nnil{}%
5211 }
5212 % \end{macrocode}
5213 % \end{key}
5214 %
5215 %
5216 % \begin{macro}{\adjbox@background}
5217 % \begin{macrocode}
5218 \def\adjbox@background#1#2#3\@nnil#4{%
5219 \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustbox{#1#4}{#2}}}%
5220 }
5221 % \end{macrocode}
5222 % \end{macro}
5223 %
5224 %
5225 % \begin{macro}{\@backgroundbox}
5226 % \begin{macrocode}
5227 \def\@backgroundbox#1#2#3{%
5228 \leavevmode
5229 \hbox to \width{%
5230 \hss
5231 \adjbox@parentdims
5232 #1{#2}{#3}%
5233 \hss
5234 \hskip-\width%
5235 \BOXCONTENT
5236 }%
5237 }
5238 % \end{macrocode}
5239 % \end{macro}
5240 %
5241 % \begin{macro}{\backgroundbox}
5242 % \begin{macrocode}
5243 \expandafter\newcommand\expandafter\backgroundbox\expandafter{%
5244 \expandafter
5245 \@ifstar
5246 \csname backgroundbox*\endcsname
5247 \backgroundbox@
5248 }
5249 % \end{macrocode}
5250 % \end{macro}
5251 %
5252 % \begin{macro}{\backgroundbox@}
5253 % \begin{macrocode}
5254 \newcommand\backgroundbox@[2][]{%
5255 \collectboxcheckenv{backgroundbox}%
5256 \@collectbox{\@backgroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}%
5257 }
5258 % \end{macrocode}
5259 % \end{macro}
5260 %
5261 % \begin{macro}{backgroundbox*}
5262 % \begin{macrocode}
5263 \expandafter\newcommand\csname backgroundbox*\endcsname[2][]{%
5264 \collectboxcheckenv{backgroundbox*}%
5265 \@collectbox{\@backgroundbox\adjustbox{#1}{#2}}%
5266 }
5267 % \end{macrocode}
5268 % \end{macro}
5269 %
5270 %
5271 %
5272 % ^^A )))
5273 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5274 % \subsection{Lapping keys and macros} ^^A (((
5275 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5276 %
5277 % \begin{key}{adjbox}{lap}
5278 % \begin{macrocode}
5279 \define@key\adjbox@fam{lap}{%
5280 \@ifnextchar\bgroup{%
5281 \adjbox@lapbox
5282 }{%
5283 \adjbox@lapbox{#1}{}%
5284 }#1{}{}\@nnil
5285 }
5286 % \end{macrocode}
5287 % \end{key}
5288 %
5289 %
5290 % \begin{macro}{\adjbox@lapbox}
5291 % \begin{macrocode}
5292 \def\adjbox@lapbox#1#2#3\@nnil{%
5293 \ifx\@nnil#2\@nnil
5294 \adjbox@Gin@Add{\lapbox{#1}}%
5295 \else
5296 \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
5297 \fi
5298 }
5299 % \end{macrocode}
5300 % \end{macro}
5301 %
5302 %
5303 % \begin{key}{adjbox}{rlap}
5304 % \begin{macrocode}
5305 \define@key\adjbox@fam{rlap}[]{%
5306 \adjbox@Gin@Add{\lapbox{\width}}%
5307 }
5308 % \end{macrocode}
5309 % \end{key}
5310 %
5311 %
5312 % \begin{key}{adjbox}{llap}
5313 % \begin{macrocode}
5314 \define@key\adjbox@fam{llap}[]{%
5315 \adjbox@Gin@Add{\lapbox{-\width}}%
5316 }
5317 % \end{macrocode}
5318 % \end{key}
5319 %
5320 %
5321 % \begin{key}{adjbox}{clap}
5322 % \begin{macrocode}
5323 \define@key\adjbox@fam{clap}[]{%
5324 \adjbox@Gin@Add{\lapbox[0pt]{-0.5\width}}%
5325 }
5326 % \end{macrocode}
5327 % \end{key}%
5328 %
5329 % \begin{macro}{\lapbox}
5330 % \begin{macrocode}
5331 \newcommand*\lapbox[2][\width-\@tempdimb]{%
5332 \collectboxcheckenv{lapbox}%
5333 \@collectbox{\@lapbox{#1}{#2}}%
5334 }
5335 % \end{macrocode}
5336 % \end{macro}
5337 %
5338 % \begin{macro}{\@lapbox}
5339 % \begin{macrocode}
5340 \def\@lapbox#1#2{%
5341 \adjsetlength\@tempdima{#2}%
5342 \ifdim\@tempdima<\z@
5343 \@tempdimb=-\@tempdima
5344 \else
5345 \@tempdimb=\@tempdima
5346 \fi
5347 \adjsetlength\@tempdimc{#1}%
5348 \ifdim\@tempdimc<\z@
5349 \@tempdimc=\z@
5350 \fi
5351 \leavevmode
5352 \ifdim\@tempdima<\z@
5353 \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\usebox\collectedbox\hss}\hskip\@tempdimc}%
5354 \else
5355 \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
5356 \fi
5357 }
5358 % \end{macrocode}
5359 % \end{macro}
5360 %
5361 %
5362 % ^^A )))
5363 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5364 % \subsection{Keys for minibox and varwidth} ^^A (((
5365 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5366 %
5367 % \begin{key}{ADJBOX}{minipage}
5368 % \begin{macrocode}
5369 \define@key{ADJBOX}{minipage}{%
5370 \adjbox@page{minipage}{#1}%
5371 }
5372 % \end{macrocode}
5373 % \end{key}
5374 %
5375 % \begin{key}{ADJBOX}{varwidth}
5376 % \begin{macrocode}
5377 \define@key{ADJBOX}{varwidth}{%
5378 \adjbox@page{varwidth}{#1}%
5379 }
5380 % \end{macrocode}
5381 % \end{key}
5382 %
5383 % \begin{macro}{\adjbox@page}
5384 % If the value starts with "[" or "{" take the value as it is,
5385 % otherwise assume that is a single length expression and add the required "{ }".
5386 % \begin{macrocode}
5387 \def\adjbox@page#1#2{%
5388 \@ifnextchar[{%
5389 \adjbox@@page{#1}%
5390 }{%
5391 \@ifnextchar\bgroup{%
5392 \adjbox@@page{#1}%
5393 }{%
5394 \adjbox@@page{#1}{{#2}}\@nnil%
5395 \remove@to@nnil
5396 }%
5397 }#2\@nnil
5398 }
5399 % \end{macrocode}
5400 % \end{macro}
5401 %
5402 %
5403 % \begin{macro}{\adjbox@@page}
5404 % Sets collect-box command to use \env{minipage} or similar environment.
5405 %
5406 % The \Macro\setlength macro is change temporary for the \env{minipage} or \env{varwidth} environment.
5407 % \begin{macrocode}
5408 \def\adjbox@@page#1#2\@nnil{%
5409 \adjbox@innercode
5410 {\adjbox@set\begin{#1}#2\adjbox@reset\ignorespaces}%
5411 {\end{#1}}%
5412 }
5413 % \end{macrocode}
5414 % \end{macro}
5415 %
5416 % \begin{macro}{\adjbox@set}
5417 % Sets \Macro\setlength to \pkg{adjcalc} version.
5418 % \begin{macrocode}
5419 \def\adjbox@set{%
5420 \let\adjbox@origsetlength\setlength
5421 \def\setlength{\adjsetlength}%
5422 }
5423 % \end{macrocode}
5424 % \end{macro}
5425 %
5426 %
5427 % \begin{macro}{\adjbox@reset}
5428 % Resets \Macro\setlength to normal version.
5429 % \begin{macrocode}
5430 \def\adjbox@reset{%
5431 \let\setlength\adjbox@origsetlength
5432 }
5433 % \end{macrocode}
5434 % \end{macro}
5435 %
5436 %
5437 % ^^A )))
5438 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5439 % \subsection{Stackbox keys and macros} ^^A (((
5440 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5441 %
5442 %
5443 % \begin{macro}{\stackbox}
5444 % \begin{macrocode}
5445 \newcommand*\stackbox[1][c]{%
5446 \collectboxcheckenv{stackbox}%
5447 \@ifnextchar[%]
5448 {\@stackbox{#1}}%
5449 {\@@stackbox{#1}{b}[]}%
5450 }
5451 % \end{macrocode}
5452 % \end{macro}
5453 %
5454 % \begin{macro}{\@stackbox}
5455 % Read the third optional argument
5456 % \begin{macrocode}
5457 \def\@stackbox#1[#2]{%
5458 \@testopt{\@@stackbox{#1}{#2}}{}%
5459 }
5460 % \end{macrocode}
5461 % \end{macro}
5462 %
5463 %
5464 % \begin{macro}{\@@stackbox}
5465 % The \env{varwidth} environment is used because it is much simpler to use than \env{tabular}.
5466 % The horizontal alignment is done by the usual text align macros.
5467 % \begin{macrocode}
5468 \def\@@stackbox#1#2[#3]{%
5469 \collectbox@
5470 {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3\ignorespaces}
5471 \BOXCONTENT
5472 {\end{varwidth}}%
5473 }
5474 % \end{macrocode}
5475 % \end{macro}
5476 %
5477 %
5478 % \begin{macro}{\adjbox@halign@c}
5479 % \begin{macro}{\adjbox@halign@l}
5480 % \begin{macro}{\adjbox@halign@r}
5481 % \begin{macro}{\adjbox@halign@j}
5482 % Horizontal alignment macros.
5483 % \begin{macrocode}
5484 \def\adjbox@halign@c{\centering}
5485 \def\adjbox@halign@l{\raggedright}
5486 \def\adjbox@halign@r{\raggedleft}
5487 \def\adjbox@halign@j{\let\\\newline}
5488 % \end{macrocode}
5489 % \end{macro}
5490 % \end{macro}
5491 % \end{macro}
5492 % \end{macro}
5493 %
5494 %
5495 % \begin{key}{ADJBOX}{stack}
5496 % \begin{macrocode}
5497 \define@key{ADJBOX}{stack}[{}{}{}]{%
5498 \adjbox@stack#1{}{}{}\@nnil
5499 }
5500 % \end{macrocode}
5501 % \end{key}
5502 %
5503 %
5504 % \begin{macro}{\adjbox@stack}
5505 % \begin{macrocode}
5506 \def\adjbox@stack#1#2#3#4\@nnil{%
5507 \ifx\@nnil#1\@nnil
5508 \adjbox@@stack{c}{b}{}%
5509 \else
5510 \ifx\@nnil#2\@nnil
5511 \adjbox@@stack{#1}{b}{}%
5512 \else
5513 \adjbox@@stack{#1}{#2}{#3}%
5514 \fi\fi
5515 }
5516 % \end{macrocode}
5517 % \end{macro}
5518 %
5519 %
5520 % \begin{macro}{\adjbox@@stack}
5521 % \begin{macrocode}
5522 \def\adjbox@@stack#1#2#3{%
5523 \adjbox@innercode{%
5524 \begin{varwidth}[#2]{\linewidth}%
5525 \csname adjbox@halign@#1\endcsname#3%
5526 \ignorespaces
5527 }{%
5528 \end{varwidth}%
5529 }%
5530 }
5531 % \end{macrocode}
5532 % \end{macro}
5533 %
5534 %
5535 % Load the \pkg{varwidth} package if available or disable the dependent keys if not.
5536 % \begin{macrocode}
5537 \IfFileExists{varwidth.sty}
5538 {\RequirePackage{varwidth}}{%
5539 \define@key{ADJBOX}{varwidth}{%
5540 \PackageError{adjustbox}{The 'varwidth' key requires the 'varwidth' package, which is not installed}{}%
5541 }
5542 \define@key{ADJBOX}{stack}{%
5543 \PackageError{adjustbox}{The 'stack' key requires the 'varwidth' package, which is not installed}{}%
5544 }
5545 }%
5546 % \end{macrocode}
5547 %
5548 %
5549 %
5550 % ^^A )))
5551 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5552 % \subsection{tabular and array keys} ^^A (((
5553 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5554 %
5555 %
5556 % \begin{key}{ADJBOX}{tabular}
5557 % \begin{macrocode}
5558 \define@key{ADJBOX}{tabular}{%
5559 \@ifnextchar[{%
5560 \adjbox@tabular{tabular}%
5561 }{%
5562 \adjbox@tabular{tabular}{{#1}}\@nnil%
5563 \remove@to@nnil
5564 }#1\@nnil
5565 }
5566 % \end{macrocode}
5567 % \end{key}
5568 %
5569 %
5570 % \begin{macro}{\adjbox@tabular}
5571 % \begin{macrocode}
5572 \def\adjbox@tabular#1#2\@nnil{%
5573 \ifcollectboxenv
5574 \adjbox@innerenv{#1}{#2}\@nnil
5575 \else
5576 \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{\adjbox@begininnercode}{##1}{\adjbox@endinnercode}}%
5577 \fi
5578 \chardef\adjbox@innerlevel\tw@
5579 }
5580 % \end{macrocode}
5581 % \end{macro}
5582 %
5583 %
5584 % \begin{key}{ADJBOX}{tabular*}
5585 % \begin{macrocode}
5586 \define@key{ADJBOX}{tabular*}{%
5587 \adjbox@tabular{tabular*}#1\@nnil
5588 }
5589 % \end{macrocode}
5590 % \end{key}
5591 %
5592 %
5593 % \begin{key}{ADJBOX}{array}
5594 % \begin{macrocode}
5595 \define@key{ADJBOX}{array}{%
5596 \@ifnextchar[{%
5597 \adjbox@array%
5598 }{%
5599 \adjbox@array{{#1}}\@nnil%
5600 \remove@to@nnil
5601 }#1\@nnil
5602 }
5603 % \end{macrocode}
5604 % \end{key}
5605 %
5606 %
5607 % \begin{macro}{\adjbox@array}
5608 % \begin{macrocode}
5609 \def\adjbox@array#1\@nnil{%
5610 \ifcollectboxenv
5611 \adjbox@innercode{\(\begin{array}#1}{\end{array}\)}%
5612 \else
5613 \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\adjbox@begininnercode\(}{##1}{\)\adjbox@endinnercode}}%
5614 \fi
5615 \chardef\adjbox@innerlevel\tw@
5616 }
5617 % \end{macrocode}
5618 % \end{macro}
5619 %
5620 %
5621 %
5622 % ^^A )))
5623 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5624 % \subsection{Keys for inner environments and code} ^^A (((
5625 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626 %
5627 %
5628 % \begin{key}{ADJBOX}{innerenv}
5629 % \begin{macrocode}
5630 \define@key{ADJBOX}{innerenv}{%
5631 \@ifnextchar\bgroup{%
5632 \adjbox@@innerenv
5633 }{%
5634 \adjbox@innerenv{#1}\@nnil%
5635 \remove@to@nnil
5636 }#1\@nnil
5637 }
5638 \adjbox@let@key{ADJBOX}{inner env}{innerenv}
5639 % \end{macrocode}
5640 % \end{key}
5641 %
5642 % \begin{macro}{\adjbox@innerenv}
5643 % \begin{macrocode}
5644 \def\adjbox@innerenv#1#2\@nnil{%
5645 \adjbox@innercode
5646 {\begin{#1}#2}%
5647 {\end{#1}}%
5648 }%
5649 % \end{macrocode}
5650 % \end{macro}
5651 %
5652 % \begin{macro}{\adjbox@innerenv}
5653 % \begin{macro}{\adjbox@@innerenv}
5654 % \begin{macro}{\adjbox@@@innerenv}
5655 % Used to extract the environment arguments. The issue here is that if a single mandatory argument is used
5656 % its braces are removed. To avoid that a `|{}|' is always added beforehand and then removed again.
5657 % \begin{macrocode}
5658 \def\adjbox@@innerenv#1{%
5659 \adjbox@@@innerenv{#1}{}%
5660 }%
5661 \def\adjbox@@@innerenv#1#2\@nnil{%
5662 \expandafter\adjbox@@@@innerenv\expandafter{\@gobble#2}{#1}%
5663 }%
5664 \def\adjbox@@@@innerenv#1#2{%
5665 \adjbox@innerenv{#2}{#1}\@nnil
5666 }%
5667 % \end{macrocode}
5668 % \end{macro}
5669 % \end{macro}
5670 % \end{macro}
5671 %
5672 %
5673 % \begin{key}{ADJBOX}{innercode}
5674 % \begin{macrocode}
5675 \define@key{ADJBOX}{innercode}{%
5676 \adjbox@innercode#1{}{}%
5677 }%
5678 \adjbox@let@key{ADJBOX}{inner code}{innercode}
5679 % \end{macrocode}
5680 % \end{key}
5681 %
5682 %
5683 % \begin{macro}{\adjbox@innercode}
5684 % \begin{macrocode}
5685 \def\adjbox@innercode{%
5686 \ifcase\adjbox@innerlevel
5687 \relax% 0: first inner code
5688 \def\adjbox@collectbox##1{\collectbox@{\adjbox@begininnercode\adjustbox@ignorespaces}{##1}{\adjustbox@unskip\adjbox@endinnercode}}%
5689 \chardef\adjbox@innerlevel\@ne
5690 \expandafter\adjbox@@innercode
5691 \or% 1 append inner code, no inner env
5692 \expandafter\adjbox@@innercode
5693 \else% 2 inner tabular exists, create warning and ignore content.
5694 \PackageWarning{adjustbox}{Further inner code or environment ignored\MessageBreak after "tabular"-like key}%
5695 \expandafter\@gobbletwo
5696 \fi
5697 }%
5698 % \end{macrocode}
5699 % \end{macro}
5700 %
5701 %
5702 % \begin{macro}{\adjbox@@innercode}
5703 % \begin{macrocode}
5704 \long\def\adjbox@@innercode#1#2{%
5705 \@temptokena\expandafter{\adjbox@begininnercode#1}%
5706 \edef\adjbox@begininnercode{\the\@temptokena}%
5707 \@temptokena{#2}%
5708 \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox@endinnercode}%
5709 \edef\adjbox@endinnercode{\the\@temptokena}%
5710 }
5711 % \end{macrocode}
5712 % \end{macro}
5713 %
5714 %
5715 %
5716 % ^^A )))
5717 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718 % \subsection{Float keys} ^^A (((
5719 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5720 %
5721 % \begin{key}{adjbox}{label}
5722 % \begin{macrocode}
5723 \define@key\adjbox@fam{label}{%
5724 \def\adjbox@label{\label{#1}}%
5725 }
5726 \let\adjbox@label\@empty
5727 % \end{macrocode}
5728 % \end{key}
5729 %
5730 % \begin{macrocode}
5731 \chardef\adjbox@caption@pos=11
5732 % \end{macrocode}
5733 %
5734 % \begin{key}{adjbox}{captionabove}
5735 % \begin{macrocode}
5736 \define@key\adjbox@fam{captionabove}{%
5737 \chardef\adjbox@caption@pos=1
5738 \csname KV@\adjbox@fam @caption\endcsname{#1}%
5739 }
5740 % \end{macrocode}
5741 % \end{key}
5742 %
5743 % \begin{key}{adjbox}{captionbelow}
5744 % \begin{macrocode}
5745 \define@key\adjbox@fam{captionbelow}{%
5746 \chardef\adjbox@caption@pos=0
5747 \csname KV@\adjbox@fam @caption\endcsname{#1}%
5748 }
5749 % \end{macrocode}
5750 % \end{key}
5751 %
5752 % \begin{key}{adjbox}{caption}
5753 % \begin{macrocode}
5754 \define@key\adjbox@fam{caption}{%
5755 \@ifnextchar{[}{%
5756 \adjbox@def@caption
5757 }{%
5758 \adjbox@def@@caption
5759 }#1\@nnil
5760 }
5761 \def\adjbox@def@@caption#1\@nnil{%
5762 \def\adjbox@caption{\caption{#1}}%
5763 }
5764 \def\adjbox@def@caption[#1]#2\@nnil{%
5765 \def\adjbox@caption{\caption[#1]{#2}}%
5766 }
5767 \let\adjbox@caption\@empty
5768 % \end{macrocode}
5769 % \end{key}
5770 %
5771 %
5772 % \begin{key}{adjbox}{figure}
5773 % \begin{macrocode}
5774 \define@key\adjbox@fam{figure}[]{%
5775 \let\adjustbox@noindent\relax
5776 \ifx\@nnil#1\@nnil
5777 \adjbox@addfloat{figure}{\begin{figure}}{}{\end{figure}}%
5778 \else
5779 \adjbox@addfloat{figure}{\begin{figure}}{[{#1}]}{\end{figure}}%
5780 \fi
5781 }
5782 % \end{macrocode}
5783 % \end{key}
5784 %
5785 % \begin{key}{adjbox}{float}
5786 % \begin{macrocode}
5787 \define@key\adjbox@fam{float}{%
5788 \let\adjustbox@noindent\relax
5789 \@ifnextchar\bgroup{%
5790 \adjbox@float
5791 }{%
5792 \adjbox@float{#1}{}\@nnil
5793 \remove@to@nnil
5794 }#1\@nnil
5795 }
5796 \def\adjbox@float#1#2\@nnil{%
5797 \adjbox@addfloat{#1}{\begin{#1}}{#2}{\end{#1}}%
5798 }
5799 % \end{macrocode}
5800 % \end{key}
5801 %
5802 % \begin{key}{adjbox}{nofloat}
5803 % \begin{macrocode}
5804 \define@key\adjbox@fam{nofloat}[figure]{%
5805 \adjbox@addfloat{#1}{\adjnofloat}{{#1}}{\endadjnofloat}%
5806 }
5807 % \end{macrocode}
5808 % \end{key}
5809 %
5810 %
5811 % \begin{macro}{\adjbox@caption@table@pos}
5812 % \begin{macrocode}
5813 \def\adjbox@caption@table@pos{1}
5814 % \end{macrocode}
5815 % \end{macro}
5816 %
5817 %
5818 % \begin{macro}{\adjbox@addfloat}
5819 % \begin{macrocode}
5820 \def\adjbox@addfloat#1#2#3#4{%
5821 \Gin@esetsize
5822 \@tempswatrue
5823 \ifnum\adjbox@caption@pos>10
5824 \chardef\adjbox@caption@pos=0\csname adjbox@caption@#1@pos\endcsname\relax
5825 \fi
5826 \ifcase\adjbox@caption@pos
5827 \def\@tempa{\adjust@addcode{#2#3}}%
5828 \expandafter\expandafter\expandafter\@tempa
5829 \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label#4}%
5830 \else
5831 \def\@tempa##1{\adjust@addcode{#2#3\adjbox@captionabove##1}}%
5832 \expandafter\expandafter\expandafter\@tempa
5833 \expandafter\expandafter\expandafter
5834 {\expandafter\adjbox@caption\adjbox@label}{#4}%
5835 \fi
5836 }
5837 % \end{macrocode}
5838 % \end{macro}
5839 %
5840 % \begin{macro}{\adjbox@captionabove}
5841 % \begin{macrocode}
5842 \@ifpackageloaded{caption}{%
5843 \let\adjbox@captionabove\relax
5844 }{%
5845 \def\adjbox@captionabove{%
5846 \begingroup
5847 \edef\@tempa{\endgroup
5848 \abovecaptionskip=\the\belowcaptionskip\relax
5849 \belowcaptionskip=\the\abovecaptionskip\relax
5850 }%
5851 \@tempa
5852 }%
5853 \AtBeginDocument{%
5854 \@ifpackageloaded{caption}{%
5855 \global\let\adjbox@captionabove\relax
5856 }{}%
5857 }%
5858 }
5859 % \end{macrocode}
5860 % \end{macro}
5861 %
5862 % \begin{macro}{\adjbox@nofloatenv}
5863 % \begin{macrocode}
5864 \def\adjbox@nofloatenv{minipage}
5865 % \end{macrocode}
5866 % \end{macro}
5867 %
5868 % \begin{macro}{\adjbox@nofloatcaptionsetup}
5869 % Calls \Macro\captionsetup from the \pkg{caption} package if defined, otherwise sets \Macro\@captype directly.
5870 % Calls \Macro\capstart from the \pkg{hypcap} package if defined. Both are done to ensure correct hypertargets on top
5871 % of the content and not at the caption position.
5872 % \begin{macrocode}
5873 \def\adjbox@nofloatcaptionsetup#1{%
5874 \@ifundefined{captionsetup}%
5875 {\def\@captype{#1}}%
5876 {\captionsetup{type={#1}}}%
5877 \csname capstart\endcsname
5878 }
5879 % \end{macrocode}
5880 % \end{macro}%
5881 %
5882 % \begin{environment}{adjnofloat}
5883 % Environment used for non-floats.
5884 % \begin{macrocode}
5885 \newenvironment{adjnofloat}[1]{%
5886 \par\noindent
5887 \minipage{\linewidth}%
5888 \adjbox@nofloatcaptionsetup{#1}%
5889 }{%
5890 \endminipage\par
5891 }
5892 % \end{macrocode}
5893 % \end{environment}
5894 %
5895 %
5896 % ^^A )))
5897 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5898 % \subsection{Change or discard the content} ^^A (((
5899 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5900 %
5901 % \begin{key}{adjbox}{phantom}
5902 % \begin{macrocode}
5903 \define@key\adjbox@fam{phantom}[]{%
5904 \expandafter\ifx\csname #1phantom\endcsname\relax
5905 \adjust@addcode{\phantom}{}%
5906 \else
5907 \expandafter\adjust@addcode\expandafter{\csname #1phantom\endcsname}{}%
5908 \fi
5909 }
5910 % \end{macrocode}
5911 % \end{key}
5912 %
5913 % \begin{macro}{\phantombox}[3]{width}{height}{depth}
5914 % Produces an empty box with the given width, height and depth.
5915 % \begin{macrocode}
5916 \newcommand*\phantombox[3]{%
5917 \begingroup
5918 \adjsetlength\@tempdima{#1}%
5919 \adjsetlength\@tempdimb{#2}%
5920 \adjsetlength\@tempdimc{#3}%
5921 \setbox\collectedbox\hbox{}%
5922 \wd\collectedbox\@tempdima
5923 \ht\collectedbox\@tempdimb
5924 \dp\collectedbox\@tempdimc
5925 \leavevmode
5926 \box\collectedbox
5927 \endgroup
5928 }
5929 % \end{macrocode}
5930 % \end{macro}
5931 %
5932 %
5933 % \begin{key}{adjbox}{gobble}
5934 % Discards the content.
5935 % \begin{macrocode}
5936 \define@key\adjbox@fam{gobble}[\@nil]{%
5937 \adjbox@novalue{#1}%
5938 \let\adjustbox@noindent\relax
5939 \adjbox@Gin@Add{\@Collectbox{}}%
5940 }
5941 % \end{macrocode}
5942 % \end{key}
5943 %
5944 % \begin{key}{adjbox}{discard}
5945 % Alias of \Key{gobble}.
5946 % \begin{macrocode}
5947 \adjbox@let@key\adjbox@fam{discard}{gobble}%
5948 % \end{macrocode}
5949 % \end{key}
5950 %
5951 %
5952 % \begin{key}{adjbox}{content}
5953 % Replaces the content. The old content is still processed completely before being replaced..
5954 % \begin{macrocode}
5955 \define@adjboxkey{content}{\@Collectbox{#1}}%
5956 % \end{macrocode}
5957 % \end{key}
5958 %
5959 %
5960 % ^^A )))
5961 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5962 % \subsection{Store box content and sizes} ^^A (((
5963 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5964 %
5965 % \begin{key}{adjbox}{gstore}
5966 % Store the current content into a box without removing it.
5967 % \begin{macrocode}
5968 \define@adjboxkey{gstore}{\global\@collectboxto{#1}{\BOXCONTENT}}
5969 % \end{macrocode}
5970 % \end{key}
5971 %
5972 % \begin{key}{adjbox}{gstore*}
5973 % Store the content into a box only.
5974 % \begin{macrocode}
5975 \define@key\adjbox@fam{gstore*}{%
5976 \let\adjustbox@noindent\relax
5977 \adjbox@Gin@Add{\global\sbox{#1}}%
5978 }
5979 % \end{macrocode}
5980 % \end{key}
5981 %
5982 % \begin{key}{adjbox}{gstore width}
5983 % \begin{macrocode}
5984 \define@key{adjbox}{gstore width}{%
5985 \adjbox@Gin@Add{\@Collectbox{\global#1=\width\BOXCONTENT}}%
5986 }
5987 % \end{macrocode}
5988 % \end{key}
5989 %
5990 % \begin{key}{adjbox}{gstore depth}
5991 % \begin{macrocode}
5992 \define@key{adjbox}{gstore depth}{%
5993 \adjbox@Gin@Add{\@Collectbox{\global#1=\depth\BOXCONTENT}}%
5994 }
5995 % \end{macrocode}
5996 % \end{key}
5997 %
5998 % \begin{key}{adjbox}{gstore height}
5999 % \begin{macrocode}
6000 \define@key{adjbox}{gstore height}{%
6001 \adjbox@Gin@Add{\@Collectbox{\global#1=\height\BOXCONTENT}}%
6002 }
6003 % \end{macrocode}
6004 % \end{key}
6005 %
6006 % \begin{key}{adjbox}{gstore totalheight}
6007 % \begin{macrocode}
6008 \define@key{adjbox}{gstore totalheight}{%
6009 \adjbox@Gin@Add{\@Collectbox{\global#1=\totalheight\BOXCONTENT}}%
6010 }
6011 % \end{macrocode}
6012 % \end{key}
6013 %
6014 % \begin{key}{adjbox}{gstore sizes}
6015 % \begin{macrocode}
6016 \define@key{adjbox}{gstore sizes}{%
6017 \adjbox@Gin@Add{\@Collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
6018 }
6019 % \end{macrocode}
6020 % \end{key}
6021 %
6022 % \begin{macro}{\adjbox@gstore@sizes}[4]{width register}{height register}{depth register}{totalheight register}
6023 % Stores the width, height, depth and totalheight in the given registers if they are not empty (or \Macro\relax).
6024 % \begin{macrocode}
6025 \def\adjbox@gstore@sizes#1#2#3#4#5\@nnil{%
6026 \ifx\relax#1\relax\else
6027 \global#1=\width
6028 \fi
6029 \ifx\relax#2\relax\else
6030 \global#2=\height
6031 \fi
6032 \ifx\relax#3\relax\else
6033 \global#3=\depth
6034 \fi
6035 \ifx\relax#4\relax\else
6036 \global#4=\totalheight
6037 \fi
6038 }
6039 % \end{macrocode}
6040 % \end{macro}
6041 %
6042 %
6043 %
6044 % ^^A )))
6045 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6046 % \subsection{Experimental split and pagebreak keys and macros} ^^A (((
6047 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6048 %
6049 % \begin{macrocode}
6050 %%\RequirePackage{storebox}
6051 % \end{macrocode}
6052 %
6053 % \begin{macro}{\splitbox}
6054 % \begin{macrocode}
6055 \newcommand\splitbox[2]{%
6056 \collectboxcheckenv{splitbox}%
6057 \@collectbox{\@splitbox{#1}{#2}}%
6058 }
6059 % \end{macrocode}
6060 % \end{macro}
6061 %
6062 %
6063 % \begin{key}{adjbox}{split}
6064 % \begin{macrocode}
6065 \define@adjboxkey{split}{\@Collectbox{\@splitbox#1}}
6066 % \end{macrocode}
6067 % \end{key}
6068 %
6069 %
6070 % \begin{macro}{\@splitbox}
6071 % \begin{macrocode}
6072 \def\@splitbox#1#2{%
6073 \ifstorebox
6074 \storebox\splittedbox{\BOXCONTENT}%
6075 \setbox\collectedbox\hbox{\usestorebox\splittedbox}%
6076 \fi
6077 \xdef\@tempa{#1}%
6078 \xdef\@tempb{#2}%
6079 \ifx\@tempa\Gin@exclamation
6080 \@tempdima\maxdimen
6081 \else
6082 \adjsetlength\@tempdima\@tempa
6083 \fi
6084 \ifx\@tempb\Gin@exclamation
6085 \Gin@nat@height\maxdimen
6086 \else
6087 \adjsetlength\Gin@nat@height\@tempb
6088 \fi
6089 \ifdim\@tempdima>\width
6090 \@tempdima\width
6091 \fi
6092 \ifdim\Gin@nat@height>\totalheight
6093 \Gin@nat@height\totalheight
6094 \fi
6095 \tc@llx\z@
6096 \tc@lly\totalheight
6097 \tc@urx\width
6098 \tc@ury\z@
6099 \advance\tc@lly-\Gin@nat@height
6100 \@@splitbox
6101 }
6102 % \end{macrocode}
6103 % \end{macro}
6104 %
6105 %
6106 % \begin{macro}{\@@splitbox}
6107 % \begin{macrocode}
6108 \def\@@splitbox{%
6109 \advance\tc@urx-\@tempdima
6110 \@@@splitbox
6111 \ifdim\tc@urx>\z@
6112 \advance\tc@llx+\@tempdima
6113 \expandafter\@@splitbox
6114 \else
6115 \ifdim\tc@lly<\splitbox@epsilon
6116 \splitboxlastnewline
6117 \else
6118 \splitboxnewline
6119 \tc@llx\z@
6120 \tc@urx\width
6121 \advance\tc@lly-\Gin@nat@height
6122 \advance\tc@ury+\Gin@nat@height
6123 \expandafter\expandafter
6124 \expandafter\@@splitbox
6125 \fi
6126 \fi
6127 }
6128 % \end{macrocode}
6129 % \end{macro}
6130 %
6131 %
6132 % \begin{macro}{\@@@splitbox}
6133 % \begin{macrocode}
6134 \def\@@@splitbox{%
6135 \begingroup
6136 \setbox\collectedbox=\copy\collectedbox
6137 \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
6138 \splitboxcmd{\usebox\collectedbox}%
6139 \endgroup
6140 }
6141 % \end{macrocode}
6142 % \end{macro}
6143 %
6144 % \begin{macro}{\@@@splitbox}
6145 % \begin{macrocode}
6146 \def\@@@splitbox{%
6147 \begingroup
6148 \setbox\collectedbox=\copy\collectedbox
6149 \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
6150 \splitboxcmd{\usebox\collectedbox}%
6151 \endgroup
6152 }
6153 % \end{macrocode}
6154 % \end{macro}
6155 %
6156 %
6157 % \begin{macro}{\splitboxcmd}
6158 % \begin{macrocode}
6159 \let\splitboxcmd\empty
6160 % \end{macrocode}
6161 % \end{macro}
6162 %
6163 %
6164 % \begin{macro}{\splitboxnewline}
6165 % \begin{macrocode}
6166 \newcommand\splitboxnewline{\\}
6167 % \end{macrocode}
6168 % \end{macro}
6169 %
6170 %
6171 % \begin{macro}{\splitboxlastnewline}
6172 % \begin{macrocode}
6173 \newcommand\splitboxlastnewline{\splitboxnewline}
6174 % \end{macrocode}
6175 % \end{macro}
6176 %
6177 %
6178 % \begin{macro}{\splitbox@epsilon}
6179 % \begin{macrocode}
6180 \def\splitbox@epsilon{100sp}
6181 % \end{macrocode}
6182 % \end{macro}
6183 %
6184 %
6185 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6186 %
6187 % \begin{macro}{\pagebreakbox}
6188 % \begin{macrocode}
6189 \newcommand\pagebreakbox{%
6190 \par\noindent
6191 \collectboxcheckenv{pagebreakbox}%
6192 \@collectbox{\@pagebreakbox}%
6193 }
6194 % \end{macrocode}
6195 % \end{macro}
6196 %
6197 % \begin{key}{adjbox}{pagebreak}
6198 % \begin{macrocode}
6199 \define@key\adjbox@fam{pagebreak}[]{%
6200 \adjbox@Gin@Add{\@Collectbox{\@pagebreakbox}}%
6201 }
6202 % \end{macrocode}
6203 % \end{key}
6204 %
6205 %
6206 %
6207 % \begin{macro}{\@pagebreakbox}
6208 % Used internal macros:
6209 %
6210 % \begin{tabular}{ll}
6211 % \Macro\@tempa & Caption code \\
6212 % \Macro\@tempboxa & Caption box \\
6213 % \Macro\tc@lly & Lower clip amount \\
6214 % \Macro\tc@ury & Lower clip amount \\
6215 % \end{tabular}
6216 % \begin{macrocode}
6217 \def\@pagebreakbox{%
6218 \sbox\collectedbox{\raise\dp\collectedbox\hbox{\BOXCONTENT}}%
6219 \ifstorebox
6220 \storebox\splittedbox{\BOXCONTENT}%
6221 \setbox\collectedbox\hbox{\usestorebox\splittedbox}%
6222 \fi
6223 \adjsetlength\tc@lly
6224 {\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}%
6225 \ifdim\tc@lly>\z@
6226 \begingroup
6227 \setbox\collectedbox=\copy\collectedbox
6228 \@clipbox\collectedbox\z@\tc@lly\z@\z@
6229 \BOXCONTENT
6230 \endgroup
6231 \par\noindent
6232 \adjsetlength\tc@ury{\totalheight-\tc@lly}%
6233 \ifdim\tc@lly>\textheight
6234 \loop
6235 \advance\tc@lly-\textheight
6236 \begingroup
6237 \setbox\collectedbox=\copy\collectedbox
6238 \@clipbox\collectedbox\z@\tc@lly\z@\tc@ury
6239 \BOXCONTENT
6240 \endgroup
6241 \advance\tc@ury\textheight
6242 \par\noindent
6243 \ifdim\tc@lly>\textheight
6244 \repeat
6245 \@clipbox\collectedbox\z@\z@\z@\tc@ury
6246 \BOXCONTENT
6247 \else
6248 \@clipbox\collectedbox\z@\z@\z@\tc@ury
6249 \par\noindent
6250 \BOXCONTENT
6251 \fi
6252 \else
6253 \BOXCONTENT%
6254 \fi
6255 \par
6256 }
6257 % \end{macrocode}
6258 % \end{macro}
6259 %
6260 %
6261 % \begin{macro}{\pagebreakboxoffset}
6262 % \begin{macrocode}
6263 \newcommand*\pagebreakboxoffset{\ht\strutbox}
6264 % \end{macrocode}
6265 % \end{macro}
6266 %
6267 %
6268 % ^^A )))
6269 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6270 % vim: foldenable foldmethod=marker foldmarker=(((,)))
6271 % \iffalse
6272 %</adjustbox.sty>
6273 % \fi
6274 %
6275 % ^^A )))
6276 % \Finale
6277 % \endinput
6278 % ^^A vim: foldenable foldmethod=marker foldmarker=(((,)))