diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty | 310 |
1 files changed, 281 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty index 999d602fd1a..c12de75fadb 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2018 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2019 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 @@ -16,8 +16,8 @@ %% and the derived file adjustbox.sty. %% \ProvidesPackage{adjustbox}[% - 2018/04/08 - v1.1 + 2019/01/04 + v1.2 Adjusting TeX boxes (trim, clip, ...)] \RequirePackage{xkeyval} \RequirePackage{adjcalc} @@ -284,12 +284,6 @@ \newadjustboxenv@ }% } -\newcommand*\newadjustboxcmd{% - \begingroup - \let\@@@newadjustboxenv\@@@newadjustboxcmd - \def\new@adjustbox{\newcommand}% - \newadjustboxenv@ -} \newcommand*\renewadjustboxenv{% \begingroup \@ifstar{% @@ -301,12 +295,6 @@ \newadjustboxenv@ }% } -\newcommand*\renewadjustboxcmd{% - \begingroup - \let\@@@newadjustboxenv\@@@newadjustboxcmd - \def\new@adjustbox{\renewcommand}% - \newadjustboxenv@ -} \newcommand*\provideadjustboxenv{% \begingroup \@ifstar{% @@ -318,6 +306,47 @@ \newadjustboxenv@ }% } +\newcommand*\declareadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox##1{% + \expandafter\let\csname ##1\endcsname\@undefined + \newenvironment{##1}% + }% + \newadjustboxenv@ + }{% + \def\new@adjustbox##1{% + \let##1\@undefined + \newcommand{##1}% + }% + \newadjustboxenv@ + }% +} +\newcommand*\newadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +\newcommand*\renewadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ +} +\newcommand*\provideadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ +} +\newcommand*\declareadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}% + \newadjustboxenv@ +} \def\adjustbox@provideenvironment#1{% \@ifundefined{#1}% {\new@environment{#1}}% @@ -370,6 +399,79 @@ \@adjustbox{#3}% }% } +\newcommand*\newadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +\newcommand*\renewadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ +} +\newcommand*\provideadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ +} +\newcommand*\declareadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}% + \newadjustboxenv@ +} +\def\@@@newadjustimage#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \def\@tempa####1{% + \def\IMAGEFILENAME{####1}% + \@adjustbox{#3}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}% + }% + \@tempa + }% +} +\newcommand*\adjustbox@NewAdjustImage[4]{% + \adjustbox@checkforxparse + #1{#2}{#3}{% + \begingroup + \def\@tempa####1{% + \def\IMAGEFILENAME{####1}% + \@adjustbox{#4}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}% + }% + \@tempa + }% +} +\newcommand*\NewAdjustImage{% + \adjustbox@NewAdjustImage\NewDocumentCommand +} +\newcommand*\RenewAdjustImage{% + \adjustbox@NewAdjustImage\RenewDocumentCommand +} +\newcommand*\ProvideAdjustImage{% + \adjustbox@NewAdjustImage\ProvideDocumentCommand +} +\newcommand*\DeclareAdjustImage{% + \adjustbox@NewAdjustImage\ProvideDocumentCommand +} +\def\adjustbox@checkforxparse{% + \begingroup + \expandafter\ifx\csname ver@xparse.sty\endcsname\relax + \PackageError{adjustbox}{% + The 'xparse' package must be loaded separately in\MessageBreak + order to use the following macros: \MessageBreak + \string\NewAdjustImage, + \string\RenewAdjustImage, \MessageBreak + \string\ProvideAdjustImage, + \string\DeclareAdjustImage}{} + \fi + \endgroup + \let\adjustbox@checkforxparse\relax +} \def\adjbox@Gin@add#1{% \def\@tempa{#1}% \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}% @@ -557,9 +659,10 @@ \newcommand*\rndfbox@[2][]{% \collectbox{\@trimclip{\rndframearoundbox@{#1}}{#2}}% } -\def\rndframearoundbox@#1{% +\newif\ifadjbox@rndframe@clip +\def\rndframearoundbox@#1#2#3#4#5#6{% \setkeys{adjbox@rndframe}{#1}% - \@rndframearoundbox + \@rndframearoundbox{#2}{#3}{#4}{#5}{#6}{\ifadjbox@rndframe@clip\relax\fi}% } \define@key{adjbox@rndframe}{width}{% \adjsetlength\fboxrule{#1}% @@ -574,6 +677,9 @@ \def\adjbox@rndframe@color{#1}% } \let\adjbox@rndframe@color\relax +\define@key{adjbox@rndframe}{clip}[true]{% + \csname adjbox@rndframe@clip#1\endcsname +} \define@key\adjbox@fam{scale}{% \@ifnextchar\bgroup{% \adjbox@scale@xy @@ -668,18 +774,158 @@ \fi }% } +\define@key\adjbox@fam{pagecenter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pagecenterbox[{#1}]}% +}% +\define@key\adjbox@fam{pageleftalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageleftalignbox[{#1}]}% +}% +\define@key\adjbox@fam{pagerightalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pagerightalignbox[{#1}]}% +}% +\define@key\adjbox@fam{pageinner}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageinnerbox[{#1}]}% +} +\define@key\adjbox@fam{pageouter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageouterbox[{#1}]}% +} +\define@key\adjbox@fam{textareacenter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareacenterbox[{#1}]}% +}% +\define@key\adjbox@fam{textarealeftalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textarealeftalignbox[{#1}]}% +}% +\define@key\adjbox@fam{textarearightalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textarearightalignbox[{#1}]}% +}% +\define@key\adjbox@fam{textareainner}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareainnerbox[{#1}]}% +} +\define@key\adjbox@fam{textareaouter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareaouterbox[{#1}]}% +} +\newcommand\pagecenterbox[1][\linewidth]{% + \collectboxcheckenv{pagecenterbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@pagecenterbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi+.5\paperwidth-.5\@tempdimc-\@totalleftmargin}}% +} +\def\@pagecenterbox#1#2{% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \adjsetlength\@tempdima{#2}% + \ifdim\@tempdima<\z@ + \@tempdimb=-\@tempdima + \else + \@tempdimb=\@tempdima + \fi + \ifdim\@tempdima<\z@ + \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}\hss}\hskip\@tempdimc}% + \else + \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}}\hss}% + \fi +} +\newcommand\textareacenterbox[1][\linewidth]{% + \collectboxcheckenv{textareacenterbox}% + \noindent\leavevmode + \@collectbox{\@pagecenterbox{#1}{-\@totalleftmargin+.5\textwidth-.5\linewidth}}% +} +\newcommand\pageleftalignbox[1][\linewidth]{% + \collectboxcheckenv{pageleftalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin}}% +} +\newcommand\pagerightalignbox[1][\linewidth]{% + \collectboxcheckenv{pagerightalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin+\paperwidth-(#1)}}% +} +\newcommand\textarealeftalignbox[1][\linewidth]{% + \collectboxcheckenv{textarealeftalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@textarealeftalignbox{#1}}% +} +\def\@textarealeftalignbox#1{% + \adjsetlength\@tempdima{\@totalleftmargin}% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \leavevmode + \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdima{\usebox\collectedbox\hss}\hskip\@tempdimc}% +} +\newcommand\textarearightalignbox[1][\linewidth]{% + \collectboxcheckenv{textarearightalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@textarearightalignbox{#1}{+\textwidth}}% +} +\def\@textarearightalignbox#1#2{% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \adjsetlength\@tempdima{-\@totalleftmargin+\textwidth-\@tempdimc}% + \ifdim\@tempdima<\z@ + \@tempdima=-\@tempdima + \fi + \leavevmode + \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdima{\hss\usebox\collectedbox}\hss}% +} +\newcommand\pageinnerbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\pageleftalignbox + \else + \expandafter\pagerightalignbox + \fi +}% +\newcommand\pageouterbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\pagerightalignbox + \else + \expandafter\pageleftalignbox + \fi +}% +\newcommand\textareainnerbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\textarealeftalignbox + \else + \expandafter\textarearightalignbox + \fi +}% +\newcommand\textareaouterbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\textarearightalignbox + \else + \expandafter\textarealeftalignbox + \fi +}% \IfFileExists{ifoddpage.sty}{% \RequirePackage{ifoddpage}% }{% - \renewcommand\outersidebox[1][]{% + \def\checkoddpage{% \PackageError{adjustbox}{% - The 'outer' and 'inner' keys as well as the\MessageBreak - \string\outersidebox\space and \string\innersidebox\space macros\MessageBreak - require the 'ifoddpage' package, which is not\MessageBreak - installed}{}% - }% - \let\innersidebox\outersidebox + The used key, macro or environment requires \MessageBreak + the 'ifoddpage' package which is not installed!}{}% + } }% +\define@key\adjbox@fam{noindent}[]{% + \noindent +} \define@key\adjbox@fam{raise}{% \@ifnextchar\bgroup{% \adjbox@raise @@ -1548,13 +1794,19 @@ }{}% }% } +\def\adjbox@nofloatenv{minipage} +\def\adjbox@nofloatcaptionsetup#1{% + \@ifundefined{captionsetup}% + {\def\@captype{#1}}% + {\captionsetup{type={#1}}}% +\csname capstart\endcsname +} \newenvironment{adjnofloat}[1]{% - \trivlist - \def\@captype{#1}% - \parindent\z@ - \item\relax + \par\noindent + \minipage{\linewidth}% + \adjbox@nofloatcaptionsetup{#1}% }{% - \endtrivlist + \endminipage\par } \define@key\adjbox@fam{phantom}[]{% \expandafter\ifx\csname #1phantom\endcsname\relax |