summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/adjustbox
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-16 23:09:50 +0000
committerKarl Berry <karl@freefriends.org>2012-05-16 23:09:50 +0000
commit5b130c1b3fb6521ac46fd1693c41b50073e53b3c (patch)
treec3ad3bc751b0bcb459e5c5dfa65276d24ae76351 /Master/texmf-dist/tex/latex/adjustbox
parent7a5a358a5c53a22bbfb2fd761f69849b9d5237de (diff)
adjustbox 1.0 (16may12)
git-svn-id: svn://tug.org/texlive/trunk@26452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/adjustbox')
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty106
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty144
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def30
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty1124
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/adjxetex.def46
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def (renamed from Master/texmf-dist/tex/latex/adjustbox/adjdvips.def)17
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def39
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def (renamed from Master/texmf-dist/tex/latex/adjustbox/adjpgf.def)17
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def41
-rw-r--r--Master/texmf-dist/tex/latex/adjustbox/trimclip.sty260
10 files changed, 988 insertions, 836 deletions
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
index 0fc7a627de3..98c05a8e6ed 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
+++ b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
@@ -1,15 +1,29 @@
-\begingroup
-\def\@tempa{adjcalc}
-\expandafter
-\endgroup
-\ifx\@tempa\@currname
- \ProvidesPackage{adjcalc}[2011/08/07 v1.0 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
- \RequirePackage{xkeyval}
-\fi
-\AtEndOfPackage{\adjcalc@atend}
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files adjcalc.dtx, adjustbox.ins
+%% and the derived file adjcalc.sty.
+%% It is part of the larger adjustbox bundle.
+%%
+\ProvidesPackage{adjcalc}[%
+ 2012/05/16
+ v1.1
+ Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)]
+\RequirePackage{xkeyval}
\def\adjcalc@atend{%
\begingroup
-\expandafter\ifx\csname eTeXversion\endcsname\relax
+\expandafter\ifx\csname glueexpr\endcsname\relax
\endgroup
\RequirePackage{calc}%
\adjcalc@calc
@@ -23,13 +37,42 @@
\def\adjcalc@etex{\def\adjcalc@atend{\adjcalc@etex}}
\def\adjcalc@calc{\AtEndOfPackage{\RequirePackage{calc}}\def\adjcalc@atend{\adjcalc@calc}}
\def\adjcalc@overwrite{\AtEndOfPackage{\adjcalc@overwrite}}
-\DeclareOptionX<adjbox>{pgfmath}{\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>{etex}{\adjcalc@etex}
-\DeclareOptionX<adjbox>{calc}{\adjcalc@calc}
-\DeclareOptionX<adjbox>{none}{\let\adjcalc@atend\relax\def\adjsetlength{\setlength}\let\adjcalc@overwrite\relax}
-\DeclareOptionX<adjbox>{overwrite}{\adjcalc@overwrite}
-\ProcessOptionsX*<adjbox>
-\disable@keys{adjbox}{none}
+\def\adjcalc@defaultunit{bp}%
+\DeclareOptionX<adjcalc>{pgfmath}{\adjcalc@pgfmath}
+\DeclareOptionX<adjcalc>{etex}{\adjcalc@etex}
+\DeclareOptionX<adjcalc>{calc}{\adjcalc@calc}
+\DeclareOptionX<adjcalc>{none}{%
+ \let\adjcalc@atend\relax
+ \let\adjcalc@overwrite\relax
+ \def\adjsetlength{\setlength}%
+ \def\adjaddtolength{\addtolength}%
+ \def\adjsetcounter{\setcounter}%
+ \def\adjaddtocounter{\addtocounter}%
+}
+\DeclareOptionX<adjcalc>{overwrite}{\adjcalc@overwrite}
+\DeclareOptionX<adjcalc>{defaultunit}[bp]{%
+ \begingroup
+ \def\@tempa{#1}%
+ \def\@tempb{none}%
+ \ifx\@tempa\@tempb% 'none':
+ \endgroup
+ \def\adjsetlengthdefault{\adjsetlength}%
+ \else
+ \ifx\@tempb\adjcalc@defaultunit
+ \endgroup
+ % was 'none' before
+ \let\adjsetlengthdefault\adjsetlengthdefault@
+ \else
+ \endgroup
+ \fi
+ \fi
+ \def\adjcalc@defaultunit{#1}%
+}
+\ProcessOptionsX*<adjcalc>
+\disable@keys{adjcalc}{none}
+\def\adjcalcset{%
+ \setkeys{adjcalc}%
+}
\def\adjcalc@etex{%
\protected\def\adjsetlength##1##2{%
##1=\glueexpr(##2)\relax
@@ -47,56 +90,58 @@
{\@nocounterr{##1}}%
{\global\advance\csname c@##1\endcsname\numexpr(##2)\relax}%
}%
- \def\adjbox@default##1##2{%
- \@defaultunits##1=\glueexpr##2 \adjbox@defaultunit\relax\@nnil
+ \def\adjsetlengthdefault@##1##2{%
+ \@defaultunits##1=\glueexpr##2 \adjcalc@defaultunit\relax\@nnil
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
+\newif\if@adjcalc@needsdefault
\def\adjcalc@calc{%
\DeclareRobustCommand\adjsetlength{\calc@assign@skip}%
\DeclareRobustCommand\adjaddtolength[1]{\calc@assign@skip{\advance ##1}}%
\DeclareRobustCommand\adjsetcounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\csname c@##1\endcsname}{##2}}}%
\DeclareRobustCommand\adjaddtocounter[2]{\@ifundefined{c@##1}{\@nocounterr{##1}}{\calc@assign@count{\global\advance\csname c@##1\endcsname}{##2}}}%
- \def\adjbox@default##1##2{%
+ \def\adjsetlengthdefault@##1##2{%
\begingroup
- \message{^^J\detokenize{##2}^^J}%
\def\calc@post@scan####1!{%
\def\@tempa{####1}%
\ifx\@tempa\@empty
\endgroup% to end calc processing
% is number only
- \global\@adjbox@needsdefaulttrue
+ \global\@adjcalc@needsdefaulttrue
\else
\endgroup% to end calc processing
% full expression
- \global\@adjbox@needsdefaultfalse
+ \global\@adjcalc@needsdefaultfalse
\fi
}%
- \calc@assign@skip{##1}{##2 \adjbox@defaultunit}%
+ \calc@assign@skip{##1}{##2 \adjcalc@defaultunit}%
\endgroup
- \if@adjbox@needsdefault
- ##1=##2 \adjbox@defaultunit\relax
+ \if@adjcalc@needsdefault
+ ##1=##2 \adjcalc@defaultunit\relax
\else
\calc@assign@skip{##1}{##2}%
\fi
}%
- \def\adjbox@checkdefault##1\@nnil##2##3{%
+ \def\adjcalc@checkdefault##1\@nnil##2##3{%
\ifx\relax##1\relax\else
\calc@assign@skip{##2}{##3}%
\fi
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
-\newif\if@adjbox@needsdefault
\def\adjcalc@pgfmath{%
\DeclareRobustCommand\adjsetlength{\pgfmathsetlength}%
\DeclareRobustCommand\adjaddtolength{\pgfmathaddtolength}%
\DeclareRobustCommand\adjsetcounter{\pgfmathsetcounter}%
\DeclareRobustCommand\adjaddtocounter{\pgfmathaddtocounter}%
- \def\adjbox@default##1##2{%
- \edef\pgfmathresultunitscale{1\adjbox@defaultunit}%
+ \def\adjsetlengthdefault@##1##2{%
+ \edef\pgfmathresultunitscale{1\adjcalc@defaultunit}%
\let\pgfmathpostparse\pgfmathscaleresult
\pgfmathparse{##2}%
##1=\pgfmathresult pt\relax
}%
+ \let\adjsetlengthdefault\adjsetlengthdefault@
}
\def\adjcalc@overwrite{%
\let\setlength\adjsetlength
@@ -104,6 +149,7 @@
\let\setcounter\adjsetcounter
\let\addtocounter\adjaddtocounter
}
+\adjcalc@atend
\endinput
%%
%% End of file `adjcalc.sty'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty b/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty
deleted file mode 100644
index 8b0afff8ffa..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty
+++ /dev/null
@@ -1,144 +0,0 @@
-\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox]
-\RequirePackage{graphicx}
-%%^^A \width, \height, \totalheight, \depth = size current at option execution (changes after every option) (initial: natural size)
-%%^^A \Width, \Height, \Totalheight, \Depth = requested size of image (height/totalheight and width) (initial: natural size)
-%%^^A \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH = natural size of image
-%%
-%%
-\newcommand*\Gin@adj@adddim{%
- \let\height\Gin@nat@height
- \let\width\Gin@nat@width
- \let\totalheight\height
- \let\depth\z@
- \let\adjbox@HEIGHT\HEIGHT
- \let\adjbox@WIDTH\WIDTH
- \let\adjbox@TOTALHEIGHT\TOTALHEIGHT
- \let\adjbox@DEPTH\DEPTH
- \global\let\HEIGHT\Gin@nat@height
- \global\let\WIDTH\Gin@nat@width
- \global\let\TOTALHEIGHT\HEIGHT
- \global\let\DEPTH\z@
- \let\adjbox@Height\Height
- \let\adjbox@Width\Width
- \let\adjbox@Totalheight\Totalheight
- \let\adjbox@Depth\Depth
- \global\let\Height\Gin@nat@height
- \global\let\Width\Gin@nat@width
- \global\let\Totalheight\Height
- \global\let\Depth\z@
- \edef\adjbox@restore@dims{%
- \global\adjbox@nat@height\the\adjbox@nat@height\relax
- \global\adjbox@nat@width \the\adjbox@nat@width\relax
- \global\adjbox@req@height\the\adjbox@req@height\relax
- \global\adjbox@req@width \the\adjbox@req@width\relax
- }%
-}
-\newcommand*\Gin@adj@remdim{%
- \global\let\HEIGHT\adjbox@HEIGHT
- \global\let\WIDTH\adjbox@WIDTH
- \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT
- \global\let\DEPTH\adjbox@DEPTH
- \global\let\Height\adjbox@Height
- \global\let\Width\adjbox@Width
- \global\let\Totalheight\adjbox@Totalheight
- \global\let\Depth\adjbox@Depth
- \adjbox@restore@dims
-}
-\newdimen\adjbox@nat@width
-\newdimen\adjbox@nat@height
-\newdimen\adjbox@req@width
-\newdimen\adjbox@req@height
-\newcommand*\Gin@adj@keepdim{%
- \global\adjbox@nat@height\Gin@nat@height
- \global\adjbox@nat@width \Gin@nat@width
- \global\adjbox@req@height\Gin@req@height
- \global\adjbox@req@width \Gin@req@width
- \global\let\HEIGHT\adjbox@nat@height
- \global\let\WIDTH\adjbox@nat@width
- \global\let\TOTALHEIGHT\adjbox@nat@height
- \global\let\DEPTH\z@
- \global\let\Height\adjbox@req@height
- \global\let\Width\adjbox@req@width
- \global\let\Totalheight\adjbox@req@height
- \global\let\Depth\z@
-}
-\def\Gin@ii[#1]#2{%
- \def\@tempa{[}\def\@tempb{#2}%
- \ifx\@tempa\@tempb
- \def\@tempa{\Gin@iii[#1][}%
- \expandafter\@tempa
- \else
- \begingroup
- \Gin@adj@adddim
- \@tempswafalse
- \toks@{\Ginclude@graphics{#2}}%
- \setkeys{Gin}{#1}%
- \Gin@esetsize
- \the\toks@
- \Gin@adj@remdim
- \endgroup
- \fi}
-\def\Gin@iii[#1,#2][#3,#4]#5{%
- \begingroup
- \Gin@adj@adddim
- \Gin@bboxtrue
- \Gin@defaultbp\Gin@llx{#1}%
- \Gin@defaultbp\Gin@lly{#2}%
- \Gin@defaultbp\Gin@urx{#3}%
- \Gin@defaultbp\Gin@ury{#4}%
- \Ginclude@graphics{#5}%
- \Gin@adj@remdim
- \endgroup}
-\def\Gin@setfile#1#2#3{%
- \ifx\\#2\\\Gread@false\fi
- \ifGin@bbox\else
- \ifGread@
- \csname Gread@%
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- eps%
- \else
- #1%
- \fi
- \endcsname{\Gin@base#2}%
- \else
- \Gin@nosize{#3}%
- \fi
- \fi
- \Gin@viewport@code
- \Gin@nat@height\Gin@ury bp%
- \advance\Gin@nat@height-\Gin@lly bp%
- \Gin@nat@width\Gin@urx bp%
- \advance\Gin@nat@width-\Gin@llx bp%
- \Gin@req@sizes
- \Gin@adj@keepdim
- \expandafter\ifx\csname Ginclude@#1\endcsname\relax
- \Gin@drafttrue
- \expandafter\ifx\csname Gread@#1\endcsname\relax
- \@latex@error{Can not include graphics of type: #1}\@ehc
- \global\expandafter\let\csname Gread@#1\endcsname\@empty
- \fi
- \fi
- \leavevmode
- \ifGin@draft
- \hb@xt@\Gin@req@width{%
- \vrule\hss
- \vbox to \Gin@req@height{%
- \hrule \@width \Gin@req@width
- \vss
- \edef\@tempa{#3}%
- \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
- \vss
- \hrule}%
- \hss\vrule}%
- \else
- \@addtofilelist{#3}%
- \ProvidesFile{#3}[Graphic file (type #1)]%
- \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
- \dp\z@\z@
- \ht\z@\Gin@req@height
- \wd\z@\Gin@req@width
- \box\z@
- \fi}
-\endinput
-%%
-%% End of file `adjgrfx.sty'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def b/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def
deleted file mode 100644
index d5469f69f87..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjpdftex.def
+++ /dev/null
@@ -1,30 +0,0 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
-%% version 2005/12/01 or later.
-%%
-%% This work has the LPPL maintenance status `maintained'.
-%%
-%% The Current Maintainer of this work is Martin Scharrer.
-%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
-%%
-\ProvidesFile{adjpdftex.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for pdftex]
-\def\@cliptoboxdim#1{%
- \pdfxform#1%
- \setbox#1=\hbox{%
- \pdfrefxform\pdflastxform
- }%
-}
-\endinput
-%%
-%% End of file `adjpdftex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
index 819c1cbbb99..7ce9d94a77e 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
+++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
@@ -1,7 +1,5 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -18,36 +16,39 @@
%% and the derived file adjustbox.sty.
%%
\ProvidesPackage{adjustbox}[%
- 2011/11/14
- v0.8
+ 2012/05/16
+ v0.9
Adjusting TeX boxes (trim, clip, ...)]
\RequirePackage{xkeyval}
-\def\adjbox@defaultunit{bp}
-\DeclareOptionX<adjbox>{defaultunit}{%
- \def\adjbox@defaultunit{#1}%
- \begingroup
- \def\@tempa{none}%
- \expandafter\endgroup
- \ifx\@tempa\adjbox@defaultunit
- \def\adjbox@default{\adjsetlength}%
- \fi
-}
+\RequirePackage{adjcalc}
\def\adjbox@fam{adjbox}
-\DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}}
-\DeclareOptionX<adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
-\DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}}
-\DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput}
-\def\adjbox@driver{adj\Gin@driver}
-\DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}}
-\DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath}
-\DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}}
-\let\adjbox@maybeend\relax
-\input{adjcalc.sty}
-\disable@keys{adjbox}{patch,export,PGF,minimal}
+\DeclareOptionX<Adjbox>{export}{\def\adjbox@fam{Gin}}
+\DeclareOptionX<Adjbox>{Export}{\AtEndOfPackage{\let\includegraphics\adjincludegraphics}}
+\DeclareOptionX<Adjbox>{patch}{%
+ \PackageWarning{adjustbox}{%
+ The 'patch' option is now deprecated.\MessageBreak
+ Use the new \string\adjustimage\space or \string\adjincludegraphics\space macros instead%
+ \@gobble
+ }%
+}
+\DeclareOptionX<Adjbox>{minimal}{\let\adjustbox@minimal\endinput}
+\DeclareOptionX<Adjbox>{pgfmath}{\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+\DeclareOptionX<Adjbox>{calc}{\AtEndOfPackage{\RequirePackage{calc}\adjcalcset{calc}}}
+\DeclareOptionX<Adjbox>{etex}{\AtEndOfPackage{\adjcalcset{etex}}}
+\DeclareOptionX<Adjbox>{defaultunit}{\AtEndOfPackage{\adjcalcset{defaultunit={#1}}}}
+\DeclareOptionX<Adjbox>{pgf}{\PassOptionsToPackage{pgf}{trimclip}}
+\DeclareOptionX<Adjbox>{PGF}{\PassOptionsToPackage{pgf}{trimclip}\AtEndOfPackage{\RequirePackage{pgf}\adjcalcset{pgfmath}}}
+\DeclareOptionX*{%
+ \IfFileExists{tc-\CurrentOption.def}{%
+ \PassOptionsToPackage\CurrentOption{trimclip}%
+ }{%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
+\ProcessOptionsX*<Adjbox>\relax
+\RequirePackage{trimclip}
\RequirePackage{graphicx}[1999/02/16]
-\RequirePackage{collectbox}[2011/08/22]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{collectbox}[2012/05/13]
\newcommand*\adjustboxset{%
\@ifstar
{\adjbox@addkeysafter}%
@@ -81,112 +82,15 @@
\fi
}
\let\adjbox@keysafter\@empty
-\define@key{adjbox}{viewport}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjbox@@viewport
- \adjustbox@@@trimclip
- }%
-}
-\define@key{adjbox}{trim}{%
- \def\adjustbox@content{%
- \adjbox@parse@v{#1}%
- \adjustbox@@@trimclip
- }%
-}
-\def\adjustbox@@@trimclip{%
- \ifGin@clip
- \expandafter\@clipbox
- \else
- \expandafter\@trimbox
- \fi
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\def\adjbox@parse@v#1{%
- \adjbox@parse@@v#1 {} {} {} \\%
-}
-\def\adjbox@parse@@v#1 #2 #3 #4 #5\\{%
- \adjbox@default\adjbox@tllx{#1}%
- \ifx\@nnil#2\@nnil
- \adjbox@tlly\adjbox@tllx
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@tlly{#2}%
- \ifx\@nnil#3\@nnil
- \adjbox@turx\adjbox@tllx
- \adjbox@tury\adjbox@tlly
- \else
- \adjbox@default\adjbox@turx{#3}%
- \adjbox@default\adjbox@tury{#4}%
- \fi
- \fi
-}%
-%%\newdimen\adjbox@llx
-%%\newdimen\adjbox@lly
-%%\newdimen\adjbox@urx
-%%\newdimen\adjbox@ury
-\newdimen\adjbox@tllx
-\newdimen\adjbox@tlly
-\newdimen\adjbox@turx
-\newdimen\adjbox@tury
-\def\adjbox@@viewport{%
- %\advance\adjbox@tllx by -\z@
- \advance\adjbox@tlly by \dp\collectedbox
- \advance\adjbox@turx by -\wd\collectedbox
- \advance\adjbox@tury by -\ht\collectedbox
- \adjbox@turx=-\adjbox@turx
- \adjbox@tury=-\adjbox@tury
-}
-\newcommand\trimbox{%
- \collectboxcheckenv{trimbox}%
- \@ifstar
- \trimbox@s
- \trimbox@
-}
-\def\trimbox@#1{%
- \collectbox{\trimbox@@\@trimbox{#1}}%
-}
-\def\trimbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@trimbox}{#1}}%
-}
-\def\trimbox@@#1#2{%
- \adjbox@parse@v{#2}%
- #1%
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
- \@collectboxisenv{trimbox*}%
- \trimbox@s
-}
-\newcommand\clipbox{%
- \collectboxcheckenv{clipbox}%
- \@ifstar
- \clipbox@s
- \clipbox@
-}
-\def\clipbox@#1{%
- \collectbox{\trimbox@@\@clipbox{#1}}%
-}
-\def\clipbox@s#1{%
- \collectbox{\trimbox@@{\adjbox@@viewport\@clipbox}{#1}}%
-}
-\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
- \@collectboxisenv{clipbox*}%
- \clipbox@s
-}
\newcommand\adjustbox[1]{%
+ \begingroup
+ \edef\adjbox@line{\the\inputlineno}%
+ \let\collectbox@mode\relax
+ \let\collectbox@noindent\relax
\collectboxcheckenv{adjustbox}%
+ \ifcollectboxenv\else
+ \let\adjustbox@noindent\relax
+ \fi
\begingroup
\adjbox@setkeys{#1}%
\expandafter\expandafter\expandafter
@@ -208,6 +112,7 @@
\def\adjbox@setkeys{%
\setkeys*{ADJBOX}%
}
+\let\adjustbox@noindent\noindent
\def\adjustbox@#1{%
\adjbox@Width\width
\adjbox@Height\height
@@ -221,9 +126,11 @@
\@tempswatrue
\toks@{{\adjustbox@content}}%
\def\setlength{\adjsetlength}%
- \setkeys{adjbox,Gin}{#1}%
+ \setkeys{adjbox,Gin,adjcalc}{#1}%
\adjbox@esetsize
+ \adjustbox@noindent
\the\toks@
+ \endgroup
}
\def\adjustbox@content{%
\usebox\collectedbox
@@ -252,57 +159,283 @@
\newcommand*\adjincludegraphics[2][]{%
\adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}%
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\def\@trimbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip-\@tempdima
- \adjsetlength\@tempdima{\dp#5 - (#2)}%
- \adjsetlength\@tempdimb{\wd#5 - (#3)}%
- \adjsetlength\@tempdimc{\ht#5 - (#4)}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \ifdim\dp#5<\z@
- \raise\dp#5%
- \else
- \ifdim\ht#5<\z@
- \lower\ht#5%
- \fi\fi
- \box#5%
+{\csname adjustbox@minimal\endcsname}
+\def\adjbox@Gin@add#1{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
+}
+\def\adjbox@Gin@Add{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjbox@Gin@add
+}
+\def\adjbox@Gin@sizeadd#1#2#3\relax{%
+ \ifx\@nnil#3\@nnil
+ \adjbox@Gin@add{#1{#2}{#2}}%
+ \else
+ \adjbox@Gin@add{#1{#2}{#3}}%
+ \fi
+}
+\define@key{adjbox}{viewport}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipvpbox
+ \else
+ \expandafter\@viewportbox
+ \fi
+ }{#1}%
}%
- \ifdim\dp#5<\z@ \dp#5=\z@ \fi
- \ifdim\wd#5<\z@ \wd#5=\z@ \fi
- \ifdim\ht#5<\z@ \ht#5=\z@ \fi
-}
-\def\@clipbox#1#2#3#4#5{%
- \@trimbox{#1}{#2}{#3}{#4}{#5}%
- \@cliptoboxdim{#5}%
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\InputIfFileExists{\adjbox@driver}{%
- \PackageInfo{adjustbox}{Using driver '\adjbox@driver'.}%
-}{%
- \input{adjpgf.def}%
- \PackageInfo{adjustbox}{Using fall-back PGF driver.}
}
-\adjbox@maybeend
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\phantombox[3]{%
- \begingroup
+\define@key\adjbox@fam{Viewport}{%
+ \adjbox@Gin@Add{\trimbox@s{#1}}%
+}
+\define@key{adjbox}{trim}{%
+ \def\adjustbox@content{%
+ \@trimclip{%
+ \ifGin@clip
+ \expandafter\@clipbox
+ \else
+ \expandafter\@trimbox
+ \fi
+ }{#1}%
+ }%
+}
+\define@key\adjbox@fam{Trim}{%
+ \adjbox@Gin@Add{\trimbox@{#1}}%
+}
+\define@key\adjbox@fam{Clip}{%
+ \adjbox@Gin@Add{\clipbox@{#1}}%
+}
+\define@key\adjbox@fam{Clip*}{%
+ \adjbox@Gin@Add{\clipbox@s{#1}}%
+}
+\define@key\adjbox@fam{margin}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
+}
+\define@key\adjbox@fam{margin*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
+}
+\define@key\adjbox@fam{padding}{%
+ \adjbox@Gin@Add{\marginbox@{#1}}%
+}
+\define@key\adjbox@fam{padding*}{%
+ \adjbox@Gin@Add{\marginbox@s{#1}}%
+}
+\define@key\adjbox@fam{scale}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@scale@xy
+ }{%
+ \adjbox@scale@x
+ }#1\@nnil
+}
+\def\adjbox@scale@x#1\@nnil{%
+ \adjbox@scale@xy{#1}{#1}\@nnil%
+}
+\def\adjbox@scale@xy#1#2\@nnil{%
+ \if@tempswa
+ \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
+ \else
+ \def\Gin@req@sizes{%
+ \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
+ \Gin@req@height\Gin@scaley\Gin@nat@height
+ \Gin@req@width\Gin@scalex\Gin@nat@width}%
+ \fi
+ \@tempswatrue
+}
+\define@key\adjbox@fam{reflect}[]{%
+ \adjbox@scale@xy{-1}{1}\@nnil
+}
+\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
+\def\adjbox@halign#1#2#3{%
+ \Gin@esetsize
+ \@tempswatrue
\adjsetlength\@tempdima{#1}%
- \adjsetlength\@tempdimb{#2}%
- \adjsetlength\@tempdimc{#3}%
- \setbox\collectedbox\hbox{}%
- \wd\collectedbox\@tempdima
- \ht\collectedbox\@tempdimb
- \dp\collectedbox\@tempdimc
+ \edef\@tempa{\leavevmode\hb@xt@\the\@tempdima}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
+}
+\define@key\adjbox@fam{center}[\linewidth]{%
+ \adjbox@halign{#1}\hss\hss
+}
+\define@key\adjbox@fam{left}[\linewidth]{%
+ \adjbox@halign{#1}\relax\hss
+}
+\define@key\adjbox@fam{right}[\linewidth]{%
+ \adjbox@halign{#1}\hss\relax
+}
+\define@key\adjbox@fam{outer}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\hss\relax}%
+ {\@tempa\relax\hss}%
+ \else
+ \@tempa\hss\hss
+ \fi
+}
+\define@key\adjbox@fam{inner}[\linewidth]{%
+ \def\@tempa{\adjbox@halign{#1}}%
+ \if@twoside
+ \adjbox@ifoddpage
+ {\@tempa\relax\hss}%
+ {\@tempa\hss\relax}%
+ \else
+ \@tempa\hss\hss
+ \fi
+}
+\def\adjbox@ifoddpage{%
+ \begingroup
+ \adjbox@checkoddpage
+ \expandafter\endgroup
+ \ifoddpage
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\adjbox@checkoddpage{%
+ \ifodd\c@page
+ \oddpagetrue
+ \else
+ \oddpagefalse
+ \fi
+}%
+\newif\ifoddpage
+\AtBeginDocument{%
+ \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
+ {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
+}%
+\define@key\adjbox@fam{raise}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@raise
+ }{%
+ \adjbox@raise{#1}{}{}%
+ }#1{}{}{}\@nnil
+}
+\def\adjbox@raise#1#2#3#4\@nnil{%
+ \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
+}
+\define@key\adjbox@fam{valign}{%
+ \csname adjbox@valign@#1\endcsname
+}
+\def\adjbox@raisebox#1#2#3{%
+ \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
+}
+\def\adjbox@@raisebox#1#2#3{%
+ \ifx\@nnil#1\@nnil
+ \setbox\@tempboxa\copy\collectedbox
+ \else
+ \adjsetlength\@tempdima{#1}%
+ \setbox\@tempboxa\hbox{\raise\@tempdima\copy\collectedbox}%
+ \fi
+ \ifx\@nnil#2\@nnil\else
+ \adjsetlength\@tempdima{#2}%
+ \ht\@tempboxa\@tempdima
+ \fi
+ \ifx\@nnil#3\@nnil\else
+ \adjsetlength\@tempdima{#3}%
+ \dp\@tempboxa\@tempdima
+ \fi
+ \box\@tempboxa
+}
+\def\adjboxvtop{\ht\strutbox}
+\def\adjboxvcenter{1ex}
+\def\adjboxvbottom{-\dp\strutbox}
+\def\adjbox@valign@t{%
+ \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}%
+}
+\def\adjbox@valign@T{%
+ \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}%
+}
+\def\adjbox@valign@M{%
+ \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}%
+}
+\def\adjbox@valign@m{%
+ \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}%
+}
+\def\adjbox@valign@c{%
+ \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}%
+}
+\def\adjbox@vcenter{%
\leavevmode
- \box\collectedbox
- \endgroup
+ \hbox{%
+ $\vcenter{\hbox{\BOXCONTENT}}\m@th$
+ }%
+}
+\def\adjbox@valign@b{%
+ \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}%
+}
+\def\adjbox@valign@B{%
+ \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}%
+}
+\define@key\adjbox@fam{set height}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
+}
+\define@key\adjbox@fam{set depth}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
+}
+\define@key\adjbox@fam{set vsize}{%
+ \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
+}
+\define@key\adjbox@fam{vspace}{%
+ \adjbox@vskip#1 {} \@nnil{}%
+}
+\define@key\adjbox@fam{vspace*}{%
+ \adjbox@vskip#1 {} \@nnil*%
+}
+\def\adjbox@vskip#1 #2 #3\@nnil#4{%
+ \ifx\@nnil#2\@nnil
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#1}}%
+ \else
+ \adjust@addcode{\par\vspace#4{#1}\noindent}{\par\vspace#4{#2}}%
+ \fi
+}
+\define@key\adjbox@fam{min width}{%
+ \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
+}
+\define@key\adjbox@fam{max width}{%
+ \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
+}
+\define@key\adjbox@fam{min height}{%
+ \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
+}
+\define@key\adjbox@fam{max height}{%
+ \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
+}
+\define@key\adjbox@fam{min totalheight}{%
+ \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
+}
+\define@key\adjbox@fam{max totalheight}{%
+ \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
+}
+\define@key\adjbox@fam{min size}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
+}
+\define@key\adjbox@fam{max size}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
+}
+\define@key\adjbox@fam{min totalsize}{%
+ \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+}
+\define@key\adjbox@fam{max totalsize}{%
+ \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+}
+\define@key\adjbox@fam{warn width}[\linewidth]{%
+ \adjust@addcode{\@collectbox{%
+ \@tempdima=#1\relax
+ \ifdim\width>\@tempdima
+ \advance\@tempdima by -\width
+ \@tempdima=-\@tempdima
+ \typeout{Overfull \string\hbox\space (\the\@tempdima\space too wide) in adjustbox at
+ \ifnum\adjbox@line=\inputlineno
+ line \adjbox@line
+ \else
+ lines \adjbox@line--\the\inputlineno
+ \fi
+ }%
+ \fi
+ \BOXCONTENT
+ }}{}%
}
\newcommand*\minsizebox{%
\collectboxcheckenv{minsizebox}%
@@ -379,20 +512,6 @@
\Gscale@box\@tempa[\@tempb]\BOXCONTENT
\fi
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\define@key\adjbox@fam{Trim}{%
- \adjbox@Gin@Add{\trimbox@{#1}}%
-}
-\define@key\adjbox@fam{Viewport}{%
- \adjbox@Gin@Add{\trimbox@s{#1}}%
-}
-\define@key\adjbox@fam{Clip}{%
- \adjbox@Gin@Add{\clipbox@{#1}}%
-}
-\define@key\adjbox@fam{Clip*}{%
- \adjbox@Gin@Add{\clipbox@s{#1}}%
-}
\define@key\adjbox@fam{frame}[{{\fboxrule}}]{%
\adjbox@frame{\fboxsep\z@}#1 {} {} \relax\relax\@nnil
}
@@ -427,7 +546,9 @@
\relax
\global\let\adjbox@checkcolor\relax
\else
- \PackageError{adjustbox}{Using a macro, envrionment or key with color\MessageBreak requires a color package to be loaded manually.\MessageBreak Recommended is 'xcolor' but 'color' is ok, too}{}.
+ \PackageError{adjustbox}{Using a macro, environment or key with color\MessageBreak
+ requires a color package to be loaded manually.\MessageBreak
+ Recommended is 'xcolor' but 'color' is ok, too}{}.
\fi
}
\def\adjbox@@frame#1#2#3#4{%
@@ -437,13 +558,8 @@
\ifx\@nnil#3\@nnil\else
\adjsetlength\fboxsep{#3}%
\fi
- \adjsetlength\adjbox@tllx{\fboxrule + \fboxsep}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
+ \adjsetlength\tc@llx{\fboxrule + \fboxsep}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
\ifx\@nnil#4\@nnil\else
\setbox\collectedbox
\fi
@@ -454,13 +570,8 @@
\adjbox@boxframe\width\height\depth
\color@endgroup\egroup
\ifx\@nnil#4\@nnil\else
- \adjsetlength\adjbox@tllx{#4}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \adjbox@tllx
- \collectedbox
+ \adjsetlength\tc@llx{#4}%
+ \@marginbox\collectedbox\tc@llx\tc@llx\tc@llx\tc@llx
\BOXCONTENT
\fi
}
@@ -489,57 +600,6 @@
}%
}%
}
-\define@key\adjbox@fam{scale}{%
- \@ifnextchar\bgroup{%
- \adjbox@scale@xy
- }{%
- \adjbox@scale@x
- }#1\@nnil
-}
-\def\adjbox@scale@x#1\@nnil{%
- \adjbox@scale@xy{#1}{#1}\@nnil%
-}
-\def\adjbox@scale@xy#1#2\@nnil{%
- \if@tempswa
- \adjbox@Gin@add{\Gscale@box{#1}[{#2}]}%
- \else
- \def\Gin@req@sizes{%
- \def\Gin@scalex{#1}\def\Gin@scaley{#2}%
- \Gin@req@height\Gin@scaley\Gin@nat@height
- \Gin@req@width\Gin@scalex\Gin@nat@width}%
- \fi
- \@tempswatrue
-}
-\define@key\adjbox@fam{reflect}[]{%
- \adjbox@scale@xy{-1}{1}\@nnil
-}
-\expandafter\let\csname KV@\adjbox@fam @rotate\endcsname\KV@Gin@angle
-\define@key\adjbox@fam{lap}{%
- \@ifnextchar\bgroup{%
- \adjbox@lapbox
- }{%
- \adjbox@lapbox{#1}{}%
- }#1{}{}\@nnil
-}
-\def\adjbox@lapbox#1#2#3\@nnil{%
- \ifx\@nnil#2\@nnil
- \adjbox@Gin@Add{\lapbox{#1}}%
- \else
- \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
- \fi
-}
-\define@key\adjbox@fam{rlap}[]{%
- \adjbox@Gin@Add{\lapbox{\width}}%
-}
-\define@key\adjbox@fam{llap}[]{%
- \adjbox@Gin@Add{\lapbox{-\width}}%
-}
-\define@key\adjbox@fam{margin}{%
- \adjbox@Gin@Add{\marginbox@{#1}}%
-}
-\define@key\adjbox@fam{margin*}{%
- \adjbox@Gin@Add{\marginbox@s{#1}}%
-}
\define@key\adjbox@fam{dpi}{%
\adjsetlength\pdfpxdimen{1in/(#1)}%
}
@@ -555,69 +615,48 @@
\define@key{ADJBOX}{Execute}{%
#1%
}
-\define@key\adjbox@fam{raise}{%
- \@ifnextchar\bgroup{%
- \adjbox@raise
- }{%
- \adjbox@raise{#1}{}{}%
- }#1{}{}{}\@nnil
-}
-\def\adjbox@raise#1#2#3#4\@nnil{%
- \adjbox@Gin@Add{\adjbox@raisebox{#1}{#2}{#3}}%
-}
-\define@key\adjbox@fam{valign}{%
- \csname adjbox@valign@#1\endcsname
+\define@key{adjbox}{Addcode}{%
+ \adjust@@addcode#1{}\@nnil%
}
-\def\adjbox@raisebox#1#2#3{%
- \collectbox{\adjbox@@raisebox{#1}{#2}{#3}}%
+\define@key{adjbox}{addcode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@@addcode#1{}\@nnil%
}
-\def\adjbox@@raisebox#1#2#3{%
- \ifx\@nnil#1\@nnil
- \setbox\@tempboxa\box\collectedbox
+\long\def\adjust@@addcode#1#2#3\@nnil{%
+ \ifx\@nnil#3\@nnil
+ \adjust@addcode{#1}{#2}%
\else
- \adjsetlength\@tempdima{#1}%
- \sbox\@tempboxa{\raise\@tempdima\box\collectedbox}%
- \fi
- \ifx\@nnil#2\@nnil\else
- \adjsetlength\@tempdima{#2}%
- \ht\@tempboxa\@tempdima
- \fi
- \ifx\@nnil#3\@nnil\else
- \adjsetlength\@tempdima{#3}%
- \dp\@tempboxa\@tempdima
+ \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
\fi
- \box\@tempboxa
-}
-\def\adjboxvtop{\ht\strutbox}
-\def\adjboxvcenter{1ex}
-\def\adjboxvbottom{-\dp\strutbox}
-\def\adjbox@valign@t{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height+\adjboxvtop}{}{}}%
}
-\def\adjbox@valign@T{%
- \adjbox@Gin@Add{\adjbox@raisebox{-\height}{}{}}%
-}
-\def\adjbox@valign@M{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height}{}{}}%
-}
-\def\adjbox@valign@m{%
- \adjbox@Gin@Add{\adjbox@raisebox{.5\depth-.5\height+\adjboxvcenter}{}{}}%
-}
-\def\adjbox@valign@c{%
- \adjbox@Gin@Add{\@collectbox\adjbox@vcenter}%
+\define@key{adjbox}{precode}{%
+ \Gin@esetsize
+ \@tempswatrue
+ \adjust@addcode{#1}{}%
}
-\def\adjbox@vcenter{%
- \leavevmode
- \hbox{%
- $\vcenter{\hbox{\BOXCONTENT}}\m@th$
- }%
+\define@key{adjbox}{Precode}{%
+ \adjust@addcode{#1}{}%
}
-\def\adjbox@valign@b{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth+\adjboxvbottom}{}{}}%
+\define@key{adjbox}{appcode}{%
+ \toks@\expandafter{\the\toks@#1}%
}
-\def\adjbox@valign@B{%
- \adjbox@Gin@Add{\adjbox@raisebox{\depth}{}{}}%
+\long\def\adjust@addcode#1#2{%
+ \def\@tempa{#1}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
+}%
+\define@key\adjbox@fam{env}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@addenv
+ }{%
+ \adjbox@addenv{#1}\@nnil%
+ \remove@to@nnil
+ }#1\@nnil
}
+\def\adjbox@addenv#1#2\@nnil{%
+ \def\@tempa{\begin{#1}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
+}%
\define@key\adjbox@fam{bgcolor}{%
\adjbox@checkcolor
\@ifnextchar\bgroup{%
@@ -647,121 +686,53 @@
\BOXCONTENT
}%
}%
-\define@key\adjbox@fam{set height}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{#1}{}}%
-}
-\define@key\adjbox@fam{set depth}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}{}{#1}}%
-}
-\define@key\adjbox@fam{set vsize}{%
- \adjbox@Gin@Add{\adjbox@raisebox{}#1}%
-}
-\def\adjbox@Gin@add#1{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}%
-}
-\def\adjbox@Gin@Add{%
- \Gin@esetsize
- \@tempswatrue
- \adjbox@Gin@add
-}
-\def\adjbox@Gin@sizeadd#1#2#3\relax{%
- \ifx\@nnil#3\@nnil
- \adjbox@Gin@add{#1{#2}{#2}}%
- \else
- \adjbox@Gin@add{#1{#2}{#3}}%
- \fi
-}
-\def\adjbox@halign#1#2#3{%
- \Gin@esetsize
- \@tempswatrue
- \adjsetlength\@tempdima{#1}%
- \edef\@tempa{\hb@xt@\the\@tempdima}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\expandafter#2\the\toks@#3}}%
-}
-\define@key\adjbox@fam{center}[\linewidth]{%
- \adjbox@halign{#1}\hss\hss
-}
-\define@key\adjbox@fam{left}[\linewidth]{%
- \adjbox@halign{#1}\relax\hss
+\newcommand*\bgimagebox[2][]{%
+ \collectboxcheckenv{bgimagebox}%
+ \@collectbox{\@bgimagebox{#1}{#2}}%
}
-\define@key\adjbox@fam{right}[\linewidth]{%
- \adjbox@halign{#1}\hss\relax
+\def\@bgimagebox#1#2{%
+ \mbox{%
+ \lower\depth\hbox{%
+ \edef\@tempa{\noexpand\adjustimage
+ {#1,width=\the\width,totalheight=\the\totalheight}%
+ {#2}%
+ }%
+ \@tempa
+ }%
+ \hskip-\width%
+ \BOXCONTENT
+ }%
}
-\define@key\adjbox@fam{outer}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\hss\relax}%
- {\@tempa\relax\hss}%
- \else
- \@tempa\hss\hss
- \fi
+\define@key{adjbox}{bgimage}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@bgimage
+ }{%
+ \adjbox@bgimage{}{#1}%
+ }#1\@nnil
}
-\define@key\adjbox@fam{inner}[\linewidth]{%
- \def\@tempa{\adjbox@halign{#1}}%
- \if@twoside
- \adjbox@ifoddpage
- {\@tempa\relax\hss}%
- {\@tempa\hss\relax}%
- \else
- \@tempa\hss\hss
- \fi
+\def\adjbox@bgimage#1#2#3\@nnil{%
+ \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
}
-\def\adjbox@ifoddpage{%
- \begingroup
- \adjbox@checkoddpage
- \expandafter\endgroup
- \ifoddpage
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi
+\define@key\adjbox@fam{lap}{%
+ \@ifnextchar\bgroup{%
+ \adjbox@lapbox
+ }{%
+ \adjbox@lapbox{#1}{}%
+ }#1{}{}\@nnil
}
-\def\adjbox@checkoddpage{%
- \ifodd\c@page
- \oddpagetrue
+\def\adjbox@lapbox#1#2#3\@nnil{%
+ \ifx\@nnil#2\@nnil
+ \adjbox@Gin@Add{\lapbox{#1}}%
\else
- \oddpagefalse
+ \adjbox@Gin@Add{\lapbox[{#1}]{#2}}%
\fi
-}%
-\newif\ifoddpage
-\AtBeginDocument{%
- \@ifpackageloaded{changepage}{\let\adjbox@checkoddpage\checkoddpage}%
- {\@ifpackageloaded{chngpage}{\let\adjbox@checkoddpage\checkoddpage}{}}%
-}%
-\define@key\adjbox@fam{min width}{%
- \adjbox@Gin@Add{\@minsizebox\height{#1}!}%
-}
-\define@key\adjbox@fam{max width}{%
- \adjbox@Gin@Add{\@maxsizebox\height{#1}!}%
-}
-\define@key\adjbox@fam{min height}{%
- \adjbox@Gin@Add{\@minsizebox\height!{#1}}%
-}
-\define@key\adjbox@fam{max height}{%
- \adjbox@Gin@Add{\@maxsizebox\height!{#1}}%
-}
-\define@key\adjbox@fam{min totalheight}{%
- \adjbox@Gin@Add{\@minsizebox\totalheight!{#1}}%
-}
-\define@key\adjbox@fam{max totalheight}{%
- \adjbox@Gin@Add{\@maxsizebox\totalheight!{#1}}%
-}
-\define@key\adjbox@fam{min size}{%
- \adjbox@Gin@sizeadd{\@minsizebox\height}#1\relax
-}
-\define@key\adjbox@fam{max size}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\height}#1\relax
}
-\define@key\adjbox@fam{min totalsize}{%
- \adjbox@Gin@sizeadd{\@minsizebox\totalheight}#1\relax
+\define@key\adjbox@fam{rlap}[]{%
+ \adjbox@Gin@Add{\lapbox{\width}}%
}
-\define@key\adjbox@fam{max totalsize}{%
- \adjbox@Gin@sizeadd{\@maxsizebox\totalheight}#1\relax
+\define@key\adjbox@fam{llap}[]{%
+ \adjbox@Gin@Add{\lapbox{-\width}}%
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\lapbox[2][\width-\@tempdimb]{%
\collectboxcheckenv{lapbox}%
\@collectbox{\@lapbox{#1}{#2}}%
@@ -784,59 +755,6 @@
\hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\usebox\collectedbox}\hss}%
\fi
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\marginbox{%
- \collectboxcheckenv{marginbox}%
- \@ifstar
- \marginbox@s
- \marginbox@
-}
-\def\marginbox@#1{%
- \@collectbox{\marginbox@@{#1}}%
-}
-\def\marginbox@s#1{%
- \@collectbox{\marginbox@@s{#1}}%
-}
-\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
- \@collectboxisenv{marginbox*}%
- \marginbox@s
-}
-\def\marginbox@@#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \usebox\collectedbox
-}
-\def\marginbox@@s#1{%
- \adjbox@parse@v{#1}%
- \@marginbox
- \adjbox@tllx
- \adjbox@tlly
- \adjbox@turx
- \adjbox@tury
- \collectedbox
- \raise\adjbox@tlly\copy\collectedbox
-}
-\def\@marginbox#1#2#3#4#5{%
- \setbox#5=\hbox{%
- \adjsetlength\@tempdima{#1}%
- \hskip\@tempdima
- \adjsetlength\@tempdima{\dp#5 + #2}%
- \adjsetlength\@tempdimb{\wd#5 + #3}%
- \adjsetlength\@tempdimc{\ht#5 + #4}%
- \dp#5=\@tempdima
- \wd#5=\@tempdimb
- \ht#5=\@tempdimc
- \box#5%
- }%
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define@key{ADJBOX}{minipage}{%
\adjbox@page{minipage}{#1}%
}
@@ -866,35 +784,45 @@
\let\setlength\adjbox@origsetlength
}
\newcommand*\stackbox[1][c]{%
- \collectboxcheckenv{stackbox}%
- \@testopt{\@stackbox{#1}}{b}%
+ \collectboxcheckenv{stackbox}%
+ \@ifnextchar[%]
+ {\@stackbox{#1}}%
+ {\@@stackbox{#1}{b}[]}%
}
\def\@stackbox#1[#2]{%
+ \@testopt{\@@stackbox{#1}{#2}}{}%
+}
+\def\@@stackbox#1#2[#3]{%
\collectbox@
- {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}
+ {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3}
\BOXCONTENT
{\end{varwidth}}%
}
-\define@key{ADJBOX}{stack}[{}{}]{%
- \adjbox@stack#1{}{}\@nnil
+\def\adjbox@halign@c{\centering}
+\def\adjbox@halign@l{\raggedright}
+\def\adjbox@halign@r{\raggedleft}
+\def\adjbox@halign@j{\let\\\newline}
+\define@key{ADJBOX}{stack}[{}{}{}]{%
+ \adjbox@stack#1{}{}{}\@nnil
}
-\def\adjbox@stack#1#2#3\@nnil{%
+\def\adjbox@stack#1#2#3#4\@nnil{%
\ifx\@nnil#1\@nnil
- \adjbox@@stack{c}{b}%
+ \adjbox@@stack{c}{b}{}%
\else
\ifx\@nnil#2\@nnil
- \adjbox@@stack{#1}{b}%
+ \adjbox@@stack{#1}{b}{}%
\else
- \adjbox@@stack{#1}{#2}%
+ \adjbox@@stack{#1}{#2}{#3}%
\fi\fi
}
-\def\adjbox@@stack#1#2{%
- \def\adjbox@collectbox##1{\collectbox@{\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname}{##1}{\end{varwidth}}}%
+\def\adjbox@@stack#1#2#3{%
+ \def\adjbox@collectbox##1{%
+ \collectbox@{%
+ \begin{varwidth}[#2]{\linewidth}%
+ \csname adjbox@halign@#1\endcsname#3%
+ }{##1}{\end{varwidth}}%
+ }%
}
-\def\adjbox@halign@c{\centering}
-\def\adjbox@halign@l{\raggedright}
-\def\adjbox@halign@r{\raggedleft}
-\def\adjbox@halign@j{\let\\\newline}
\IfFileExists{varwidth.sty}
{\RequirePackage{varwidth}}{%
\define@key{ADJBOX}{varwidth}{%
@@ -963,75 +891,135 @@
\def\adjbox@innercode#1#2{%
\def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}%
}%
-\define@key{ADJBOX}{env}{%
+\define@key\adjbox@fam{label}{%
+ \def\adjbox@label{\label{#1}}%
+}
+\let\adjbox@label\@empty
+\define@key\adjbox@fam{caption}{%
+ \@ifnextchar{[}{%
+ \adjbox@def@caption
+ }{%
+ \adjbox@def@@caption
+ }#1\@nnil
+}
+\def\adjbox@def@@caption#1\@nnil{%
+ \def\adjbox@caption{\caption{#1}}%
+}
+\def\adjbox@def@caption[#1]#2\@nnil{%
+ \def\adjbox@caption{\caption[#1]{#2}}%
+}
+\let\adjbox@caption\@empty
+\define@key\adjbox@fam{figure}[]{%
+ \Gin@esetsize
+ \@tempswafalse
+ \let\adjustbox@noindent\relax
+ \ifx\@nnil#1\@nnil
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{}%
+ \else
+ \expandafter\expandafter\expandafter\adjbox@figure
+ \expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}{[#1]}%
+ \fi
+}
+\def\adjbox@figure#1#2{%
+ \def\@tempa{\begin{figure}#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@#1\end{figure}}%
+}
+\define@key\adjbox@fam{float}{%
+ \let\adjustbox@noindent\relax
\@ifnextchar\bgroup{%
- \adjbox@addenv
+ \adjbox@float
}{%
- \adjbox@addenv{#1}\@nnil%
+ \adjbox@float{#1}\@nnil
\remove@to@nnil
}#1\@nnil
}
-\def\adjbox@addenv#1#2\@nnil{%
- \def\@tempa{\begin{#1}#2}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}%
-}%
-\define@key{adjbox}{Addcode}{%
- \adjust@@addcode#1{}\@nnil%
+\def\adjbox@float{%
+ \expandafter\expandafter
+ \expandafter\adjbox@@float\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label}%
}
-\define@key{adjbox}{addcode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@@addcode#1{}\@nnil%
+\def\adjbox@@float#1#2#3\@nnil{%
+ \adjust@addcode{\begin{#2}#3}{#1\end{#2}}%
}
-\def\adjust@@addcode#1#2#3\@nnil{%
- \ifx\@nnil#3\@nnil
- \adjust@addcode{#1}{#2}%
+\define@key\adjbox@fam{nofloat}[figure]{%
+ \def\@tempa{\adjust@addcode{\adjnofloat{#1}}}%
+ \expandafter\expandafter\expandafter
+ \@tempa\expandafter\expandafter\expandafter{\expandafter\adjbox@caption\adjbox@label\endadjnofloat}%
+}
+\newenvironment{adjnofloat}[1]{%
+ \trivlist
+ \def\@captype{#1}%
+ \item\relax
+ \leavevmode
+}{%
+ \endtrivlist
+}
+\define@key\adjbox@fam{phantom}[]{%
+ \expandafter\ifx\csname #1phantom\endcsname\relax
+ \adjust@addcode{\phantom}{}%
\else
- \PackageError{adjustbox}{Incorrect input for key 'addcode={<code before>}{<code afterwards>}'!}%
+ \expandafter\adjust@addcode\expandafter{\csname #1phantom\endcsname}{}%
\fi
}
-\define@key{adjbox}{precode}{%
- \Gin@esetsize
- \@tempswatrue
- \adjust@addcode{#1}{}%
+\newcommand*\phantombox[3]{%
+ \begingroup
+ \adjsetlength\@tempdima{#1}%
+ \adjsetlength\@tempdimb{#2}%
+ \adjsetlength\@tempdimc{#3}%
+ \setbox\collectedbox\hbox{}%
+ \wd\collectedbox\@tempdima
+ \ht\collectedbox\@tempdimb
+ \dp\collectedbox\@tempdimc
+ \leavevmode
+ \box\collectedbox
+ \endgroup
}
-\define@key{adjbox}{Precode}{%
- \adjust@addcode{#1}{}%
+\define@key\adjbox@fam{gobble}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
}
-\define@key{adjbox}{appcode}{%
- \toks@\expandafter{\the\toks@#1}%
+\define@key\adjbox@fam{discard}[]{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\@collectbox{}}%
}
-\def\adjust@addcode#1#2{%
- \def\@tempa{#1}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}#2}%
-}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\bgimagebox[2][]{%
- \collectboxcheckenv{bgimagebox}%
- \@collectbox{\@bgimagebox{#1}{#2}}%
+\define@key\adjbox@fam{content}{%
+ \adjbox@Gin@Add{\@collectbox{#1}}%
}
-\def\@bgimagebox#1#2{%
- \mbox{%
- \lower\depth\hbox{%
- \edef\@tempa{\noexpand\adjustimage
- {#1,width=\the\width,totalheight=\the\totalheight}%
- {#2}%
- }%
- \@tempa
- }%
- \hskip-\width%
- \BOXCONTENT
- }%
+\define@key\adjbox@fam{gstore}{%
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{\BOXCONTENT}}%
}
-\define@key{adjbox}{bgimage}{%
- \@ifnextchar\bgroup{%
- \adjbox@bgimage
- }{%
- \adjbox@bgimage{}{#1}%
- }#1\@nnil
+\define@key\adjbox@fam{gstore*}{%
+ \let\adjustbox@noindent\relax
+ \adjbox@Gin@Add{\global\@collectboxto{#1}{}}%
}
-\def\adjbox@bgimage#1#2#3\@nnil{%
- \adjbox@Gin@add{\@collectbox{\@bgimagebox{#1}{#2}}}%
+\define@key{adjbox}{gstore width}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\width\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore depth}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\depth\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore height}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\height\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore totalheight}{%
+ \adjbox@Gin@Add{\@collectbox{\global#1=\totalheight\BOXCONTENT}}%
+}
+\define@key{adjbox}{gstore sizes}{%
+ \adjbox@Gin@Add{\@collectbox{\adjbox@gstore@sizes#1\relax\relax\relax\relax\@nnil\BOXCONTENT}}%
+}
+\def\adjbox@gstore@sizes#1#2#3#4#5\@nnil{%
+ \ifx\relax#1\relax\else
+ \global#1=\width
+ \fi
+ \ifx\relax#2\relax\else
+ \global#2=\height
+ \fi
+ \ifx\relax#3\relax\else
+ \global#3=\depth
+ \fi
+ \ifx\relax#4\relax\else
+ \global#4=\totalheight
+ \fi
}
%%\RequirePackage{storebox}
\newcommand\splitbox[2]{%
@@ -1064,28 +1052,28 @@
\ifdim\Gin@nat@height>\totalheight
\Gin@nat@height\totalheight
\fi
- \adjbox@tllx\z@
- \adjbox@tlly\totalheight
- \adjbox@turx\width
- \adjbox@tury\z@
- \advance\adjbox@tlly-\Gin@nat@height
+ \tc@llx\z@
+ \tc@lly\totalheight
+ \tc@urx\width
+ \tc@ury\z@
+ \advance\tc@lly-\Gin@nat@height
\@@splitbox
}
\def\@@splitbox{%
- \advance\adjbox@turx-\@tempdima
+ \advance\tc@urx-\@tempdima
\@@@splitbox
- \ifdim\adjbox@turx>\z@
- \advance\adjbox@tllx+\@tempdima
+ \ifdim\tc@urx>\z@
+ \advance\tc@llx+\@tempdima
\expandafter\@@splitbox
\else
- \ifdim\adjbox@tlly<\splitbox@epsilon
+ \ifdim\tc@lly<\splitbox@epsilon
\splitboxlastnewline
\else
\splitboxnewline
- \adjbox@tllx\z@
- \adjbox@turx\width
- \advance\adjbox@tlly-\Gin@nat@height
- \advance\adjbox@tury+\Gin@nat@height
+ \tc@llx\z@
+ \tc@urx\width
+ \advance\tc@lly-\Gin@nat@height
+ \advance\tc@ury+\Gin@nat@height
\expandafter\expandafter
\expandafter\@@splitbox
\fi
@@ -1094,14 +1082,14 @@
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
\def\@@@splitbox{%
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\tc@llx\tc@lly\tc@urx\tc@ury
\splitboxcmd{\usebox\collectedbox}%
\endgroup
}
@@ -1123,32 +1111,32 @@
\storebox\splittedbox{\BOXCONTENT}%
\setbox\collectedbox\hbox{\usestorebox\splittedbox}%
\fi
- \adjsetlength\adjbox@tlly
+ \adjsetlength\tc@lly
{\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}%
- \ifdim\adjbox@tlly>\z@
+ \ifdim\tc@lly>\z@
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\z@\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\z@
\BOXCONTENT
\endgroup
\par\noindent
- \adjsetlength\adjbox@tury{\totalheight-\adjbox@tlly}%
- \ifdim\adjbox@tlly>\textheight
+ \adjsetlength\tc@ury{\totalheight-\tc@lly}%
+ \ifdim\tc@lly>\textheight
\loop
- \advance\adjbox@tlly-\textheight
+ \advance\tc@lly-\textheight
\begingroup
\setbox\collectedbox=\copy\collectedbox
- \@clipbox\z@\adjbox@tlly\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\tc@lly\z@\tc@ury
\BOXCONTENT
\endgroup
- \advance\adjbox@tury\textheight
+ \advance\tc@ury\textheight
\par\noindent
- \ifdim\adjbox@tlly>\textheight
+ \ifdim\tc@lly>\textheight
\repeat
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\BOXCONTENT
\else
- \@clipbox\z@\z@\z@\adjbox@tury\collectedbox
+ \@clipbox\collectedbox\z@\z@\z@\tc@ury
\par\noindent
\BOXCONTENT
\fi
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def b/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def
deleted file mode 100644
index ea614a56f20..00000000000
--- a/Master/texmf-dist/tex/latex/adjustbox/adjxetex.def
+++ /dev/null
@@ -1,46 +0,0 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
-%% version 2005/12/01 or later.
-%%
-%% This work has the LPPL maintenance status `maintained'.
-%%
-%% The Current Maintainer of this work is Martin Scharrer.
-%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
-%%
-\ProvidesFile{adjpdftex.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for pdftex]
-\def\@cliptoboxdim#1{%
- \setbox#1=\hbox{%
- \Gin@defaultbp\WIDTH{\wd#1}%
- \Gin@defaultbp\DEPTH{\dp#1}%
- \@tempdima\ht#1%
- \advance\@tempdima\dp#1%
- \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
- \special{pdf:content q }%
- \special{%
- pdf:literal direct
- 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
- }%
- \special{pdf:literal direct W }%
- \special{pdf:literal direct n }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \special{pdf:content q }%
- \special{pdf:literal direct -1 0 0 -1 0 0 cm }%
- \box#1%
- \special{pdf:literal direct Q }%
- \special{pdf:literal direct Q }%
- }%
-}
-\endinput
-%%
-%% End of file `adjxetex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
index 006ef5fe50a..b643bf5bd1b 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjdvips.def
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
@@ -1,5 +1,5 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -12,13 +12,12 @@
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
%%
-\ProvidesFile{adjdvips.def}[%
- 2011/11/14
- v0.8
- adjustbox clip driver for dvips]
+\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips]
\def\@cliptoboxdim#1{%
\setbox#1=\hbox{%
\adjsetlength\@tempdima{\ht#1+\dp#1}%
@@ -43,4 +42,4 @@
}
\endinput
%%
-%% End of file `adjdvips.def'.
+%% End of file `tc-dvips.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def b/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
new file mode 100644
index 00000000000..e18f0909122
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
@@ -0,0 +1,39 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesFile{tc-pdftex.def}[2012/05/13 v1.0 Clipping driver for pdftex]
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \pdfsave
+ \pdfliteral direct {%
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
+ }%
+ \hbox to 0pt{\copy#1\hss}%
+ \pdfrestore
+ \hskip \wd#1
+ }%
+}
+\endinput
+%%
+%% End of file `tc-pdftex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
index 122cc0071c7..0b32c59cffd 100644
--- a/Master/texmf-dist/tex/latex/adjustbox/adjpgf.def
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
@@ -1,5 +1,5 @@
-%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
-%% ------------------------------------------------------------------
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -12,13 +12,12 @@
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
-%% This work consists of the files adjustbox.dtx, adjustbox.ins
-%% and the derived file adjustbox.sty.
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
%%
-\ProvidesFile{adjpgf.def}[%
- 2011/11/14
- v0.8
- adjustbox fall-back clip driver using PGF]
+\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF]
\RequirePackage{pgf}
\def\@cliptoboxdim#1{%
\setbox#1\hbox{\begin{pgfpicture}%
@@ -35,4 +34,4 @@
}
\endinput
%%
-%% End of file `adjpgf.def'.
+%% End of file `tc-pgf.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def b/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
new file mode 100644
index 00000000000..2aa3dc0c21e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
@@ -0,0 +1,41 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesFile{tc-xetex.def}[2012/05/13 v1.0 Clipping driver for xetex]
+\def\@cliptoboxdim#1{%
+ \setbox#1=\hbox{%
+ \Gin@defaultbp\WIDTH{\wd#1}%
+ \Gin@defaultbp\DEPTH{\dp#1}%
+ \@tempdima\ht#1%
+ \advance\@tempdima\dp#1%
+ \Gin@defaultbp\TOTALHEIGHT{\@tempdima}%
+ \special{pdf:bcontent }%
+ \special{%
+ pdf:literal direct
+ 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
+ }%
+ \special{pdf:literal direct W }%
+ \special{pdf:literal direct n }%
+ \box#1%
+ \special{pdf:econtent }%
+ }%
+}
+\endinput
+%%
+%% End of file `tc-xetex.def'.
diff --git a/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty
new file mode 100644
index 00000000000..d0dcb815ac8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty
@@ -0,0 +1,260 @@
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files trimclip.dtx, adjustbox.ins
+%% and the derived files trimclip.sty,
+%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
+%% Further author information are located in the .def files.
+%%
+\ProvidesPackage{trimclip}[%
+ 2012/05/16
+ v1.0
+ Trim and clip general TeX material]
+\def\tc@driver{tc-\Gin@driver}
+\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
+\DeclareOption{pdftex}{\def\tc@driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
+\DeclareOption{xetex}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvips}{\def\tc@driver{tc-dvips.def}\PassOptionsToPackage{dvips}{graphicx}}
+\DeclareOption{dvipdfm}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption{dvipdf}{\def\tc@driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
+\DeclareOption*{%
+ \@ifpackageloaded{graphics}{%
+ \edef\tc@driver{tc-\CurrentOption.def}%
+ \begingroup
+ \edef\@tempa{\CurrentOption.def}%
+ \ifx\@tempa\Gin@driver\else
+ \let\on@line\@gobble
+ \PackageWarning{trimclip}{%
+ A different clipping driver was requested than the\MessageBreak
+ one used for 'graphics/x'! This is not recommended\MessageBreak
+ and can lead to defect output files.%
+ }%
+ \fi
+ \endgroup
+ }{%
+ \def\tc@driver{tc-\Gin@driver}%
+ \PassOptionsToPackage\CurrentOption{graphicx}%
+ }%
+}
+\ProcessOptions*\relax
+\RequirePackage{graphicx}[1999/02/16]
+\RequirePackage{collectbox}[2011/08/22]
+\RequirePackage{adjcalc}
+\def\tc@readvalues#1{%
+ \tc@@readvalues#1 {} {} {} \\%
+}
+\def\tc@@readvalues#1 #2 #3 #4 #5\\{%
+ \adjsetlengthdefault\tc@llx{#1}%
+ \ifx\@nnil#2\@nnil
+ \tc@lly\tc@llx
+ \tc@urx\tc@llx
+ \tc@ury\tc@llx
+ \else
+ \adjsetlengthdefault\tc@lly{#2}%
+ \ifx\@nnil#3\@nnil
+ \tc@urx\tc@llx
+ \tc@ury\tc@lly
+ \else
+ \adjsetlengthdefault\tc@urx{#3}%
+ \adjsetlengthdefault\tc@ury{#4}%
+ \fi
+ \fi
+}%
+\newdimen\tc@llx
+\newdimen\tc@lly
+\newdimen\tc@urx
+\newdimen\tc@ury
+\newcommand\trimbox{%
+ \collectboxcheckenv{trimbox}%
+ \@ifstar
+ \trimbox@s
+ \trimbox@
+}
+\def\trimbox@#1{%
+ \collectbox{\@trimclip\@trimbox{#1}}%
+}
+\def\trimbox@s#1{%
+ \collectbox{\@trimclip\@viewportbox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname trimbox*\endcsname{%
+ \@collectboxisenv{trimbox*}%
+ \trimbox@s
+}
+\newcommand\clipbox{%
+ \collectboxcheckenv{clipbox}%
+ \@ifstar
+ \clipbox@s
+ \clipbox@
+}
+\def\clipbox@#1{%
+ \collectbox{\@trimclip\@clipbox{#1}}%
+}
+\def\clipbox@s#1{%
+ \collectbox{\@trimclip\@clipvpbox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname clipbox*\endcsname{%
+ \@collectboxisenv{clipbox*}%
+ \clipbox@s
+}
+\newcommand\marginbox{%
+ \collectboxcheckenv{marginbox}%
+ \@ifstar
+ \marginbox@s
+ \marginbox@
+}
+\def\marginbox@#1{%
+ \@collectbox{\@trimclip\@marginbox{#1}}%
+}
+\def\marginbox@s#1{%
+ \@collectbox{\@trimclip\@marginraisebox{#1}}%
+}
+\expandafter\newcommand\expandafter*\csname marginbox*\endcsname{%
+ \@collectboxisenv{marginbox*}%
+ \marginbox@s
+}
+\def\@trimclip#1#2{%
+ \tc@readvalues{#2}%
+ #1%
+ \collectedbox
+ \tc@llx
+ \tc@lly
+ \tc@urx
+ \tc@ury
+ \usebox\collectedbox
+}
+\def\tc@correctbaseline#1{%
+ \ifdim\dp#1<\z@
+ \raise\dp#1%
+ \else
+ \ifdim\ht#1<\z@
+ \lower\ht#1%
+ \fi\fi
+ \box#1%
+}%
+\def\tc@correctdims#1{%
+ \ifdim\dp#1<\z@ \dp#1=\z@ \fi
+ \ifdim\wd#1<\z@ \wd#1=\z@ \fi
+ \ifdim\ht#1<\z@ \ht#1=\z@ \fi
+}
+\def\@trimbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly-\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx-\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury-\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1-\tc@urx
+ \ht#1-\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@marginbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \advance\tc@lly\dp#1%
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \dp#1\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@marginraisebox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \advance\tc@urx\wd#1%
+ \tc@ury=#5\relax
+ \advance\tc@ury\ht#1%
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip\tc@llx
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ % Copy original tty values (ury is taken as temp dimension)
+ \tc@ury=\tc@lly
+ \advance\tc@lly\dp#1%
+ \dp#1\tc@lly
+ % Raise bu original tty value (now in ury)
+ \raise\tc@ury\box#1%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@viewportbox#1#2#3#4#5{%
+ \setbox#1=\hbox{%
+ %
+ % Assign values
+ \tc@llx=#2\relax
+ \tc@lly=#3\relax
+ \tc@urx=#4\relax
+ \tc@ury=#5\relax
+ %
+ % Set dimensions now.
+ % This allows that the arguments can refer
+ % to the original dimensions without issues.
+ \hskip-\tc@llx
+ \dp#1-\tc@lly
+ \wd#1\tc@urx
+ \ht#1\tc@ury
+ %
+ \tc@correctbaseline{#1}%
+ }%
+ \tc@correctdims{#1}%
+}
+\def\@clipbox#1#2#3#4#5{%
+ \@trimbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+\def\@clipvpbox#1#2#3#4#5{%
+ \@viewportbox{#1}{#2}{#3}{#4}{#5}%
+ \@cliptoboxdim{#1}%
+}
+\InputIfFileExists{\tc@driver}{%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{Using driver '\tc@driver'.}}%
+}{%
+ \input{tc-pgf.def}%
+ {\let\on@line\@gobble
+ \PackageInfo{trimclip}{No clipping driver '\tc@driver' available.\MessageBreak Using fall-back PGF driver.}}%
+}
+\endinput
+%%
+%% End of file `trimclip.sty'.