diff options
author | Karl Berry <karl@freefriends.org> | 2011-11-14 23:44:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-11-14 23:44:26 +0000 |
commit | 4fc49c242f83529cc0f73af5ec5265d0d8a76ed3 (patch) | |
tree | 439424ce260d651c98e02d2256425058f8b6a2a9 /Master/texmf-dist/tex | |
parent | 55fa819ec3e5163054416e4a891add5908160987 (diff) |
adjustbox (14nov11)
git-svn-id: svn://tug.org/texlive/trunk@24593 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty | 24 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjdvips.def | 46 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def | 30 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjpgf.def | 36 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty | 249 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjxetex.def | 46 |
6 files changed, 355 insertions, 76 deletions
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty index d8bfb5db589..0fc7a627de3 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty @@ -56,12 +56,36 @@ \DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}% \DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}% \DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}% + \def\adjbox@default##1##2{% + \begingroup + \message{^^J\detokenize{##2}^^J}% + \def\calc@post@scan####1!{% + \def\@tempa{####1}% + \ifx\@tempa\@empty + \endgroup% to end calc processing + % is number only + \global\@adjbox@needsdefaulttrue + \else + \endgroup% to end calc processing + % full expression + \global\@adjbox@needsdefaultfalse + \fi + }% + \calc@assign@skip{##1}{##2 \adjbox@defaultunit}% + \endgroup + \if@adjbox@needsdefault + ##1=##2 \adjbox@defaultunit\relax + \else + \calc@assign@skip{##1}{##2}% + \fi + }% \def\adjbox@checkdefault##1\@nnil##2##3{% \ifx\relax##1\relax\else \calc@assign@skip{##2}{##3}% \fi }% } +\newif\if@adjbox@needsdefault \def\adjcalc@pgfmath{% \DeclareRobustCommand\adjsetlength{\pgfmathsetlength}% \DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}% diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def b/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def new file mode 100644 index 00000000000..006ef5fe50a --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def @@ -0,0 +1,46 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me> +%% ------------------------------------------------------------------ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx, adjustbox.ins +%% and the derived file adjustbox.sty. +%% +\ProvidesFile{adjdvips.def}[% + 2011/11/14 + v0.8 + adjustbox clip driver for dvips] +\def\@cliptoboxdim#1{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\ht#1+\dp#1}% + \edef\TOTALHEIGHT{-\strip@pt\@tempdima\space}% + \edef\DEPTH{\strip@pt\dp#1\space}% + \edef\WIDTH{\strip@pt\wd#1\space}% + \special{% + ps: + /mtrxc matrix currentmatrix def + currentpoint gsave + translate + Resolution 72 div VResolution 72 div + scale + newpath + 0 \DEPTH \WIDTH \TOTALHEIGHT rectclip + newpath + mtrxc setmatrix + }% + \box#1% + \special{ps: grestore }% + }% +} +\endinput +%% +%% End of file `adjdvips.def'. diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def b/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def new file mode 100644 index 00000000000..d5469f69f87 --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def @@ -0,0 +1,30 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me> +%% ------------------------------------------------------------------ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx, adjustbox.ins +%% and the derived file adjustbox.sty. +%% +\ProvidesFile{adjpdftex.def}[% + 2011/11/14 + v0.8 + adjustbox clip driver for pdftex] +\def\@cliptoboxdim#1{% + \pdfxform#1% + \setbox#1=\hbox{% + \pdfrefxform\pdflastxform + }% +} +\endinput +%% +%% End of file `adjpdftex.def'. diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def b/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def index 86e71e73067..122cc0071c7 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def +++ b/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def @@ -1,15 +1,35 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me> +%% ------------------------------------------------------------------ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx, adjustbox.ins +%% and the derived file adjustbox.sty. +%% +\ProvidesFile{adjpgf.def}[% + 2011/11/14 + v0.8 + adjustbox fall-back clip driver using PGF] \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}}% +\def\@cliptoboxdim#1{% + \setbox#1\hbox{\begin{pgfpicture}% + \pgfpathmoveto{\pgfqpoint\z@{-\dp#1}}% + \pgfpathlineto{\pgfqpoint\z@{\ht#1}}% + \pgfpathlineto{\pgfqpoint{\wd#1}{\ht#1}}% + \pgfpathlineto{\pgfqpoint{\wd#1}{-\dp#1}}% \pgfpathclose \pgfusepathqclip \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% - \pgfnode{rectangle}{base west}{\usebox#5}{}{}% + \pgfnode{rectangle}{base west}{\usebox#1}{}{}% \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% \end{pgfpicture}}% } diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty index 622fbb7995a..819c1cbbb99 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> -%% --------------------------------------------------------------------------- +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me> +%% ------------------------------------------------------------------ %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. @@ -18,8 +18,8 @@ %% and the derived file adjustbox.sty. %% \ProvidesPackage{adjustbox}[% - 2011/10/30 - v0.7 + 2011/11/14 + v0.8 Adjusting TeX boxes (trim, clip, ...)] \RequirePackage{xkeyval} \def\adjbox@defaultunit{bp} @@ -34,6 +34,7 @@ } \def\adjbox@fam{adjbox} \DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}} +\DeclareOptionX<adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}} \DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}} \DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput} \def\adjbox@driver{adj\Gin@driver} @@ -80,23 +81,20 @@ \fi } \let\adjbox@keysafter\@empty -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \define@key{adjbox}{viewport}{% - \def\adjustbox@@@{% + \def\adjustbox@content{% \adjbox@parse@v{#1}% \adjbox@@viewport \adjustbox@@@trimclip }% } \define@key{adjbox}{trim}{% - \def\adjustbox@@@{% + \def\adjustbox@content{% \adjbox@parse@v{#1}% \adjustbox@@@trimclip }% } \def\adjustbox@@@trimclip{% - \Gin@viewport@code \ifGin@clip \expandafter\@clipbox \else @@ -196,7 +194,7 @@ \expandafter \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}% } -\let\adjbox@collectbox\@collectbox +\def\adjbox@collectbox{\@collectbox} \def\adjbox@setkeys@ba{% \expandafter\expandafter \expandafter\adjbox@@setkeys@ba @@ -211,16 +209,29 @@ \setkeys*{ADJBOX}% } \def\adjustbox@#1{% - \adjustbox@dimcmds + \adjbox@Width\width + \adjbox@Height\height + \adjbox@Depth\depth + \adjbox@Totalheight\totalheight + \let\Width\adjbox@Width + \let\Height\adjbox@Height + \let\Depth\adjbox@Depth + \let\Totalheight\adjbox@Totalheight \let\Gin@esetsize\adjbox@esetsize \@tempswatrue - \toks@{{\adjustbox@@@@}}% + \toks@{{\adjustbox@content}}% \def\setlength{\adjsetlength}% \setkeys{adjbox,Gin}{#1}% \adjbox@esetsize \the\toks@ } -\def\adjustbox@@@@{\adjustbox@@@}% +\def\adjustbox@content{% + \usebox\collectedbox +} +\newdimen\adjbox@Width +\newdimen\adjbox@Height +\newdimen\adjbox@Depth +\newdimen\adjbox@Totalheight \def\adjbox@esetsize{% \ifcase0% \ifx\Gin@ewidth\Gin@exclamation\else 1\fi @@ -235,17 +246,11 @@ \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 -} \newcommand*\adjustimage[2]{% - \adjustbox{#1}{\includegraphics{#2}}% + \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}% +} +\newcommand*\adjincludegraphics[2][]{% + \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -273,23 +278,15 @@ } \def\@clipbox#1#2#3#4#5{% \@trimbox{#1}{#2}{#3}{#4}{#5}% - \pdfxform#5% - \setbox#5=\hbox{% - \pdfrefxform\pdflastxform - }% + \@cliptoboxdim{#5}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\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 + \input{adjpgf.def}% + \PackageInfo{adjustbox}{Using fall-back PGF driver.} } \adjbox@maybeend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -409,9 +406,11 @@ \remove@to@nnil } \define@key\adjbox@fam{cframe}{% + \adjbox@checkcolor \adjbox@cframe{\fboxsep\z@}#1 {} {} {} \relax\relax\@nnil } \define@key\adjbox@fam{cfbox}{% + \adjbox@checkcolor \adjbox@cframe{}#1 {} {} {} \relax\relax\@nnil } \def\adjbox@cframe#1#2 #3 #4 #5 #6\relax{% @@ -420,6 +419,17 @@ }% \remove@to@nnil } +\def\adjbox@checkcolor{% + \ifcase0% + \expandafter\ifx\csname ver@xcolor.sty\endcsname\relax + \expandafter\ifx\csname ver@color.sty\endcsname\relax + \expandafter\ifx\csname ver@xxcolor.sty\endcsname\relax 1\fi\fi\fi + \relax + \global\let\adjbox@checkcolor\relax + \else + \PackageError{adjustbox}{Using a macro, envrionment or key with color\MessageBreak requires a color package to be loaded manually.\MessageBreak Recommended is 'xcolor' but 'color' is ok, too}{}. + \fi +} \def\adjbox@@frame#1#2#3#4{% \ifx\@nnil#2\@nnil\else \adjsetlength\fboxrule{#2}% @@ -518,6 +528,12 @@ \adjbox@Gin@Add{\lapbox[{#1}]{#2}}% \fi } +\define@key\adjbox@fam{rlap}[]{% + \adjbox@Gin@Add{\lapbox{\width}}% +} +\define@key\adjbox@fam{llap}[]{% + \adjbox@Gin@Add{\lapbox{-\width}}% +} \define@key\adjbox@fam{margin}{% \adjbox@Gin@Add{\marginbox@{#1}}% } @@ -533,45 +549,77 @@ \define@key\adjbox@fam{execute}{% #1% } +\define@key\adjbox@fam{@debug}[]{% + \showthe\toks@ +} +\define@key{ADJBOX}{Execute}{% + #1% +} \define@key\adjbox@fam{raise}{% \@ifnextchar\bgroup{% - \adjbox@raisebox + \adjbox@raise }{% - \adjbox@raisebox{#1}{}{}% + \adjbox@raise{#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 +\def\adjbox@raise#1#2#3#4\@nnil{% + \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}% } \define@key\adjbox@fam{valign}{% \csname adjbox@valign@#1\endcsname } +\def\adjbox@raisebox#1#2#3{% + \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}% +} +\def\adjbox@@raisebox#1#2#3{% + \ifx\@nnil#1\@nnil + \setbox\@tempboxa\box\collectedbox + \else + \adjsetlength\@tempdima{#1}% + \sbox\@tempboxa{\raise\@tempdima\box\collectedbox}% + \fi + \ifx\@nnil#2\@nnil\else + \adjsetlength\@tempdima{#2}% + \ht\@tempboxa\@tempdima + \fi + \ifx\@nnil#3\@nnil\else + \adjsetlength\@tempdima{#3}% + \dp\@tempboxa\@tempdima + \fi + \box\@tempboxa +} \def\adjboxvtop{\ht\strutbox} \def\adjboxvcenter{1ex} \def\adjboxvbottom{-\dp\strutbox} \def\adjbox@valign@t{% - \adjbox@Gin@Add{\@irsbox{-\height+\adjboxvtop}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}% } \def\adjbox@valign@T{% - \adjbox@Gin@Add{\@irsbox{-\height}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}% } \def\adjbox@valign@M{% - \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}% } \def\adjbox@valign@m{% - \adjbox@Gin@Add{\@irsbox{.5\depth-.5\height+\adjboxvcenter}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}% +} +\def\adjbox@valign@c{% + \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}% +} +\def\adjbox@vcenter{% + \leavevmode + \hbox{% + $\vcenter{\hbox{\BOXCONTENT}}\m@th$ + }% } \def\adjbox@valign@b{% - \adjbox@Gin@Add{\@irsbox{\depth+\adjboxvbottom}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}% } \def\adjbox@valign@B{% - \adjbox@Gin@Add{\@irsbox{\depth}[]}% + \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}% } \define@key\adjbox@fam{bgcolor}{% + \adjbox@checkcolor \@ifnextchar\bgroup{% \adjbox@bgcolor }{% @@ -579,27 +627,34 @@ }#1\@nnil } \def\adjbox@bgcolor#1#2#3\@nnil{% - \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{#1}{#2}}}% + \ifx\@nnil#1\@nnil + \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color{#2}}}}% + \else + \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}% + \fi } -\def\adjbox@@bgcolor#1#2{% +\define@key\adjbox@fam{bgcolor*}{% + \adjbox@checkcolor + \adjbox@Gin@add{\@collectbox{\adjbox@@bgcolor{#1}}}% +} +\def\adjbox@@bgcolor#1{% \mbox{% \hbox{% - \ifx\@nnil#1\@nnil - \color{#2}% - \else - \color[#1]{#2}% - \fi - \vrule\@width\width\@height\height\@depth\depth + #1% + \vrule\@width\width\@height\height\@depth\depth% }% \hskip-\width \BOXCONTENT }% }% \define@key\adjbox@fam{set height}{% - \adjbox@Gin@Add{\@irsbox\z@[{#1}]}% + \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}% } \define@key\adjbox@fam{set depth}{% - \adjbox@Gin@Add{\@iirsbox\z@[\height][{#1}]}% + \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}% +} +\define@key\adjbox@fam{set vsize}{% + \adjbox@Gin@Add{\adjbox@raisebox{}#1}% } \def\adjbox@Gin@add#1{% \def\@tempa{#1}% @@ -783,15 +838,25 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \define@key{ADJBOX}{minipage}{% + \adjbox@page{minipage}{#1}% +} +\define@key{ADJBOX}{varwidth}{% + \adjbox@page{varwidth}{#1}% +} +\def\adjbox@page#1#2{% \@ifnextchar[{% - \adjbox@minipage% + \adjbox@@page{#1}% }{% - \adjbox@minipage{{#1}}\@nnil% - \remove@to@nnil - }#1\@nnil + \@ifnextchar\bgroup{% + \adjbox@@page{#1}% + }{% + \adjbox@@page{#1}{{#2}}\@nnil% + \remove@to@nnil + }% + }#2\@nnil } -\def\adjbox@minipage#1\@nnil{% - \def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{minipage}#1\adjbox@reset}{##1}{\end{minipage}}}% +\def\adjbox@@page#1#2\@nnil{% + \def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{#1}#2\adjbox@reset}{##1}{\end{#1}}}% } \def\adjbox@set{% \let\adjbox@origsetlength\setlength @@ -800,6 +865,45 @@ \def\adjbox@reset{% \let\setlength\adjbox@origsetlength } +\newcommand*\stackbox[1][c]{% + \collectboxcheckenv{stackbox}% + \@testopt{\@stackbox{#1}}{b}% +} +\def\@stackbox#1[#2]{% + \collectbox@ + {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname} + \BOXCONTENT + {\end{varwidth}}% +} +\define@key{ADJBOX}{stack}[{}{}]{% + \adjbox@stack#1{}{}\@nnil +} +\def\adjbox@stack#1#2#3\@nnil{% + \ifx\@nnil#1\@nnil + \adjbox@@stack{c}{b}% + \else + \ifx\@nnil#2\@nnil + \adjbox@@stack{#1}{b}% + \else + \adjbox@@stack{#1}{#2}% + \fi\fi +} +\def\adjbox@@stack#1#2{% + \def\adjbox@collectbox##1{\collectbox@{\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}{##1}{\end{varwidth}}}% +} +\def\adjbox@halign@c{\centering} +\def\adjbox@halign@l{\raggedright} +\def\adjbox@halign@r{\raggedleft} +\def\adjbox@halign@j{\let\\\newline} +\IfFileExists{varwidth.sty} + {\RequirePackage{varwidth}}{% + \define@key{ADJBOX}{varwidth}{% + \PackageError{adjustbox}{The 'varwidth' key requires the 'varwidth' package, which is not installed}{}% + } + \define@key{ADJBOX}{stack}{% + \PackageError{adjustbox}{The 'stack' key requires the 'varwidth' package, which is not installed}{}% + } +}% \define@key{ADJBOX}{tabular}{% \@ifnextchar[{% \adjbox@tabular{tabular}% @@ -835,7 +939,7 @@ } \define@key{ADJBOX}{innerenv}{% \@ifnextchar\bgroup{% - \adjbox@innerenv + \adjbox@@innerenv }{% \adjbox@innerenv{#1}\@nnil% \remove@to@nnil @@ -844,6 +948,15 @@ \def\adjbox@innerenv#1#2\@nnil{% \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}% }% +\def\adjbox@@innerenv#1{% + \adjbox@@@innerenv{#1}{}% +}% +\def\adjbox@@@innerenv#1#2\@nnil{% + \expandafter\adjbox@@@@innerenv\expandafter{\@gobble#2}{#1}% +}% +\def\adjbox@@@@innerenv#1#2{% + \adjbox@innerenv{#2}{#1}\@nnil +}% \define@key{ADJBOX}{innercode}{% \adjbox@innercode#1{}{}% } @@ -900,8 +1013,8 @@ \def\@bgimagebox#1#2{% \mbox{% \lower\depth\hbox{% - \edef\@tempa{\noexpand\includegraphics% - [#1,width=\the\width,totalheight=\the\totalheight]% + \edef\@tempa{\noexpand\adjustimage + {#1,width=\the\width,totalheight=\the\totalheight}% {#2}% }% \@tempa @@ -920,7 +1033,7 @@ \def\adjbox@bgimage#1#2#3\@nnil{% \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}% } -\RequirePackage{storebox} +%%\RequirePackage{storebox} \newcommand\splitbox[2]{% \collectboxcheckenv{splitbox}% \@collectbox{\@splitbox{#1}{#2}}% diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def b/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def new file mode 100644 index 00000000000..ea614a56f20 --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def @@ -0,0 +1,46 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me> +%% ------------------------------------------------------------------ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx, adjustbox.ins +%% and the derived file adjustbox.sty. +%% +\ProvidesFile{adjpdftex.def}[% + 2011/11/14 + v0.8 + adjustbox clip driver for pdftex] +\def\@cliptoboxdim#1{% + \setbox#1=\hbox{% + \Gin@defaultbp\WIDTH{\wd#1}% + \Gin@defaultbp\DEPTH{\dp#1}% + \@tempdima\ht#1% + \advance\@tempdima\dp#1% + \Gin@defaultbp\TOTALHEIGHT{\@tempdima}% + \special{pdf:content q }% + \special{% + pdf:literal direct + 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re + }% + \special{pdf:literal direct W }% + \special{pdf:literal direct n }% + \special{pdf:literal direct -1 0 0 -1 0 0 cm }% + \special{pdf:content q }% + \special{pdf:literal direct -1 0 0 -1 0 0 cm }% + \box#1% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + }% +} +\endinput +%% +%% End of file `adjxetex.def'. |