diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-13 22:19:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-13 22:19:43 +0000 |
commit | d429ad262261b593689d81ac6db8bdaf16c6b2b2 (patch) | |
tree | 16722bab0f431e76ac520bb97b5e018b6a94b1b5 /Master/texmf-dist/tex/latex/adjustbox | |
parent | 5730d1c679f7a725b75ce80066cc6a6987aee888 (diff) |
adjustbox (13aug11)
git-svn-id: svn://tug.org/texlive/trunk@23541 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/adjustbox')
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty | 113 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty | 172 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjpgf.def | 46 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty | 837 |
4 files changed, 1077 insertions, 91 deletions
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty new file mode 100644 index 00000000000..47e512f3aba --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty @@ -0,0 +1,113 @@ +%% +%% This is file `adjcalc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% adjustbox.dtx (with options: `adjcalc') +%% +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx and adjustbox.ins +%% and the derived files adjustbox.sty, adjcalc.sty, adjpgf.def and +%% adjgrfx.sty. +%% +\begingroup +\def\@tempa{adjcalc} +\expandafter +\endgroup +\ifx\@tempa\@currname + \ProvidesPackage{adjcalc}[2011/08/07 v1.0 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)] + \RequirePackage{xkeyval} +\fi +\AtEndOfPackage{\adjcalc@atend} +\def\adjcalc@atend{% +\begingroup +\expandafter\ifx\csname eTeXversion\endcsname\relax + \endgroup + \RequirePackage{calc}% + \adjcalc@calc + \def\adjcalc@etex{\PackageError{adjcalc}{e-TeX not available for current compiler!}}% +\else + \endgroup + \adjcalc@etex +\fi +} +\def\adjcalc@pgfmath{\AtEndOfPackage{\RequirePackage{pgf}}\def\adjcalc@atend{\adjcalc@pgfmath}} +\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}} +\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}} +\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}} +\DeclareOptionX<adjbox>{pgfmath}{\adjcalc@pgfmath} +\DeclareOptionX<adjbox>{etex}{\adjcalc@etex} +\DeclareOptionX<adjbox>{calc}{\adjcalc@calc} +\DeclareOptionX<adjbox>{none}{\let\adjcalc@atend\relax\def\adjsetlength{\setlength}\let\adjcalc@overwrite\relax} +\DeclareOptionX<adjbox>{overwrite}{\adjcalc@overwrite} +\ProcessOptionsX*<adjbox> +\disable@keys{adjbox}{none} +\def\adjcalc@etex{% + \protected\def\adjsetlength##1##2{% + ##1=\glueexpr(##2)\relax + }% + \protected\def\adjaddtolength##1##2{% + \advance##1 by \glueexpr(##2)\relax + }% + \protected\def\adjsetcounter##1##2{% + \@ifundefined{c@##1}% + {\@nocounterr{##1}}% + {\global\csname c@##1\endcsname\numexpr(##2)\relax}% + }% + \protected\def\adjaddtocounter##1##2{% + \@ifundefined{c@##1}% + {\@nocounterr{##1}}% + {\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}% + }% + \def\adjbox@default##1##2{% + \@defaultunits##1=\glueexpr##2 \adjbox@defaultunit\relax\@nnil + }% +} +\def\adjcalc@calc{% + \DeclareRobustCommand\adjsetlength{\calc@assign@skip}% + \DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}% + \DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}% + \DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}% + \def\adjbox@checkdefault##1\@nnil##2##3{% + \ifx\relax##1\relax\else + \calc@assign@skip{##2}{##3}% + \fi + }% +} +\def\adjcalc@pgfmath{% + \DeclareRobustCommand\adjsetlength{\pgfmathsetlength}% + \DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}% + \DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}% + \DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}% + \def\adjbox@default##1##2{% + \edef\pgfmathresultunitscale{1\adjbox@defaultunit}% + \let\pgfmathpostparse\pgfmathscaleresult + \pgfmathparse{##2}% + ##1=\pgfmathresult pt\relax + }% +} +\def\adjcalc@overwrite{% + \let\setlength\adjsetlength + \let\addtolength\adjaddtolength + \let\setcounter\adjsetcounter + \let\addtocounter\adjaddtocounter +} +\endinput +%% +%% End of file `adjcalc.sty'. diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty b/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty new file mode 100644 index 00000000000..215159e1fda --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty @@ -0,0 +1,172 @@ +%% +%% This is file `adjgrfx.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% adjustbox.dtx (with options: `adjgrfx') +%% +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx and adjustbox.ins +%% and the derived files adjustbox.sty, adjcalc.sty, adjpgf.def and +%% adjgrfx.sty. +%% +\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox] +\RequirePackage{graphicx} +%%^^A \width, \height, \totalheight, \depth = size current at option execution (changes after every option) (initial: natural size) +%%^^A \Width, \Height, \Totalheight, \Depth = requested size of image (height/totalheight and width) (initial: natural size) +%%^^A \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH = natural size of image +%% +%% +\newcommand*\Gin@adj@adddim{% + \let\height\Gin@nat@height + \let\width\Gin@nat@width + \let\totalheight\height + \let\depth\z@ + \let\adjbox@HEIGHT\HEIGHT + \let\adjbox@WIDTH\WIDTH + \let\adjbox@TOTALHEIGHT\TOTALHEIGHT + \let\adjbox@DEPTH\DEPTH + \global\let\HEIGHT\Gin@nat@height + \global\let\WIDTH\Gin@nat@width + \global\let\TOTALHEIGHT\HEIGHT + \global\let\DEPTH\z@ + \let\adjbox@Height\Height + \let\adjbox@Width\Width + \let\adjbox@Totalheight\Totalheight + \let\adjbox@Depth\Depth + \global\let\Height\Gin@nat@height + \global\let\Width\Gin@nat@width + \global\let\Totalheight\Height + \global\let\Depth\z@ + \edef\adjbox@restore@dims{% + \global\adjbox@nat@height\the\adjbox@nat@height\relax + \global\adjbox@nat@width \the\adjbox@nat@width\relax + \global\adjbox@req@height\the\adjbox@req@height\relax + \global\adjbox@req@width \the\adjbox@req@width\relax + }% +} +\newcommand*\Gin@adj@remdim{% + \global\let\HEIGHT\adjbox@HEIGHT + \global\let\WIDTH\adjbox@WIDTH + \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT + \global\let\DEPTH\adjbox@DEPTH + \global\let\Height\adjbox@Height + \global\let\Width\adjbox@Width + \global\let\Totalheight\adjbox@Totalheight + \global\let\Depth\adjbox@Depth + \adjbox@restore@dims +} +\newdimen\adjbox@nat@width +\newdimen\adjbox@nat@height +\newdimen\adjbox@req@width +\newdimen\adjbox@req@height +\newcommand*\Gin@adj@keepdim{% + \global\adjbox@nat@height\Gin@nat@height + \global\adjbox@nat@width \Gin@nat@width + \global\adjbox@req@height\Gin@req@height + \global\adjbox@req@width \Gin@req@width + \global\let\HEIGHT\adjbox@nat@height + \global\let\WIDTH\adjbox@nat@width + \global\let\TOTALHEIGHT\adjbox@nat@height + \global\let\DEPTH\z@ + \global\let\Height\adjbox@req@height + \global\let\Width\adjbox@req@width + \global\let\Totalheight\adjbox@req@height + \global\let\Depth\z@ +} +\def\Gin@ii[#1]#2{% + \def\@tempa{[}\def\@tempb{#2}% + \ifx\@tempa\@tempb + \def\@tempa{\Gin@iii[#1][}% + \expandafter\@tempa + \else + \begingroup + \Gin@adj@adddim + \@tempswafalse + \toks@{\Ginclude@graphics{#2}}% + \setkeys{Gin}{#1}% + \Gin@esetsize + \the\toks@ + \Gin@adj@remdim + \endgroup + \fi} +\def\Gin@iii[#1,#2][#3,#4]#5{% + \begingroup + \Gin@adj@adddim + \Gin@bboxtrue + \Gin@defaultbp\Gin@llx{#1}% + \Gin@defaultbp\Gin@lly{#2}% + \Gin@defaultbp\Gin@urx{#3}% + \Gin@defaultbp\Gin@ury{#4}% + \Ginclude@graphics{#5}% + \Gin@adj@remdim + \endgroup} +\def\Gin@setfile#1#2#3{% + \ifx\\#2\\\Gread@false\fi + \ifGin@bbox\else + \ifGread@ + \csname Gread@% + \expandafter\ifx\csname Gread@#1\endcsname\relax + eps% + \else + #1% + \fi + \endcsname{\Gin@base#2}% + \else + \Gin@nosize{#3}% + \fi + \fi + \Gin@viewport@code + \Gin@nat@height\Gin@ury bp% + \advance\Gin@nat@height-\Gin@lly bp% + \Gin@nat@width\Gin@urx bp% + \advance\Gin@nat@width-\Gin@llx bp% + \Gin@req@sizes + \Gin@adj@keepdim + \expandafter\ifx\csname Ginclude@#1\endcsname\relax + \Gin@drafttrue + \expandafter\ifx\csname Gread@#1\endcsname\relax + \@latex@error{Can not include graphics of type: #1}\@ehc + \global\expandafter\let\csname Gread@#1\endcsname\@empty + \fi + \fi + \leavevmode + \ifGin@draft + \hb@xt@\Gin@req@width{% + \vrule\hss + \vbox to \Gin@req@height{% + \hrule \@width \Gin@req@width + \vss + \edef\@tempa{#3}% + \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}% + \vss + \hrule}% + \hss\vrule}% + \else + \@addtofilelist{#3}% + \ProvidesFile{#3}[Graphic file (type #1)]% + \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}% + \dp\z@\z@ + \ht\z@\Gin@req@height + \wd\z@\Gin@req@width + \box\z@ + \fi} +\endinput +%% +%% End of file `adjgrfx.sty'. diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def b/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def new file mode 100644 index 00000000000..e4b3e3b6d94 --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def @@ -0,0 +1,46 @@ +%% +%% This is file `adjpgf.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% adjustbox.dtx (with options: `adjpgf.def') +%% +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx and adjustbox.ins +%% and the derived files adjustbox.sty, adjcalc.sty, adjpgf.def and +%% adjgrfx.sty. +%% +\RequirePackage{pgf} +\def\@clipbox#1#2#3#4#5{% + \@trimbox{#1}{#2}{#3}{#4}{#5}% + \setbox#5\hbox{\begin{pgfpicture}% + \pgfpathmoveto{\pgfqpoint\z@{-\dp#5}}% + \pgfpathlineto{\pgfqpoint\z@{\ht#5}}% + \pgfpathlineto{\pgfqpoint{\wd#5}{\ht#5}}% + \pgfpathlineto{\pgfqpoint{\wd#5}{-\dp#5}}% + \pgfpathclose + \pgfusepathqclip + \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% + \pgfnode{rectangle}{base west}{\usebox#5}{}{}% + \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% + \end{pgfpicture}}% +} +\endinput +%% +%% End of file `adjpgf.def'. diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty index 254b98c087e..9cb704520bf 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% adjustbox.dtx (with options: `package') +%% adjustbox.dtx (with options: `adjustbox') %% %% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> %% @@ -22,113 +22,768 @@ %% %% The Current Maintainer of this work is Martin Scharrer. %% -%% This work consists of the files adjustbox.dtx, adjustbox.ins -%% and the derived file adjustbox.sty. +%% This work consists of the files adjustbox.dtx and adjustbox.ins +%% and the derived files adjustbox.sty, adjcalc.sty, adjpgf.def and +%% adjgrfx.sty. %% -\ProvidesPackage{adjustbox} - [2011/03/20 v0.3 Adjusting TeX boxes (trim, clip, ...)] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{adjustbox}[2011/08/07 v0.5 Adjusting TeX boxes (trim, clip, ...)] +\RequirePackage{xkeyval} + +\def\adjbox@defaultunit{bp} +\DeclareOptionX<adjbox>{defaultunit}{% + \def\adjbox@defaultunit{#1}% + \begingroup + \def\@tempa{none}% + \expandafter\endgroup + \ifx\@tempa\adjbox@defaultunit + \def\adjbox@default{\adjsetlength}% + \fi +} + +\def\adjbox@fam{adjbox} +\DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}} +\DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}} +\DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput} + +\def\adjbox@driver{adj\Gin@driver} +\DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}} +\DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath} +\DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}} + +\let\adjbox@maybeend\relax +\input{adjcalc.sty} +\disable@keys{adjbox}{patch,export,PGF,minimal} \RequirePackage{graphicx}[1999/02/16] -\RequirePackage{pgf} +\RequirePackage{collectbox}[2011/08/06] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\define@key{adjbox}{viewport}{% + \let\Gin@viewport@code\adjbox@@viewport + \let\adjustbox@@@\adjustbox@@@trimclip + \adjbox@parse@v{#1}% +} +\define@key{adjbox}{trim}{% + \let\Gin@viewport@code\adjbox@@trim + \let\adjustbox@@@\adjustbox@@@trimclip + \adjbox@parse@v{#1}% +} +\def\adjustbox@@@trimclip{% + \Gin@viewport@code + \ifGin@clip + \expandafter\@clipbox + \else + \expandafter\@trimbox + \fi + \adjbox@tllx + \adjbox@tlly + \adjbox@turx + \adjbox@tury + \collectedbox + \usebox\collectedbox +} +\def\adjbox@parse@v#1{% + \adjbox@parse@@v#1 {} {} {} \\% +} +\def\adjbox@parse@@v#1 #2 #3 #4 #5\\{% + \adjbox@default\adjbox@tllx{#1}% + \ifx\@nnil#2\@nnil + \adjbox@tlly\adjbox@tllx + \adjbox@turx\adjbox@tllx + \adjbox@tury\adjbox@tlly + \else + \adjbox@default\adjbox@tlly{#2}% + \ifx\@nnil#3\@nnil + \adjbox@turx\adjbox@tllx + \adjbox@tury\adjbox@tlly + \else + \adjbox@default\adjbox@turx{#3}% + \adjbox@default\adjbox@tury{#4}% + \fi + \fi +}% +%%\newdimen\adjbox@llx +%%\newdimen\adjbox@lly +%%\newdimen\adjbox@urx +%%\newdimen\adjbox@ury +\newdimen\adjbox@tllx +\newdimen\adjbox@tlly +\newdimen\adjbox@turx +\newdimen\adjbox@tury +\let\adjbox@@trim\relax +\def\adjbox@@viewport{% + %\advance\adjbox@tllx by -\z@ + \advance\adjbox@tlly by \dp\collectedbox + \advance\adjbox@turx by -\wd\collectedbox + \advance\adjbox@tury by -\ht\collectedbox + \adjbox@turx=-\adjbox@turx + \adjbox@tury=-\adjbox@tury +} +\newcommand\trimbox{% + \collectboxcheckenv{trimbox}% + \@ifstar + \trimbox@s + \trimbox@ +} +\def\trimbox@#1{% + \collectbox{\trimbox@@\@trimbox{#1}}% +} +\def\trimbox@s#1{% + \collectbox{\trimbox@@{\adjbox@@viewport\@trimbox}{#1}}% +} +\def\trimbox@@#1#2{% + \adjbox@parse@v{#2}% + #1% + \adjbox@tllx + \adjbox@tlly + \adjbox@turx + \adjbox@tury + \collectedbox + \usebox\collectedbox +} +\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{% + \@collectboxisenv{trimbox*}% + \trimbox@s +} \newcommand\clipbox{% - \begingroup - \def\adjustbox@name{clipbox}% + \collectboxcheckenv{clipbox}% \@ifstar - {\adjustbox@{clip,viewport=}}% - {\adjustbox@{clip,trim=}}% + \clipbox@s + \clipbox@ } -\def\endclipbox{% - \endadjustbox +\def\clipbox@#1{% + \collectbox{\trimbox@@\@clipbox{#1}}% } -\newenvironment{clipbox*} - {\begin{clipbox}*} - {\end{clipbox}} -\newcommand\trimbox{% +\def\clipbox@s#1{% + \collectbox{\trimbox@@{\adjbox@@viewport\@clipbox}{#1}}% +} +\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{% + \@collectboxisenv{clipbox*}% + \clipbox@s +} +\newcommand\adjustbox[1]{% + \collectboxcheckenv{adjustbox}% \begingroup - \def\adjustbox@name{trimbox}% - \@ifstar - {\adjustbox@{viewport=}}% - {\adjustbox@{trim=}}% + \adjustbox@dimcmds + \let\Gin@esetsize\adjbox@esetsize + \@tempswatrue + \toks@{{\adjustbox@@@@}}% + \def\setlength{\adjsetlength}% + \setkeys{adjbox,Gin}{#1}% + \adjbox@esetsize + \adjbox@collectbox{\the\toks@\endgroup}% +} +\let\adjbox@collectbox\@collectbox +\def\adjustbox@@@@{\adjustbox@@@}% +\def\adjbox@esetsize{% + \ifcase0% + \ifx\Gin@ewidth\Gin@exclamation\else 1\fi + \ifx\Gin@eheight\Gin@exclamation\else 1\fi + \relax + \else + \edef\@tempa{\toks@{\noexpand + \Gscale@@box\noexpand\Gin@eresize + {\Gin@ewidth}{\Gin@eheight}{\the\toks@}}}% + \@tempa + \let\Gin@ewidth\Gin@exclamation + \let\Gin@eheight\Gin@exclamation + \fi +} +\def\adjustbox@dimcmds{% + \let\width\relax + \let\height\relax + \let\depth\relax + \let\totalheight\relax +} +\def\adjustbox@@@{% + \usebox\collectedbox } -\def\endtrimbox{% - \endadjustbox +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\@trimbox#1#2#3#4#5{% + \setbox#5=\hbox{% + \adjsetlength\@tempdima{#1}% + \hskip-\@tempdima + \adjsetlength\@tempdima{\dp#5 - (#2)}% + \adjsetlength\@tempdimb{\wd#5 - (#3)}% + \adjsetlength\@tempdimc{\ht#5 - (#4)}% + \dp#5=\@tempdima + \wd#5=\@tempdimb + \ht#5=\@tempdimc + \ifdim\dp#5<\z@ + \raise\dp#5% + \else + \ifdim\ht#5<\z@ + \lower\ht#5% + \fi\fi + \box#5% + }% + \ifdim\dp#5<\z@ \dp#5=\z@ \fi + \ifdim\wd#5<\z@ \wd#5=\z@ \fi + \ifdim\ht#5<\z@ \ht#5=\z@ \fi } -\newenvironment{trimbox*} - {\begin{trimbox}*} - {\end{trimbox}} -\newcommand\adjustbox{% +\def\@clipbox#1#2#3#4#5{% + \@trimbox{#1}{#2}{#3}{#4}{#5}% + \pdfxform#5% + \setbox#5=\hbox{% + \pdfrefxform\pdflastxform + }% +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{ifpdf} +\InputIfFileExists{\adjbox@driver}{% + \PackageInfo{adjustbox}{Using driver '\adjbox@driver'.}% +}{% + \ifpdf + \PackageInfo{adjustbox}{Using default pdftex driver.} + \else + \input{adjpgf.def}% + \PackageInfo{adjustbox}{Using fall-back PGF driver.} + \fi +} +\adjbox@maybeend +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand*\phantombox[3]{% \begingroup - \def\adjustbox@name{adjustbox}% - \adjustbox@{}% -} -\def\endadjustbox{% - \unskip - \egroup - \color@endgroup - \egroup - \adjustbox@@ -} -\def\adjustbox@#1#2{% - \def\adjustbox@setkeys{\setkeys{Gin}{#1#2}}% - \ifx\@currenvir\adjustbox@name - \edef\@currenvir{\@currenvir\noexpand\empty}% - \def\next{% - \setbox\@tempboxa\hbox\bgroup - \color@setgroup\bgroup - \ignorespaces - }% + \adjsetlength\@tempdima{#1}% + \adjsetlength\@tempdimb{#2}% + \adjsetlength\@tempdimc{#3}% + \setbox\collectedbox\hbox{}% + \wd\collectedbox\@tempdima + \ht\collectedbox\@tempdimb + \dp\collectedbox\@tempdimc + \leavevmode + \box\collectedbox + \endgroup +} +\newcommand*\minsizebox{% + \collectboxcheckenv{minsizebox}% + \@ifstar{\@minsizebox\totalheight}{\@minsizebox\height}% +} +\expandafter\newcommand\expandafter*\csname minsizebox*\endcsname{% + \@collectboxisenv{minsizebox*}% + \@minsizebox\totalheight +} +\newcommand*\@minsizebox[3]{% + \@collectbox{\@minmaxsizebox>#1{#2}{#3}}% +} +\newcommand*\maxsizebox{% + \collectboxcheckenv{maxsizebox}% + \@ifstar{\@maxsizebox\totalheight}{\@maxsizebox\height}% +} +\expandafter\newcommand\expandafter*\csname maxsizebox*\endcsname{% + \@collectboxisenv{maxsizebox*}% + \@maxsizebox\totalheight +} +\newcommand*\@maxsizebox[3]{% + \@collectbox{\@minmaxsizebox<#1{#2}{#3}}% +} +\newcommand*\@minmaxsizebox[4]{% + \edef\@tempa{#3}% + \edef\@tempb{#4}% + \ifcase0% + \ifx\@tempa\Gin@exclamation + \ifx\@tempb\Gin@exclamation + \else + \ifdim\@tempb#1#2% + 1% + \fi + \fi \else - \def\next{% - \setbox\@tempboxa\hbox\bgroup%0 - \color@setgroup\bgroup% - \aftergroup\color@endgroup - \aftergroup\egroup% - \aftergroup\adjustbox@@ - \@ifnextchar\bgroup - {\let\@let@token=}% - {\adjust@box}% + \ifx\@tempb\Gin@exclamation + \ifdim\@tempa#1\width + 2% + \fi + \else + \ifdim\@tempa#1\width + \ifdim\@tempb#1#2% + 3% + \else + 2% + \fi + \else + \ifdim\@tempb#1#2% + 1% + \fi + \fi + \fi + \fi + \relax% 0 + \BOXCONTENT + \or + \adjsetlength\@tempdima\@tempb + \Gscale@div\@tempa\@tempdima#2% + \Gscale@box\@tempa[\@tempa]\BOXCONTENT + \or + \adjsetlength\@tempdima\@tempa + \Gscale@div\@tempa\@tempdima\width + \Gscale@box\@tempa[\@tempa]\BOXCONTENT + \or + \adjsetlength\@tempdima\@tempa + \Gscale@div\@tempa\@tempdima\width + \adjsetlength\@tempdima\@tempb + \Gscale@div\@tempb\@tempdima#2% + \ifdim\@tempa\p@#1\@tempb\p@ + \let\@tempb\@tempa + \else + \let\@tempa\@tempb + \fi + \Gscale@box\@tempa[\@tempb]\BOXCONTENT + \fi +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\define@key\adjbox@fam{Trim}{% + \adjbox@Gin@Add{\trimbox@{#1}}% +} +\define@key\adjbox@fam{Viewport}{% + \adjbox@Gin@Add{\trimbox@s{#1}}% +} +\define@key\adjbox@fam{Clip}{% + \adjbox@Gin@Add{\clipbox@{#1}}% +} +\define@key\adjbox@fam{Clip*}{% + \adjbox@Gin@Add{\clipbox@s{#1}}% +} +\define@key\adjbox@fam{frame}[{{\fboxrule}}]{% + \adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil +} +\define@key\adjbox@fam{fbox}[{{\fboxrule}}]{% + \adjbox@frame{}#1 {} {} {} \relax\relax\@nnil +} +\def\adjbox@frame#1#2 #3 #4 #5\relax{% + \adjbox@Gin@Add{% + \@collectbox{#1\adjbox@@frame{}{#2}{#3}{#4}}% + }% + \remove@to@nnil +} +\define@key\adjbox@fam{cframe}{% + \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil +} +\define@key\adjbox@fam{cfbox}{% + \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil +} +\def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{% + \adjbox@Gin@Add{% + \@collectbox{#1\adjbox@@frame{\color{#2}}{#3}{#4}{#5}}% + }% + \remove@to@nnil +} +\def\adjbox@@frame#1#2#3#4{% + \ifx\@nnil#2\@nnil\else + \adjsetlength\fboxrule{#2}% + \fi + \ifx\@nnil#3\@nnil\else + \adjsetlength\fboxsep{#3}% + \fi + \adjsetlength\adjbox@tllx{\fboxrule + \fboxsep}% + \@marginbox + \adjbox@tllx + \adjbox@tllx + \adjbox@tllx + \adjbox@tllx + \collectedbox + \ifx\@nnil#4\@nnil\else + \setbox\collectedbox + \fi + \hbox\bgroup\color@setgroup + \BOXCONTENT + \hskip-\width + #1% + \adjbox@boxframe\width\height\depth + \color@endgroup\egroup + \ifx\@nnil#4\@nnil\else + \adjsetlength\adjbox@tllx{#4}% + \@marginbox + \adjbox@tllx + \adjbox@tllx + \adjbox@tllx + \adjbox@tllx + \collectedbox + \BOXCONTENT + \fi +} +\let\adjbox@boxframe\boxframe +\providecommand\adjbox@boxframe[3]{% + \hbox{% + \dimen@ #2% + \advance \dimen@ #3\relax + \lower #3\vbox {% + \hrule \@height \fboxrule + \@tempdima -0.5\fboxrule + \ifodd\fboxrule + \advance \@tempdima \m@ne sp + \fi + \kern \@tempdima + \hbox {% + \advance \dimen@ -\fboxrule + \vrule \@width \fboxrule \@height \dimen@ \@depth \z@ + \@tempdima #1% + \advance \@tempdima -\tw@ \fboxrule + \kern \@tempdima + \vrule \@width \fboxrule \@height \dimen@ \@depth \z@ + }% + \kern -0.5\fboxrule + \hrule \@height \fboxrule }% + }% +} +\define@key\adjbox@fam{scale}{% + \@ifnextchar\bgroup{% + \adjbox@scale@xy + }{% + \adjbox@scale@x + }#1\@nnil +} +\def\adjbox@scale@x#1\@nnil{% + \adjbox@scale@xy{#1}{#1}\@nnil% +} +\def\adjbox@scale@xy#1#2\@nnil{% + \if@tempswa + \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}% + \else + \def\Gin@req@sizes{% + \def\Gin@scalex{#1}\def\Gin@scaley{#2}% + \Gin@req@height\Gin@scaley\Gin@nat@height + \Gin@req@width\Gin@scalex\Gin@nat@width}% + \fi + \@tempswatrue +} +\define@key\adjbox@fam{reflect}[]{% + \adjbox@scale@xy{-1}{1}\@nnil +} +\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle +\define@key\adjbox@fam{lap}{% + \@ifnextchar\bgroup{% + \adjbox@lapbox + }{% + \adjbox@lapbox{#1}{}% + }#1{}{}\@nnil +} +\def\adjbox@lapbox#1#2#3\@nnil{% + \ifx\@nnil#2\@nnil + \adjbox@Gin@Add{\lapbox{#1}}% + \else + \adjbox@Gin@Add{\lapbox[{#1}]{#2}}% + \fi +} +\define@key\adjbox@fam{margin}{% + \adjbox@Gin@Add{\marginbox@{#1}}% +} +\define@key\adjbox@fam{margin*}{% + \adjbox@Gin@Add{\marginbox@s{#1}}% +} +\define@key\adjbox@fam{dpi}{% + \adjsetlength\pdfpxdimen{1in/(#1)}% +} +\define@key\adjbox@fam{pxdim}{% + \adjsetlength\pdfpxdimen{#1}% +} +\define@key\adjbox@fam{execute}{% + #1% +} +\define@key\adjbox@fam{raise}{% + \@ifnextchar\bgroup{% + \adjbox@raisebox + }{% + \adjbox@raisebox{#1}{}{}% + }#1{}{}{}\@nnil +} +\def\adjbox@raisebox#1#2#3#4\@nnil{% + \ifx\@nnil#3\@nnil + \adjbox@Gin@Add{\@irsbox{#1}[{#2}]}% + \else + \adjbox@Gin@Add{\@iirsbox{#1}[{#2}][{#3}]}% \fi - \next -} -\def\adjust@box#1{% - #1\egroup -} -\def\adjustbox@@{% - \def\width{\wd\@tempboxa}% - \def\height{\ht\@tempboxa}% - \def\depth{\dp\@tempboxa}% - \@tempdimc=\ht\@tempboxa - \advance\@tempdimc by \dp\@tempboxa\relax - \def\totalheight{\@tempdimc}% - \def\pgfmathresultunitscale{1bp}% - \let\pgfmathpostparse\pgfmathscaleresult - \let\Gin@defaultbp\pgfmathsetmacro - \let\setlength\pgfmathsetlength +} +\define@key\adjbox@fam{valign}{% + \csname adjbox@valign@#1\endcsname +} +\def\adjboxvtop{\ht\strutbox} +\def\adjboxvcenter{1ex} +\def\adjboxvbottom{-\dp\strutbox} +\def\adjbox@valign@t{% + \adjbox@Gin@Add{\@irsbox{\height+\adjboxvtop}[]}% +} +\def\adjbox@valign@T{% + \adjbox@Gin@Add{\@irsbox{-\height}[]}% +} +\def\adjbox@valign@M{% + \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height}[]}% +} +\def\adjbox@valign@m{% + \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height+\adjboxvcenter}[]}% +} +\def\adjbox@valign@b{% + \adjbox@Gin@Add{\@irsbox{\depth+\adjboxvbottom}[]}% +} +\def\adjbox@valign@B{% + \adjbox@Gin@Add{\@irsbox{\depth}[]}% +} +\define@key\adjbox@fam{bgcolor}{% + \adjbox@Gin@add{\colorbox{#1}}% +} +\define@key\adjbox@fam{set height}{% + \adjbox@Gin@Add{\@irsbox\z@[{#1}]}% +} +\define@key\adjbox@fam{set depth}{% + \adjbox@Gin@Add{\@iirsbox\z@[\height][{#1}]}% +} +\def\adjbox@Gin@add#1{% + \def\@tempa{#1}% + \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}% +} +\def\adjbox@Gin@Add{% + \Gin@esetsize \@tempswatrue - \toks@{{\adjustbox@@@}}% - \adjustbox@setkeys + \adjbox@Gin@add +} +\def\adjbox@Gin@sizeadd#1#2#3\relax{% + \ifx\@nnil#3\@nnil + \adjbox@Gin@add{#1{#2}{#2}}% + \else + \adjbox@Gin@add{#1{#2}{#3}}% + \fi +} +\def\adjbox@halign#1#2#3{% \Gin@esetsize - \the\toks@ - \endgroup + \@tempswatrue + \adjsetlength\@tempdima{#1}% + \edef\@tempa{\hb@xt@\the\@tempdima}% + \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}% } -\def\adjustbox@@@{% - \def\Gin@llx{0}% - \Gin@defaultbp\Gin@lly{+-\dp\@tempboxa}% - \Gin@defaultbp\Gin@urx{+\wd\@tempboxa}% - \Gin@defaultbp\Gin@ury{+\ht\@tempboxa}% - \Gin@viewport@code - \begin{pgfpicture}% - \pgfpathmoveto{\pgfqpoint{\Gin@llx pt}{\Gin@lly pt}}% - \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@lly pt}}% - \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@ury pt}}% - \pgfpathlineto{\pgfqpoint{\Gin@llx pt}{\Gin@ury pt}}% - \pgfpathclose - \expandafter\pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi\relax - \pgfset{inner sep=\z@,outer sep=\z@}% - \pgfnode{rectangle}{base west}{\box\@tempboxa}{ADJUSTBOX@NODE}{}% - \pgfsetbaselinepointnow{\pgfpointanchor{ADJUSTBOX@NODE}{base}}% - \end{pgfpicture}% +\define@key\adjbox@fam{center}[\linewidth]{% + \adjbox@halign{#1}\hss\hss +} +\define@key\adjbox@fam{left}[\linewidth]{% + \adjbox@halign{#1}\hss\relax +} +\define@key\adjbox@fam{right}[\linewidth]{% + \adjbox@halign{#1}\relax\hss +} +\define@key\adjbox@fam{outer}[\linewidth]{% + \def\@tempa{\adjbox@halign{#1}}% + \if@twoside + \adjbox@ifoddpage + {\@tempa\hss\relax}% + {\@tempa\relax\hss}% + \else + \@tempa\hss\hss + \fi +} +\define@key\adjbox@fam{inner}[\linewidth]{% + \def\@tempa{\adjbox@halign{#1}}% + \if@twoside + \adjbox@ifoddpage + {\@tempa\relax\hss}% + {\@tempa\hss\relax}% + \else + \@tempa\hss\hss + \fi +} +\def\adjbox@ifoddpage{% + \begingroup + \adjbox@checkoddpage + \expandafter\endgroup + \ifoddpage + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +\def\adjbox@checkoddpage{% + \ifodd\c@page + \oddpagetrue + \else + \oddpagefalse + \fi +}% +\newif\ifoddpage +\AtBeginDocument{% + \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}% + {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}% +}% +\define@key\adjbox@fam{min width}{% + \adjbox@Gin@Add{\@minsizebox\height{#1}!}% +} +\define@key\adjbox@fam{max width}{% + \adjbox@Gin@Add{\@maxsizebox\height{#1}!}% +} +\define@key\adjbox@fam{min height}{% + \adjbox@Gin@Add{\@minsizebox\height!{#1}}% +} +\define@key\adjbox@fam{max height}{% + \adjbox@Gin@Add{\@maxsizebox\height!{#1}}% +} +\define@key\adjbox@fam{min totalheight}{% + \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}% +} +\define@key\adjbox@fam{max totalheight}{% + \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}% +} +\define@key\adjbox@fam{min size}{% + \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax +} +\define@key\adjbox@fam{max size}{% + \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax +} +\define@key\adjbox@fam{min totalsize}{% + \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax +} +\define@key\adjbox@fam{max totalsize}{% + \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand*\lapbox[2][\width-\@tempdimb]{% + \collectboxcheckenv{lapbox}% + \@collectbox{\@lapbox{#1}{#2}}% +} +\def\@lapbox#1#2{% + \adjsetlength\@tempdima{#2}% + \ifdim\@tempdima<\z@ + \@tempdimb=-\@tempdima + \else + \@tempdimb=\@tempdima + \fi + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \leavevmode + \ifdim\@tempdima<\z@ + \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\usebox\collectedbox\hss}\hskip\@tempdimc}% + \else + \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}% + \fi +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand\marginbox{% + \collectboxcheckenv{marginbox}% + \@ifstar + \marginbox@s + \marginbox@ +} +\def\marginbox@#1{% + \@collectbox{\marginbox@@{#1}}% +} +\def\marginbox@s#1{% + \@collectbox{\marginbox@@s{#1}}% +} +\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{% + \@collectboxisenv{marginbox*}% + \marginbox@s +} +\def\marginbox@@#1{% + \adjbox@parse@v{#1}% + \@marginbox + \adjbox@tllx + \adjbox@tlly + \adjbox@turx + \adjbox@tury + \collectedbox + \usebox\collectedbox +} +\def\marginbox@@s#1{% + \adjbox@parse@v{#1}% + \@marginbox + \adjbox@tllx + \adjbox@tlly + \adjbox@turx + \adjbox@tury + \collectedbox + \raise\adjbox@tlly\copy\collectedbox +} +\def\@marginbox#1#2#3#4#5{% + \setbox#5=\hbox{% + \adjsetlength\@tempdima{#1}% + \hskip\@tempdima + \adjsetlength\@tempdima{\dp#5 + #2}% + \adjsetlength\@tempdimb{\wd#5 + #3}% + \adjsetlength\@tempdimc{\ht#5 + #4}% + \dp#5=\@tempdima + \wd#5=\@tempdimb + \ht#5=\@tempdimc + \box#5% + }% +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\define@key{adjbox}{minipage}{% + \@ifnextchar[{% + \adjbox@innerenv{minipage}% + }{% + \adjbox@innerenv{minipage}{{#1}}\@nnil% + \remove@to@nnil + }#1\@nnil +} +\define@key{adjbox}{innerenv}{% + \@ifnextchar\bgroup{% + \adjbox@innerenv + }{% + \adjbox@innerenv{#1}\@nnil% + \remove@to@nnil + }#1\@nnil +} +\def\adjbox@innerenv#1#2\@nnil{% + \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}% +}% +\define@key{adjbox}{innercode}{% + \adjbox@innercode#1{}{}% +} +\def\adjbox@innerenv#1#2\@nnil{% + \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}% +}% +\def\adjbox@innercode#1#2{% + \def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}% +}% +\define@key{adjbox}{env}{% + \@ifnextchar\bgroup{% + \adjbox@addenv + }{% + \adjbox@addenv{#1}\@nnil% + \remove@to@nnil + }#1\@nnil +} +\def\adjbox@addenv#1#2\@nnil{% + \def\@tempa{\begin{#1}#2}% + \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}% +}% +\define@key{adjbox}{Addcode}{% + \adjust@@addcode#1{}\@nnil% +} +\define@key{adjbox}{addcode}{% + \Gin@esetsize + \@tempswatrue + \adjust@@addcode#1{}\@nnil% +} +\def\adjust@@addcode#1#2#3\@nnil{% + \ifx\@nnil#3\@nnil + \adjust@addcode{#1}{#2}% + \else + \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}% + \fi +} +\define@key{adjbox}{precode}{% + \Gin@esetsize + \@tempswatrue + \adjust@addcode{#1}{}% +} +\define@key{adjbox}{Precode}{% + \adjust@addcode{#1}{}% +} +\define@key{adjbox}{appcode}{% + \toks@\expandafter{\the\toks@#1}% } +\def\adjust@addcode#1#2{% + \def\@tempa{#1}% + \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}% +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \endinput %% %% End of file `adjustbox.sty'. |