diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-09 21:14:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-09 21:14:28 +0000 |
commit | db2477c99efe052b36f6f42d0e8666d5de71fcd0 (patch) | |
tree | 4e039ff9a57a55301741b7fef335580017874c5b | |
parent | 20e3b619e46b4054c5e50d58557d23611f8eae38 (diff) |
adjustbox (9apr18)
git-svn-id: svn://tug.org/texlive/trunk@47405 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/adjustbox/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf | bin | 152771 -> 152773 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf | bin | 293232 -> 347217 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf | bin | 317094 -> 213356 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx | 15 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx | 1441 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/trimclip.dtx | 459 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty | 9 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty | 630 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def | 116 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def | 91 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def | 44 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def | 109 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/trimclip.sty | 9 |
14 files changed, 2691 insertions, 234 deletions
diff --git a/Master/texmf-dist/doc/latex/adjustbox/README b/Master/texmf-dist/doc/latex/adjustbox/README index fd435f47739..0c7817075cd 100644 --- a/Master/texmf-dist/doc/latex/adjustbox/README +++ b/Master/texmf-dist/doc/latex/adjustbox/README @@ -1,6 +1,6 @@ LaTeX bundle adjustbox ========================= -Copyright (c) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +Copyright (c) 2011-2018 by Martin Scharrer <martin@scharrer-online.de> WWW: <https://bitbucket.org/martin_scharrer/adjustbox> (incl. bug tracker) This bundle contains the the adjustbox package and its auxiliary packages trimclip and adjcalc. diff --git a/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf b/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf Binary files differindex f42689ac604..67fde1a7aaa 100644 --- a/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf +++ b/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf diff --git a/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf Binary files differindex ed295b58110..755ba7e002e 100644 --- a/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf +++ b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf diff --git a/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf b/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf Binary files differindex ffc4de0c74d..b9b243455fb 100644 --- a/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf +++ b/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf diff --git a/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx b/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx index 912802fc1bf..1327ed4ab74 100644 --- a/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx +++ b/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %<=*COPYRIGHT> -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -390,6 +390,19 @@ % \end{macro} % % +% \begin{macro}{\adjbox@settobp} +% \begin{macrocode} +\def\adjcalc@settobp#1#2{% + \begingroup + \adjsetlength\@tempdima{#2}% + \@tempdima=0.99626\@tempdima + \edef\@tempa{\endgroup\def\noexpand#1{\strip@pt\@tempdima\space}}% + \@tempa +}% +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\adjcalc@overwrite} % \begin{macrocode} \def\adjcalc@overwrite{% diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx index 91d9cbfbd7e..7453b574924 100644 --- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx +++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %<=*COPYRIGHT> -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -26,10 +26,10 @@ %<*driver> \ProvidesFile{adjustbox.dtx}[% %<=*DATE> - 2012/05/21 + 2018/04/08 %<=/DATE> %<=*VERSION> - v1.0 + v1.1 %<=/VERSION> DTX file for the adjustbox package] \documentclass[a4paper]{ydoc}[2011/08/11] @@ -80,7 +80,7 @@ emph={viewport, trim, Trim, Viewport, Clip, Clip*, frame, fbox, cframe, cfbox, reflect, lap, margin, margin*, dpi, pxdim, execute, raise, valign, bgcolor, set, height, depth, vsize, width, totalheight, center, left, right, outer, inner, min, max, size, totalsize, - minipage, innerenv, innercode, env, Addcode, addcode, precode, Precode, appcode, angle, scale, height, width, totalheight, resolution, + minipage, varwidth, innerenv, innercode, env, Addcode, addcode, precode, Precode, appcode, angle, scale, height, width, totalheight, resolution, }, emphstyle=\keydescstyle, } @@ -234,6 +234,10 @@ % * Fixed min/max size keys to double a single value correctly. % * Code cleanup with "warn width" key. % } +% \changes{v1.1}{2018/04/08}{%^^A +% * Several bug fixes. +% * Support for round corners and frames. +% } % % \GetFileInfo{adjustbox.dtx} % @@ -255,10 +259,11 @@ % It got inspired by the interface of \Macro\includegraphics from the \pkg{graphicx} package. % This package also loads the \pkg{trimclip} package which code was once included in this package. % \end{abstract} +% \clearpage% \tableofcontents % % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Introduction} ^^A ((( +% \clearpage\section{Introduction} ^^A ((( % The standard \LaTeX{} package \pkg{graphicx} (the extended version of \pkg{graphics}) provides the macro % \Macro\includegraphics[<options>]{<file name>} which can be used to include graphic files. Several options can be used % to scale, resize, rotate, trim and/or clip the graphic. @@ -308,7 +313,7 @@ % ^^A )))2 % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Package Options}\label{sec:options} ^^A ((( +% \clearpage\section{Package Options}\label{sec:options} ^^A ((( % This package accepts the following options: % % \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]} @@ -346,7 +351,7 @@ % % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Main Macros}^^A ((( +% \clearpage\section{Main Macros}^^A ((( % The following macros and environments represent the main functionality of this package. % Special care is taken so that the macros and the environments can have the same name. % For starred environments the star can be either part of the name or an optional argument. @@ -368,7 +373,7 @@ % to suppress paragraph indention. % % \Needspace*{5\baselineskip} -% \subsection{Adjust Images} +% \clearpage\subsection{Adjust Images} % \vskip-\lastskip % \DescribeMacro\adjustimage{<key=value, \ldots>}{<image filename>} % This macro can be used as an extension of \Macro\includegraphics. @@ -392,8 +397,67 @@ % It is possible to redefine \Macro\includegraphics to \Macro\adjincludegraphics and this is done by % the \opt{Export} option (not to be confused with the \opt{export} option). % +% ^^A )))2 +% \clearpage\subsection{Defining custom environments and macros} ^^A (((2 +% After \pkg{adjustbox} is used to define custom environments to format specific content. +% If an environment contains other environments these are often written in the plain form \Macro\foo \ldots +% \Macro\endfoo to avoid the overhead of \Macro\begin and \Macro\end and to keep the outer environment name for +% meaningful error messages. As mentioned, the dual nature of \Macro\adjustbox which will detect if it is used +% as environment of macro does not permit this plain form, which can be a pitfall for custom environment definitions. +% Instead the macro form \Macro\adjustbox{<key=value>}\AlsoMacro\bgroup \ldots \Macro\egroup should be used. +% To simplify custom environment definitions based on \Macro\adjustbox/\env{adjustbox} the following macros are +% provided. +% +% +% \DescribeMacro\newadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>} +% This declaration defines an environment and macro with the given name which will apply the given \pkg{adjustbox} keys +% to its content. The environment/macro can also posses arguments, including one leading optional argument, which can be +% used inside the key=value pairs. It is recommended to wrap the arguments into braces, e.g.\ use `|{#1}|' instead of +% `|#1|' etc., to avoid issues with potentially included commas and equal signs. +% The number and type of arguments are defined using two optional arguments in the same +% way as for \Macro\newcommand and \Macro\newenvironment. +% +% +% \DescribeMacro\newadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>} +% This declaration works similar to the unstarred version but only defines an environment. +% This environment can therefore be used like any other normal \LaTeX\ environment, including in its plain +% form {\macrodescstyle\textbackslash\meta{name}} \ldots {\macrodescstyle{\textbackslash end\meta{name}}}. +% +% +% \DescribeMacro\renewadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>} +% \DescribeMacro\renewadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will redefine an existing macro/environment and cause an +% error if it was not yet defined. +% +% +% \DescribeMacro\provideadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>} +% \DescribeMacro\provideadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will define a macro/environment only if it does not exists +% yet. % -% \subsection{Setting keys globally} ^^A (((2 +% +% \DescribeMacro\newadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% This declaration defines a macro which applies the given \pkg{adjustbox} keys to its content. +% As with \Macro\adjustbox the content is read as box, not as macro argument. +% The macro arguments (if any) are defined in the same way as with \Macro\newcommand. +% The arguments can then be used inside the key=value pairs. The number of arguments does not +% include the content. +% This declaration is intended if no environment form is required and is more efficient than the dual declaration. +% +% \begin{example} +% \begin{examplecode} +% \newadjustboxcmd{\frotate}[1]{rotate={#1},fbox}% +% \frotate{30}{Text} +% \end{examplecode} +% \end{example} +% +% +% \DescribeMacro\renewadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxcmd but will redefine an existing macro and cause an +% error if it was not yet defined. +% +% ^^A )))2 +% \clearpage\subsection{Setting keys globally} ^^A (((2 % \vskip-\lastskip % \DescribeMacro\adjustboxset{<global keys to be executed \emph{before} local keys>} % \DescribeMacro\adjustboxset*{<global keys to be executed \emph{after} local keys>} @@ -438,7 +502,7 @@ % \end{examples} % % ^^A )))2 -% \subsection{Argument Values}\label{sec:argval} ^^A (((2 +% \clearpage\subsection{Argument Values}\label{sec:argval} ^^A (((2 % All length values given in the arguments of all macros and keys provided by this package are parsed % by and advanced version of \Macro\setlength\relax (called \Macro\adjsetlength) which uses either $\epsilon$-\TeX\ % expressions (default), the \pkg{calc} package (default fall-back) or the \Macro\pgfmathparse of the \pkg{pgf} package. @@ -466,6 +530,20 @@ % useful if the size of the content is modified by several keys, but further keys should still work relative to the % original content. % +% +% \DescribeMacro\smallestside +% This macro expands to either \Macro\width or \Macro\totalheight whatever is smaller. +% +% \DescribeMacro\largestside +% This macro expands to either \Macro\width or \Macro\totalheight whatever is larger. +% +% \DescribeMacro\Smallestside +% This macro expands to either \Macro\Width or \Macro\Totalheight whatever is smaller. +% +% \DescribeMacro\Largestside +% This macro expands to either \Macro\Width or \Macro\Totalheight whatever is larger. +% +% % \subsubsection*{Default unit} % If no unit is provided for of the bounding box coordinates (llx, lly, urx, ury) in the trim and clip features then % PostScript points (\emph{big points}, bp, $72\,\text{bp}=1\,\text{inch}$) are used, as it is the default behaviour of @@ -479,7 +557,7 @@ % ^^A )))2 % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Adjustbox Keys} ^^A ((( +% \clearpage\section{Adjustbox Keys} ^^A ((( % This packages provides the following \Macro\adjustbox keys with matching macros and environments. % % @@ -538,10 +616,20 @@ % The starred version will use the given coordinates as \Key{viewport}. % These keys work by wrapping the content internally in a \Macro\clipbox or \Macro\clipbox*\relax macro. % +% \DescribeKey{rndcorners}'='<radius for all four corners> +% \DescribeKey{rndcorners}'='<upper left>~<upper right>~<lower right>~<lower left> +% This key produces round corners by clipping the content. This is done using the same way as the +% above clipping keys but instead of a rectangle clipping path one with quarter circles is used. +% The radius of the every round corner can be given separatly if wanted. If only one value is given +% it is used for all four corners. A value of 0pt will produce a normal rectangular corner. +% No radius should be larger than half the smallest side (minimum of \Macro\width and \Macro\totalheight). +% +% Please see also the related keys \Key{fbox} and \Key{rndframe}, which allow to add a rounded frame around the content as well. +% % % % ^^A )))2 -% \subsection{Margins and Vertical Spacing} ^^A (((2 +% \clearpage\subsection{Margins and Vertical Spacing} ^^A (((2 % \vspace{-\baselineskip} % % \DescribeKey{margin}'='<all sites> @@ -590,7 +678,7 @@ % % % ^^A )))2 -% \subsection{Minimum and Maximum Size} ^^A (((2 +% \clearpage\subsection{Minimum and Maximum Size} ^^A (((2 % The following keys allow to set a minimum or maximum size. % The content will be scaled down or up if required. % @@ -697,7 +785,7 @@ % % ^^A )))2 % \Needspace*{8\baselineskip} -% \subsection{Scaling} ^^A (((2 +% \clearpage\subsection{Scaling} ^^A (((2 % \vspace{-\baselineskip} % % \DescribeKey{scale}'='<factor> @@ -733,7 +821,7 @@ % % % ^^A )))2 -% \subsection{Frame} ^^A (((2 +% \clearpage\subsection{Frame} ^^A (((2 % The following keys can be used to draw frames around the content. % % \DescribeKey{fbox} @@ -767,7 +855,7 @@ % \DescribeKey{frame}'='<rule width> % \DescribeKey{frame}'='<rule width>~<sep> % \DescribeKey{frame}'='<rule width>~<sep>~<margin> -% The \Key{frame} key as the same effect as the \Key{fbox} key but is modeled after \LaTeX's \Macro\frame macro (not the version \cls{beamer} defines). +% The \Key{frame} key has the same effect as the \Key{fbox} key but is modeled after \LaTeX's \Macro\frame macro (not the version \cls{beamer} defines). % This means it adds a tight frame with zero separation around the content by default. Besides that it accepts the same space separated values. % This key is useful to easily add a tight frame around images where the normal separation wouldn't fit. % @@ -799,14 +887,54 @@ % The \pkg{xcolor} package must be loaded manually in order for this key to work. % \begin{example} % \begin{examplecode} -% \adjustbox{cfbox=blue!50!green} +% \adjustbox{cframe=blue!50!green} % {Like a blue and green \cs{frame}} % \end{examplecode} % \end{example} % % +% \DescribeKey{rndframe}'='<all sites> +% \DescribeKey{rndframe}'='<left/right>~<top/bottom> +% \DescribeKey{rndframe}'='<llx>~<lly>~<urx>~<ury> +% \DescribeKey{rndframe}'='{<options>}{<all sites>} +% \DescribeKey{rndframe}'='{<options>}{<left/right>~<top/bottom>} +% \DescribeKey{rndframe}'='{<options>}{<llx>~<lly>~<urx>~<ury>} +% +% \begingroup +% \colorlet{keydesc}{keydesc!50!green} +% \DescribeKey{color}'='{<color>} +% \DescribeKey{color*}'='{<color command>} +% \DescribeKey{width}'='{<rule width>} +% \DescribeKey{sep}'='{<rule separation>} +% +% \DescribeKey{clip} +% \DescribeKey{clip}'=true|false' +% \endgroup +% +% \begin{example} +% \begin{examplecode} +% \adjustbox{scale=3,bgcolor=gray,rndframe={color=red,width=2\fboxrule,sep=2\fboxsep}{15pt}} +% {\Huge XXXX}% +% \end{examplecode} +% \end{example} +% +% \DescribeKey{rndcornersbox} +% Like \Key{rndframe} (see argument list there) but only clips the corners without drawing a frame. +% +% \DescribeKey{rndfbox} +% Like \Key{rndframe} (see argument list there) but with preset +% \begingroup +% \colorlet{keydesc}{keydesc!50!green} +% \Key{sep}'='0pt. +% \endgroup +% +% \DescribeMacro\rndcornersbox +% \DescribeMacro\rndframebox +% \DescribeMacro\rndfbox +% Standlone macro versions of the corresponding keys. See there for the list of arguments. +% % ^^A )))2 -% \subsection{Vertical Alignment} ^^A (((2 +% \clearpage\subsection{Vertical Alignment} ^^A (((2 % The following keys can be used to adjust the vertical alignment and size of the content. % % \DescribeKey{valign}'='<letter> @@ -933,7 +1061,7 @@ % % % ^^A )))2 -% \subsection{Horizontal Alignment} ^^A (((2 +% \clearpage\subsection{Horizontal Alignment} ^^A (((2 % The following keys can be used to adjust the horizontal alignment and size of the content. % % \DescribeKey{center} @@ -1010,6 +1138,30 @@ % If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning. % % +% \DescribeMacro\centerbox[<width>]{<content>} +% \vspace{-1.5\baselineskip} +% \DescribeEnv[<content>]{centerbox}[<width>] +% Macro and environment version of the \Key{center} key. The optional width argument defaults to \Macro\linewidth. +% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by +% placing a |\mbox{}| or the identical |\null| macro before it. +% +% +% \DescribeMacro\leftalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip} +% \DescribeEnv[<content>]{leftalignbox}[<width>] +% Macro and environment version of the \Key{left} key. The optional width argument defaults to \Macro\linewidth. +% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by +% placing a |\mbox{}| or the identical |\null| macro before it. +% +% +% \DescribeMacro\rightalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip} +% \DescribeEnv[<content>]{rightalignbox}[<width>] +% Macro and environment version of the \Key{rightalign} key. The optional width argument defaults to \Macro\linewidth. +% Both include a \Macro\noindent to avoid paragraph indention. If an paragraph indention is wanted it can be created by +% placing a |\mbox{}| or the identical |\null| macro before it. +% +% % \DescribeMacro\innersidebox[<width>]{<content>} % \vspace{-1.5\baselineskip} % \DescribeEnv[<content>]{innersidebox}[<width>] @@ -1026,7 +1178,7 @@ % placing a |\mbox{}| or the identical |\null| macro before it. % % -% \subsection*{Lapping} ^^A (((3 +% \clearpage\subsection*{Lapping} ^^A (((3 % The following features can be used to make the content lap over its left or right boundary. This is basically the same % as trimming, but provides a different, more dedicated interface. % @@ -1133,9 +1285,63 @@ % % ^^A )))3 % ^^A )))2 -% \subsection{Background} ^^A (((2 +% \clearpage\subsection{Support for \pkg{graphicx} keys} ^^A (((2 +% +% \DescribeKey{bbllx}'='<length> +% \DescribeKey{bblly}'='<length> +% \DescribeKey{bburx}'='<length> +% \DescribeKey{bbury}'='<length> +% \DescribeKey{decodearray} +% \DescribeKey{intent} +% \DescribeKey{interpolate} +% \DescribeKey{maskarray} +% \DescribeKey{natheight}'='<length> +% \DescribeKey{natwidth}'='<length> +% \DescribeKey{ocobjnum} +% \DescribeKey{ocobjref} +% \DescribeKey{page}'='<page numbers> +% \DescribeKey{pagebox} +% \DescribeKey{print} +% \DescribeKey{quiet} +% \DescribeKey{resetcolor} +% \DescribeKey{resolution} +% \DescribeKey{xmpfile} +% The above \pkg{graphicx} keys are also supported by \cs{adjustbox}. This is done by relying on the original +% \pkg{graphicx} code, i.e. the key code is copied into the \pkg{adjustbox} namespace. These keys are therefore +% mostly for use with images and might not work well with other content. +% For more details on these keys see the \pkg{graphicx} manual. +% +% ^^A )))2 +% \clearpage\subsection{Colors} ^^A (((2 % \vspace{-\baselineskip} % +% \DescribeKey{color}'='<color> +% \DescribeKey{color}'='{<model>}{<color>} +% This key sets the color for all material. Both the content and further material added by other keys will be affected. +% The color change is immediate and will occur before basically every other key takes effect. +% The order in which this key is used is therefore meaningless. +% Using this key several times will cause several color changes with the last one be used for the remaining material. +% Note that \Key{color} will not influence any \Key{fgcolor} or \Key{bgcolor} beside the fact that it changes the +% \emph{current color} accessible using the special name `|.|'. +% +% \DescribeKey{color*}'='<color macro> +% Like \Key{color} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors. +% See the \pkg{xcolor} manual for more details. A \Macro\blendcolors will affect both \Key{fgcolor} and \Key{bgcolor}. +% +% +% \DescribeKey{fgcolor}'='<color> +% \DescribeKey{fgcolor}'='{<model>}{<color>} +% This key sets the color for the content. +% The value is passed to an internal \Macro\color macro. +% This is done using \Key{innercode} because the color must be set before the content is boxed. +% Further material added using keys, e.g.\ a \Key{frame}, is not affected by this key. +% The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded otherwise an error will be raised. +% +% \DescribeKey{fgcolor*}'='<color macro> +% Like \Key{fgcolor} but awaits a full color macro as value. This allows to use other macros as \Macro\color like \Macro\blendcolors. +% See the \pkg{xcolor} manual for more details. +% +% % \DescribeKey{bgcolor}'='<color> % \DescribeKey{bgcolor}'='{<model>}{<color>} % This key adds a colored background to the content. The \pkg{xcolor} package (or \pkg{color} or \pkg{xxcolor}) needs to be loaded @@ -1170,18 +1376,123 @@ % \end{examplecode} % \end{examples} % +% \DescribeMacro{\bgcolorbox}[<model>]{<color>} +% \DescribeMacro{\bgcolorbox}*{<color macro>} +% \vspace{-1.5\baselineskip} +% \DescribeEnv[<content>]{bgcolorbox}[<model>]{<color>} +% \vspace{-1.5\baselineskip} +% \DescribeEnv[<content>]{bgcolorbox*}{<color macro>} +% Standalone macro and environment versions of the \Key{bgcolorbox} and \Key{bgcolorbox*} keys. +% +% +% +% ^^A )))2 +% \clearpage\subsection{Background and Forground Images and Text} ^^A (((2 +% The following keys, macros and environment allow to add background and foreground layers. +% These layers are placed on the baseline of the original content and are horizontally centered, but can be adjusted +% using own \Macro\adjustbox or \Macro\includegraphics keys. +% The following dimension registers can be used to refer to the dimensions of the original content. +% +% \DescribeMacros +% \hbox{\Macro\pwidth~~~\Macro\pheight~~~\Macro\pdepth~~~\Macro\ptotalheight}% +% \endDescribeMacros +% These dimension registers hold the width, height, depth and total height (height+depth) of the parent box and can be used +% to resize a background or foreground layer accordantly. They are only defined inside the key=value arguments of the +% following keys, macros and environments. % % \DescribeKey{bgimage}'='<image filename> % \DescribeKey{bgimage}'='{<key=value pairs for image>}{<image filename>} % Adds a background image to the content. The image is stretched if required to fit exactly to the content. % It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done). +% \begin{examples} +% \begin{examplecode} +% \adjustbox{bgimage=example-grid-100x100bp}{Some text} +% \end{examplecode} +% \end{examples} +% +% \DescribeKey{bgimage*}'='<image filename> +% \DescribeKey{bgimage*}'='{<key=value pairs for image>}{<image filename>} +% Adds a background image to the content like \Key{bgimage} but the image is not stretched to fit the content. +% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys. +% The image is placed on the baseline of the content and horizontally centered. It can be lowered to the lower edge of +% the content using \Key{raise}'=-'\AlsoMacro\pdepth and left aligned using \Key{left}'='\AlsoMacro\pwidth etc. % % \DescribeMacro{\bgimagebox}[<key=value pairs>]{<image filename>} -% Standalone version of the \Key{bgimage} key. Also available as \env{bgimagebox} environment. +% \DescribeMacro{\bgimagebox}*[<key=value pairs>]{<image filename>} +% \DescribeEnv[<content>]{bgimagebox}[<key=value pairs>]{<image filename>} +% \DescribeEnv[<content>]{bgimagebox*}[<key=value pairs>]{<image filename>} +% Standalone macro and environment versions of the \Key{bgimage} and \Key{bgimage*} keys. +% +% +% \DescribeKey{fgimage}'='<image filename> +% \DescribeKey{fgimage}'='{<key=value pairs for image>}{<image filename>} +% Adds a foreground image to the content. The image is stretched to fit exactly to the content. +% It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the image (before the resizing is done). +% The image is assumed to have transparent elements, otherwise the existing content is fully covered. +% +% \DescribeKey{fgimage*}'='<image filename> +% \DescribeKey{fgimage*}'='{<key=value pairs for image>}{<image filename>} +% Adds a foreground image to the content like \Key{fgimage} but the image is not stretched to fit the content. +% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys. +% The image is placed on the baseline of the content and horizontally centered. +% +% \DescribeMacro{\fgimagebox}[<key=value pairs>]{<image filename>} +% \DescribeMacro{\fgimagebox}*[<key=value pairs>]{<image filename>} +% \DescribeEnv[<content>]{fgimagebox}[<key=value pairs>]{<image filename>} +% \DescribeEnv[<content>]{fgimagebox*}[<key=value pairs>]{<image filename>} +% Standalone macro and environment versions of the \Key{fgimage} and \Key{fgimage*} keys. +% +% +% +% \DescribeKey{background}'='<background content> +% \DescribeKey{background}'='{<key=value pairs for image>}{<background content>} +% Adds the given content as background layer to the main content. The background content is stretched to fit the size of +% the main content. It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the +% background content (before the resizing is done). +% \begin{examples} +% \begin{examplecode} +% \adjustbox{background={\color{red}xxx}}{Some text} +% \end{examplecode} +% \end{examples} +% +% \DescribeKey{background*}'='<background content> +% \DescribeKey{background*}'='{<key=value pairs for image>}{<background content>} +% Like \Key{background} but does not resizes the background content. +% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys. +% +% \DescribeMacro{\backgroundbox}[<key=value pairs>]{<background content>} +% \DescribeMacro{\backgroundbox}*[<key=value pairs>]{<background content>} +% \DescribeEnv[<content>]{backgroundbox}[<key=value pairs>]{<background content>} +% \DescribeEnv[<content>]{backgroundbox*}[<key=value pairs>]{<background content>} +% Standalone macro and environment versions of the \Key{background} and \Key{background*} keys. +% +% +% \DescribeKey{foreground}'='<foreground content> +% \DescribeKey{foreground}'='{<key=value pairs for image>}{<foreground content>} +% Adds the given content as foreground layer to the main content. The foreground content is stretched to fit the size of +% the main content. It is also possible to provide \Macro\adjustbox or \Macro\includegraphics keys to modify the +% foreground content (before the resizing is done). +% \begin{examples} +% \begin{examplecode} +% \adjustbox{foreground={\color{red}xxx}}{Some text} +% \end{examplecode} +% \end{examples} +% +% \DescribeKey{foreground*}'='<foreground content> +% \DescribeKey{foreground*}'='{<key=value pairs for image>}{<foreground content>} +% Like \Key{foreground} but does not resizes the foreground content. +% Instead it is added in its natural size but can be adjusted using \Macro\adjustbox or \Macro\includegraphics keys. +% +% \DescribeMacro{\foregroundbox}[<key=value pairs>]{<foreground content>} +% \DescribeMacro{\foregroundbox}*[<key=value pairs>]{<foreground content>} +% \DescribeEnv[<content>]{foregroundbox}[<key=value pairs>]{<foreground content>} +% \DescribeEnv[<content>]{foregroundbox*}[<key=value pairs>]{<foreground content>} +% Standalone macro and environment versions of the \Key{foreground} and \Key{foreground*} keys. +% % % % ^^A )))2 -% \subsection{Density / Pixel size} ^^A (((2 +% \clearpage\subsection{Density / Pixel size} ^^A (((2 % The following keys allow to adjust the effective length of |pdftex| special |px| (pixel) unit. % This can be required for images which do not have the correct DPI meta-data included. % @@ -1218,7 +1529,7 @@ % % % ^^A )))2 -% \subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner} ^^A (((2 +% \clearpage\subsection{Minipage or other inner environments which change the processing of the content}\label{sec:inner} ^^A (((2 % The following keys set the way the content is processed before it is stored it in a box. % These keys will overwrite each other and only the latest used key will take effect. % Because they affect the inner content directly their order relative to other, normal keys is not meaningful. @@ -1259,6 +1570,14 @@ % \end{examples} % % +% \DescribeKey{varwidth}'='<width> +% Adds a \env{varwidth} environment from the \pkg{varwidth} package around the content. This is similar to the +% \env{minipage} environment but the final width of the content will be as large as the widest line in the content up to +% the maximum amount given by the width argument. +% This environment key is vert useful if the content produces some paragraph material which can't be stored in an +% horizontal box directly. +% +% % \DescribeKey{tabular}'='[<position>]{<column specification>} % \DescribeKey{tabular*}'='[<position>]{<width>}{<column specification>} % \DescribeKey{array}'='[<position>]{<column specification>} @@ -1345,7 +1664,7 @@ % \end{example} % % ^^A )))2 -% \subsection{Floats and non-float replacements} ^^A (((2 +% \clearpage\subsection{Floats and non-float replacements} ^^A (((2 % The following keys can be used to turn an adjusted box into a float or a non-floating replacement which also allows % for a caption. These keys must be used last and no other normal keys must be used afterwards, otherwise an error will % occur because the added floating environment is boxed again. @@ -1406,7 +1725,7 @@ % % ^^A )))2 % \Needspace*{8\baselineskip} -% \subsection{Adding own Code or Environments} ^^A (((2 +% \clearpage\subsection{Adding own Code or Environments} ^^A (((2 % \vspace{-\baselineskip} % % \DescribeKey{env}'='<environment name> @@ -1419,6 +1738,12 @@ % Adds some \meta{code before} and some \meta{code after} the content and the % already existing code around it which was added by other keys beforehand. % At this stage the content is already boxed and format macros won't have any effect on any included text. +% This key sets +% the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content +% beforehand. +% +% \DescribeKey{Addcode}'='{<code before>}{<code afters>} +% Identical to \Key{addcode} but does not sets the size of the content first. % % \DescribeKey{appcode}'='<code afterwards> % Appends come \meta{code after} the content and the already existing code around it which was added by other keys beforehand. @@ -1427,6 +1752,13 @@ % \DescribeKey{precode}'='<code before> % Prepends come \meta{code afterwards} the content and the already existing code around it which was added by other keys beforehand. % More complex code should be enclosed in braces. +% This key sets +% the size of the content before adding the code, i.e.\ keys like \Key{width} or \Key{scale} are executed on the content +% beforehand. +% +% \DescribeKey{Precode}'='{<code before>} +% Identical to \Key{precode} but does not sets the size of the content first. +% % % \DescribeKey{execute}'='<code> % Simply executes the code immediately. This is done in the key processing phase and is intended mostly for debugging purposes. @@ -1438,7 +1770,7 @@ % % % ^^A )))2 -% \subsection{Change or discard content} ^^A (((2 +% \clearpage\subsection{Change or discard content} ^^A (((2 % \vspace{-\baselineskip} % % \DescribeKey{phantom} @@ -1485,7 +1817,7 @@ % % % ^^A )))2 -% \subsection{Store box content } ^^A (((2 +% \clearpage\subsection{Store box content } ^^A (((2 % % \DescribeKey{gstore}'='<\textbackslash boxregister> % \DescribeKey{gstore*}'='<\textbackslash boxregister> @@ -1510,7 +1842,7 @@ % % % ^^A )))2 -% \subsection{Experimental Keys} ^^A (((2 +% \clearpage\subsection{Experimental Keys} ^^A (((2 % The following features are experimental and may not work correctly yet. % At the moment the \pkg{storebox} package must be loaded manually for this keys. % @@ -1547,7 +1879,7 @@ % ^^A )))2 % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Defining own Keys} ^^A ((( +% \clearpage\section{Defining own Keys} ^^A ((( % The following macros can be used to define own keys or redefine existing ones. % % \DescribeMacro\newadjustboxkey{<key>}[<default value>]{<code>} @@ -1586,10 +1918,9 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \StopEventually{} -% \clearpage -% ^^A ))) +% \clearpage% ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \section{Implementation} ^^A ((( +% \clearpage\section{Implementation} ^^A ((( % \setcounter{lstnumber}{1} % % \iffalse @@ -1741,23 +2072,33 @@ % the saved options are activated and the final size is set. % The typesetting of the content is finally done by executing the token register. % \begin{macrocode} -\newcommand\adjustbox[1]{% +\newcommand\adjustbox{% \begingroup + \collectboxcheckenv{adjustbox}% + \@adjustbox +} +\long\def\@adjustbox#1{% \edef\adjbox@line{\the\inputlineno}% \let\collectbox@mode\relax \let\collectbox@noindent\relax - \collectboxcheckenv{adjustbox}% - \ifcollectboxenv\else + \let\adjbox@collectbox\@collectbox + \let\adjbox@begininnercode\@empty + \let\adjbox@endinnercode\@empty + \chardef\adjbox@innerlevel\z@ + \ifcollectboxenv + \let\adjustbox@noindent\noindent + \let\adjustbox@unskip\unskip + \let\adjustbox@ignorespaces\ignorespaces + \else \let\adjustbox@noindent\relax + \let\adjustbox@unskip\relax + \let\adjustbox@ignorespaces\relax \fi - \begingroup + \let\XKV@checksanitizea\adjbox@kvsanitize \adjbox@setkeys{#1}% - \expandafter\expandafter\expandafter - \endgroup \expandafter \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}% } -\def\adjbox@collectbox{\@collectbox} \def\adjbox@setkeys@ba{% \expandafter\expandafter \expandafter\adjbox@@setkeys@ba @@ -1771,7 +2112,6 @@ \def\adjbox@setkeys{% \setkeys*{ADJBOX}% } -\let\adjustbox@noindent\noindent % \end{macrocode} % \end{environment} % @@ -1803,6 +2143,104 @@ % \end{macrocode} % \end{macro} % +% \begin{macrocode} +\begingroup +\catcode`\, 3 +\catcode`\= 3 +\gdef\adjbox@comma@iii{,}% +\gdef\adjbox@equal@iii{=}% +\catcode`\, 4 +\catcode`\= 4 +\gdef\adjbox@comma@iv{,}% +\gdef\adjbox@equal@iv{=}% +\catcode`\, 7 +\catcode`\= 7 +\gdef\adjbox@comma@vii{,}% +\gdef\adjbox@equal@vii{=}% +\catcode`\, 8 +\catcode`\= 8 +\gdef\adjbox@comma@viii{,}% +\gdef\adjbox@equal@viii{=}% +\catcode`\, 10 +\catcode`\= 10 +\gdef\adjbox@comma@x{,}% +\gdef\adjbox@equal@x{=}% +\catcode`\, 11 +\catcode`\= 11 +\gdef\adjbox@comma@xi{,}% +\gdef\adjbox@equal@xi{=}% +\catcode`\, 13 +\catcode`\= 13 +\gdef\adjbox@comma@xiii{,}% +\gdef\adjbox@equal@xiii{=}% +\catcode`\, 12 +\catcode`\= 12 +\gdef\adjbox@comma@xii{,}% +\gdef\adjbox@equal@xii{=}% +% \end{macro} +% +% \begin{macro}{\adjbox@kvsanitize} +% \begin{macrocode} +\gdef\adjbox@kvsanitize#1#2{% + \def\@tempa{\expandafter\noexpand\adjbox@comma@xiii}% + \def\@tempb{}% + \ifnum\catcode`\,=12 \else + \ifnum\catcode`\,=13 \else + \@ifundefined{adjbox@comma@\romannumeral\catcode`\,}{% + \PackageError{adjustbox} + {Invalid comma catcode \the\catcode`\,}{}% + }{}% + \edef\@tempb{\csname adjbox@comma@\romannumeral\the\catcode`\,\endcsname}% + \fi + \fi + \edef\@tempa{\@tempa\@tempb}% + \XKV@tempa@toks{#1}% + \expandafter\adjbox@replacecatcodes\expandafter,\@tempa\@nnil + \def\@tempa{\expandafter\noexpand\adjbox@equal@xiii}% + \def\@tempb{}% + \ifnum\catcode`\==12 \else + \ifnum\catcode`\==13 \else + \@ifundefined{adjbox@equal@\romannumeral\catcode`\=}{% + \PackageError{adjustbox} + {Invalid equal sign catcode \the\catcode`\=}{}% + }{}% + \def\@tempb{\@tempa\csname adjbox@equal@\romannumeral\the\catcode`\,\endcsname}% + \fi + \fi + \edef\@tempa{\@tempa\@tempb}% + \expandafter\adjbox@replacecatcodes\expandafter=\@tempa\@nnil + \edef#2{\the\XKV@tempa@toks}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\adjbox@replacecatcodes} +% \begin{macrocode} +\gdef\adjbox@replacecatcodes#1#2{% + \ifx\@nnil#2\relax\else + \def\@tempa##1#2{% + \ifx\@nnil##1\relax\else + \XKV@tempa@toks{##1}% + \expandafter\@tempb + \fi + }% + \def\@tempb##1#2{% + \ifx\@nnil##1\relax\else + \XKV@tempa@toks\expandafter{\the\XKV@tempa@toks#1##1}% + \expandafter\@tempb + \fi + }% + \expandafter\@tempa\the\XKV@tempa@toks#2\@nnil#2\relax + \expandafter\adjbox@replacecatcodes\expandafter#1% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\endgroup +% \end{macrocode} +% % % \begin{macro}{\adjustbox@content} % The default content, which is simply the collected box. @@ -1815,6 +2253,34 @@ % \end{macro} % % +% \begin{macro}{\smallestside} +% \begin{macrocode} +\def\smallestside{\ifdim\width<\totalheight \width\else\totalheight\fi}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\largestside} +% \begin{macrocode} +\def\largestside{\ifdim\width>\totalheight \width\else\totalheight\fi}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Smallestside} +% \begin{macrocode} +\def\Smallestside{\ifdim\Width<\Totalheight \Width\else\Totalheight\fi}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Largestside} +% \begin{macrocode} +\def\Largestside{\ifdim\Width>\Totalheight \Width\else\Totalheight\fi}% +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\adjbox@Width} % \begin{macro}{\adjbox@Height} % \begin{macro}{\adjbox@Depth} @@ -1831,6 +2297,37 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\adjbox@pwidth} +% \begin{macro}{\adjbox@pheight} +% \begin{macro}{\adjbox@pdepth} +% \begin{macro}{\adjbox@ptotalheight} +% Dimension registers for parent sizes; used for keys which use an internal adjustbox. +% \begin{macrocode} +\newdimen\adjbox@pwidth +\newdimen\adjbox@pheight +\newdimen\adjbox@pdepth +\newdimen\adjbox@ptotalheight +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\adjbox@parentdims} +% \begin{macrocode} +\def\adjbox@parentdims{% + \let\pwidth\adjbox@pwidth + \let\pheight\adjbox@pheight + \let\pdepth\adjbox@pdepth + \let\ptotalheight\adjbox@ptotalheight + \pwidth\width + \pheight\height + \pdepth\depth + \ptotalheight\totalheight +}% +% \end{macrocode} +% \end{macro} +% % % \begin{macro}{\adjbox@esetsize} % Replacement of \Macro\Gin@esetsize. @@ -1885,6 +2382,198 @@ {\csname adjustbox@minimal\endcsname} % \end{macrocode} % +% +% ^^A ))) +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Macros to define new adjustbox environments/macros} ^^A ((( +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{macro}{\newadjustboxenv} +% \begin{macrocode} +\newcommand*\newadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\newenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newadjustboxcmd} +% \begin{macrocode} +\newcommand*\newadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newadjustboxenv} +% \begin{macrocode} +\newcommand*\renewadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\renewenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\renewadjustboxcmd} +% \begin{macrocode} +\newcommand*\renewadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newadjustboxenv} +% \begin{macrocode} +\newcommand*\provideadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\adjustbox@provideenvironment} +% Tests if the environment already exists and calls the internal +% macro of \Macro\newenvironment if not. Otherwise, the two optional +% and two mandatory arguments are gobbled. +% \begin{macrocode} +\def\adjustbox@provideenvironment#1{% + \@ifundefined{#1}% + {\new@environment{#1}}% + {\adjustbox@gobble@oomm}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\adjustbox@gobble@oomm} +% Gobbles the first optional argument. +% \begin{macrocode} +\newcommand*\adjustbox@gobble@oomm[1][]{% + \adjustbox@gobble@@oomm +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\adjustbox@gobble@@oomm} +% Gobbles the second optional and two mandatory arguments. +% \begin{macrocode} +\newcommand*\adjustbox@gobble@@oomm[3][]{% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newadjustboxenv@} +% \begin{macrocode} +\def\newadjustboxenv@#1{% + \@ifnextchar{[}% + {\@newadjustboxenv{#1}}% + {\@@@newadjustboxenv{#1}{[0]}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@newadjustboxenv} +% \begin{macrocode} +\def\@newadjustboxenv#1[#2]{% + \@ifnextchar{[}% + {\@@newadjustboxenv{#1}{#2}}% + {\@@@newadjustboxenv{#1}{[#2]}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@newadjustboxenv} +% \begin{macrocode} +\def\@@newadjustboxenv#1#2[#3]{% + \@@@newadjustboxenv{#1}{[#2][#3]}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@@newadjustboxenv@} +% \begin{macrocode} +\def\@@@newadjustboxenv@#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \@collectboxisenv{#1}% + \@adjustbox{#3}% + }{% + \collectboxenvend + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@@newadjustboxenv} +% \begin{macrocode} +\def\@@@newadjustboxenv#1#2#3{% + \expandafter + \endgroup + \expandafter + \expandafter\new@adjustbox\csname #1\endcsname#2{% + \begingroup + \collectboxcheckenv{#1}% + \@adjustbox{#3}% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@@newadjustboxcmd} +% \begin{macrocode} +\def\@@@newadjustboxcmd#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \@adjustbox{#3}% + }% +} +% \end{macrocode} +% \end{macro} +% +% % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Internal code adding macros} ^^A ((( @@ -2082,6 +2771,21 @@ % \end{macro} % % +% \begin{macro}{\adjbox@copy@key} +% Aliases one key to another. +% \begin{macrocode} +\def\adjbox@copy@key#1{% + \expandafter\let + \csname KV@ADJBOX@#1\expandafter\endcsname + \csname KV@Gin@#1\endcsname + \expandafter\let + \csname KV@ADJBOX@#1@default\expandafter\endcsname + \csname KV@Gin@#1@default\endcsname +} +% \end{macrocode} +% \end{macro} +% +% % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Keys for trimming, clipping, viewport and margin} ^^A ((( @@ -2142,6 +2846,40 @@ % \end{macrocode} % \end{key} % +% \begin{key}{adjbox}{rndcorners} +% \begin{macrocode} +\define@adjboxkey{rndcorners}{\rndcornersbox@{#1}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{adjbox}{rndframe} +% \begin{macrocode} +\define@adjboxkey{rndframe}{% + \@ifnextchar\bgroup{% + \adjbox@rndframe{sep=\z@}% + }{% + \adjbox@rndframe{sep=\z@}{}% + }#1\@nnil +} +% \end{macrocode} +% \end{key} +% +% \begin{key}{adjbox}{rndfbox} +% \begin{macrocode} +\define@adjboxkey{rndfbox}{% + \@ifnextchar\bgroup{% + \adjbox@rndframe{}% + }{% + \adjbox@rndframe{}{}% + }#1\@nnil +} + +\def\adjbox@rndframe#1#2#3\@nnil{% + \rndfbox[{#1,#2}]{#3}% +} +% \end{macrocode} +% \end{key} +% % % \begin{key}{adjbox}{Clip*} % \begin{macrocode} @@ -2177,6 +2915,100 @@ % \end{key} % % +% \begin{macrocode} +\adjbox@copy@key{bbllx} +\adjbox@copy@key{bblly} +\adjbox@copy@key{bburx} +\adjbox@copy@key{bbury} +\adjbox@copy@key{decodearray} +\adjbox@copy@key{intent} +\adjbox@copy@key{interpolate} +\adjbox@copy@key{maskarray} +\adjbox@copy@key{natheight} +\adjbox@copy@key{natwidth} +\adjbox@copy@key{ocobjnum} +\adjbox@copy@key{ocobjref} +\adjbox@copy@key{page} +\adjbox@copy@key{pagebox} +\adjbox@copy@key{print} +\adjbox@copy@key{quiet} +\adjbox@copy@key{resetcolor} +\adjbox@copy@key{resolution} +\adjbox@copy@key{xmpfile} +% \end{macrocode} +% +% +% ^^A ))) +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Round corners} ^^A ((( +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{macro}{\rndcornersbox} +% \begin{macrocode} +\newcommand\rndcornersbox{% + \collectboxcheckenv{rndcornersbox}% + \rndcornersbox@ +} +\def\rndcornersbox@#1{% + \collectbox{\@trimclip\@clipcornersofbox{#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rndframebox} +% \begin{macrocode} +\newcommand\rndframebox{% + \collectboxcheckenv{rndframebox}% + \rndframebox@ +} +\newcommand*\rndframebox@[2][]{% + \collectbox{\@trimclip{\rndframearoundbox@{sep=\z@,#1}}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rndfbox} +% \begin{macrocode} +\newcommand\rndfbox{% + \collectboxcheckenv{rndfbox}% + \rndfbox@ +} +\newcommand*\rndfbox@[2][]{% + \collectbox{\@trimclip{\rndframearoundbox@{#1}}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\rndframearoundbox@} +% \begin{macrocode} +\def\rndframearoundbox@#1{% + \setkeys{adjbox@rndframe}{#1}% + \@rndframearoundbox +} +\define@key{adjbox@rndframe}{width}{% + \adjsetlength\fboxrule{#1}% +} +\define@key{adjbox@rndframe}{sep}{% + \adjsetlength\fboxsep{#1}% +} +\define@key{adjbox@rndframe}{color}{% + \def\adjbox@rndframe@color{\color{#1}}% +} +\define@key{adjbox@rndframe}{color*}{% + \def\adjbox@rndframe@color{#1}% +} +\let\adjbox@rndframe@color\relax +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +% \DescribeKey{color}'='{<color>} +% \DescribeKey{color*}'='{<color command>} +% \DescribeKey{width}'='{<rule width>} +% \DescribeKey{sep}'='{<rule separation>} +% \end{macrocode} % % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2288,7 +3120,8 @@ % \begin{macro}{\centerbox} % \begin{macrocode} \newcommand\centerbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{centerbox}% + \noindent \adjbox@halign{#1}\hss\hss } % \end{macrocode} @@ -2298,7 +3131,8 @@ % \begin{macro}{\leftalignbox} % \begin{macrocode} \newcommand\leftalignbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{leftalignbox}% + \noindent \adjbox@halign{#1}\relax\hss } % \end{macrocode} @@ -2308,7 +3142,8 @@ % \begin{macro}{\rightalignbox} % \begin{macrocode} \newcommand\rightalignbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{rightalignbox}% + \noindent \adjbox@halign{#1}\hss\relax } % \end{macrocode} @@ -2337,7 +3172,7 @@ % \begin{macrocode} \newcommand\outersidebox[1][\linewidth]{% \collectboxcheckenv{outersidebox}% - \adjustbox@noindent + \noindent \adjbox@halign{#1}{% \checkoddpage \ifoddpageoroneside @@ -2361,7 +3196,7 @@ % \begin{macrocode} \newcommand\innersidebox[1][\linewidth]{% \collectboxcheckenv{innersidebox}% - \adjustbox@noindent + \noindent \adjbox@halign{#1}{% \checkoddpage \ifoddpageoroneside @@ -2802,6 +3637,12 @@ \newcommand*\@minmaxsizebox[4]{% \edef\@tempa{#3}% \edef\@tempb{#4}% + \ifx\@tempa\Gin@exclamation\else + \adjsetlength\@tempdima{#3}% + \fi + \ifx\@tempb\Gin@exclamation\else + \adjsetlength\@tempdimb{#4}% + \fi \ifcase0% % \end{macrocode} % Do nothing if both values are `|!|', otherwise use case 1 if the height is to large/small (|#1|) @@ -2810,7 +3651,7 @@ \ifx\@tempa\Gin@exclamation \ifx\@tempb\Gin@exclamation \else - \ifdim\@tempb#1#2% + \ifdim\@tempdimb#1#2% 1% \fi \fi @@ -2819,7 +3660,7 @@ % If the width is given, but not the height, use case 2 if the width is to large/small (|#1|) than the native \Macro\width. % \begin{macrocode} \ifx\@tempb\Gin@exclamation - \ifdim\@tempa#1\width + \ifdim\@tempdima#1\width 2% \fi \else @@ -2827,14 +3668,14 @@ % If both values are given. % Use case 0-3 depending if the width and/or height is to large/small. % \begin{macrocode} - \ifdim\@tempa#1\width - \ifdim\@tempb#1#2% + \ifdim\@tempdima#1\width + \ifdim\@tempdimb#1#2% 3% \else 2% \fi \else - \ifdim\@tempb#1#2% + \ifdim\@tempdimb#1#2% 1% \fi \fi @@ -2849,14 +3690,12 @@ % Case 1: height needs scaling. Calculate factor and scale the content with it. % \begin{macrocode} \or - \adjsetlength\@tempdima\@tempb - \Gscale@div\@tempa\@tempdima#2% + \Gscale@div\@tempa\@tempdimb#2% \Gscale@box\@tempa[\@tempa]\BOXCONTENT % \end{macrocode} % Case 2: width needs scaling. Calculate factor and scale the content with it. % \begin{macrocode} \or - \adjsetlength\@tempdima\@tempa \Gscale@div\@tempa\@tempdima\width \Gscale@box\@tempa[\@tempa]\BOXCONTENT % \end{macrocode} @@ -2864,10 +3703,8 @@ % Both scale factors are calculated and the more extreme value is used. % \begin{macrocode} \or - \adjsetlength\@tempdima\@tempa \Gscale@div\@tempa\@tempdima\width - \adjsetlength\@tempdima\@tempb - \Gscale@div\@tempb\@tempdima#2% + \Gscale@div\@tempb\@tempdimb#2% \ifdim\@tempa\p@#1\@tempb\p@ \let\@tempb\@tempa \else @@ -3166,6 +4003,91 @@ % \subsection{Background keys and macros} ^^A ((( % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% \begin{key}{ADJBOX}{color} +% Sets the foreground color, i.e.\ the color used for the content. +% |#1| are the argument to color, i.e. either \MacroArgs<color> +% or \MacroArgs{<model>}{<color>}. +% \begin{macrocode} +\define@key{ADJBOX}{color}{% + \adjbox@checkcolor + \@ifnextchar\bgroup{% + \adjbox@color + }{% + \adjbox@color{}{#1}% + }#1\@nnil +} +% \end{macrocode} +% \end{key} +% +% \begin{macro}{\adjbox@color} +% Check for the optional color argument. +% \begin{macrocode} +\def\adjbox@color#1#2#3\@nnil{% + \ifx\@nnil#1\@nnil + \color{#2}% + \else + \color[{#1}]{#2}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{key}{ADJBOX}{color*} +% Sets the color using a given color command. +% \begin{macrocode} +\define@key{ADJBOX}{color*}{% + #1% +} +% \end{macrocode} +% \end{key} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{key}{adjbox}{fgcolor} +% Changes the foreground color. +% |#1| are the argument to color, i.e. either \MacroArgs<color> +% or \MacroArgs{<model>}{<color>}. +% \begin{macrocode} +\define@key{ADJBOX}{fgcolor}{% + \adjbox@checkcolor + \@ifnextchar\bgroup{% + \adjbox@fgcolor + }{% + \adjbox@fgcolor{}{#1}% + }#1\@nnil +} +% \end{macrocode} +% \end{key} +% +% \begin{macro}{\adjbox@fgcolor} +% Parses the two possible arguments and adds the color macro +% to the token register. +% \begin{macrocode} +\def\adjbox@fgcolor#1#2#3\@nnil{% + \ifx\@nnil#1\@nnil + \adjbox@innercode{\color{#2}}{}% + \else + \adjbox@innercode{\color[{#1}]{#2}}{}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{key}{adjbox}{fgcolor*} +% Adds a colored box in the background. It awaits a direct color macro, +% which gives the user more flexibility. +% \begin{macrocode} +\define@key{ADJBOX}{fgcolor*}{% + \adjbox@checkcolor + \adjbox@innercode{#1}{}% +} +% \end{macrocode} +% \end{key} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % \begin{key}{adjbox}{bgcolor} % Adds a colored box in the background. % |#1| are the argument to color, i.e. either \MacroArgs<color> @@ -3189,9 +4111,9 @@ % \begin{macrocode} \def\adjbox@bgcolor#1#2#3\@nnil{% \ifx\@nnil#1\@nnil - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color{#2}}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}% \else - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}% \fi } % \end{macrocode} @@ -3204,13 +4126,13 @@ % \begin{macrocode} \define@key\adjbox@fam{bgcolor*}{% \adjbox@checkcolor - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{#1}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{#1}}}% } % \end{macrocode} % \end{key} % % -% \begin{macro}{\adjbox@@bgcolor} +% \begin{macro}{\@bgcolorbox} % This places a colored box (vrule) with the same dimensions than % the content, then compensates for the horizontal shift and places % the content. This is simpler and more direct than using \Macro\rlap @@ -3218,8 +4140,9 @@ % % The argument contains the color macro, e.g.\ \Macro\color{<color>}. % \begin{macrocode} -\def\adjbox@@bgcolor#1{% - \mbox{% +\def\@bgcolorbox#1{% + \leavevmode + \hbox{% \hbox{% #1% \vrule\@width\width\@height\height\@depth\depth% @@ -3232,35 +4155,145 @@ % \end{macro} % % +% \begin{macro}{\bgcolorbox} +% \begin{macrocode} +\expandafter\newcommand\expandafter\bgcolorbox\expandafter{% + \expandafter + \@ifstar + \csname bgcolorbox*\endcsname + \bgcolorbox@ +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\bgcolorbox@} +% \begin{macrocode} +\newcommand\bgcolorbox@[2][\@nnil]{% + \collectboxcheckenv{bgcolorbox}% + \ifx\@nnil#1\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\@collectbox{\@bgcolorbox{\color{#2}}}}% + {\@collectbox{\@bgcolorbox{\color[#1]{#2}}}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{bgcolorbox*} +% \begin{macrocode} +\@namedef{bgcolorbox*}#1{% + \collectboxcheckenv{bgcolorbox*}% + \@collectbox{\@bgcolorbox{#1}}% +} +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{macro}{\fgimagebox} +% \begin{macrocode} +\expandafter\newcommand\expandafter\fgimagebox\expandafter{% + \expandafter + \@ifstar + \csname fgimagebox*\endcsname + \fgimagebox@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fgimagebox@} +% \begin{macrocode} +\newcommand\fgimagebox@[2][]{% + \collectboxcheckenv{fgimagebox}% + \@collectbox{\@foregroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{fgimagebox*} +% \begin{macrocode} +\expandafter\newcommand\csname fgimagebox*\endcsname[2][]{% + \collectboxcheckenv{fgimagebox*}% + \@collectbox{\@foregroundbox\adjustimage{#1}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{key}{adjbox}{fgimage} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{fgimage}{% + \@ifnextchar\bgroup{% + \adjbox@fgimage + }{% + \adjbox@fgimage{}{#1}% + }#1{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}% +} +% \end{macrocode} +% \end{key} +% +% \begin{key}{adjbox}{fgimage*} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{fgimage*}{% + \@ifnextchar\bgroup{% + \adjbox@fgimage + }{% + \adjbox@fgimage{}{#1}% + }#1{}\@nnil{}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{macro}{\adjbox@fgimage} +% \begin{macrocode} +\def\adjbox@fgimage#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustimage{#1#4}{#2}}}% +} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % \begin{macro}{\bgimagebox} % \begin{macrocode} -\newcommand*\bgimagebox[2][]{% - \collectboxcheckenv{bgimagebox}% - \@collectbox{\@bgimagebox{#1}{#2}}% +\expandafter\newcommand\expandafter\bgimagebox\expandafter{% + \expandafter + \@ifstar + \csname bgimagebox*\endcsname + \bgimagebox@ } % \end{macrocode} % \end{macro} % +% \begin{macro}{\bgimagebox@} +% \begin{macrocode} +\newcommand\bgimagebox@[2][]{% + \collectboxcheckenv{bgimagebox}% + \@collectbox{\@backgroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\@bgimagebox} +% \begin{macro}{bgimagebox*} % \begin{macrocode} -\def\@bgimagebox#1#2{% - \mbox{% - \lower\depth\hbox{% - \edef\@tempa{\noexpand\adjustimage - {#1,width=\the\width,totalheight=\the\totalheight}% - {#2}% - }% - \@tempa - }% - \hskip-\width% - \BOXCONTENT - }% +\expandafter\newcommand\csname bgimagebox*\endcsname[2][]{% + \collectboxcheckenv{bgimagebox*}% + \@collectbox{\@backgroundbox\adjustimage{#1}{#2}}% } % \end{macrocode} % \end{macro} % % +% % \begin{key}{adjbox}{bgimage} % One or two arguments, the first optional one are further \Macro\includegraphics keys. % \begin{macrocode} @@ -3269,7 +4302,21 @@ \adjbox@bgimage }{% \adjbox@bgimage{}{#1}% - }#1\@nnil + }#1{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}% +} +% \end{macrocode} +% \end{key} +% +% \begin{key}{adjbox}{bgimage*} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{bgimage*}{% + \@ifnextchar\bgroup{% + \adjbox@bgimage + }{% + \adjbox@bgimage{}{#1}% + }#1{}\@nnil{}% } % \end{macrocode} % \end{key} @@ -3277,8 +4324,177 @@ % % \begin{macro}{\adjbox@bgimage} % \begin{macrocode} -\def\adjbox@bgimage#1#2#3\@nnil{% - \adjbox@Gin@add{\@Collectbox{\@bgimagebox{#1}{#2}}}% +\def\adjbox@bgimage#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustimage{#1#4}{#2}}}% +} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{key}{adjbox}{foreground} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{foreground}{% + \@ifnextchar\bgroup{% + \adjbox@foreground + }{% + \adjbox@foreground{}{#1}% + }#1{}{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{foreground*} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{foreground*}{% + \@ifnextchar\bgroup{% + \adjbox@foreground + }{% + \adjbox@foreground{}{#1}% + }#1{}{}\@nnil{}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{macro}{\adjbox@foreground} +% \begin{macrocode} +\def\adjbox@foreground#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustbox{#1#4}{#2}}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@foregroundbox} +% \begin{macrocode} +\def\@foregroundbox#1#2#3{% + \leavevmode + \hbox to \width{% + \BOXCONTENT + \hskip-\width + \hss + \adjbox@parentdims + #1{#2}{#3}% + \hss + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\foregroundbox} +% \begin{macrocode} +\expandafter\newcommand\expandafter\foregroundbox\expandafter{% + \expandafter + \@ifstar + \csname foregroundbox*\endcsname + \foregroundbox@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\foregroundbox@} +% \begin{macrocode} +\newcommand\foregroundbox@[2][]{% + \collectboxcheckenv{foregroundbox}% + \@collectbox{\@foregroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{foregroundbox*} +% \begin{macrocode} +\expandafter\newcommand\csname foregroundbox*\endcsname[2][]{% + \collectboxcheckenv{foregroundbox*}% + \@collectbox{\@foregroundbox\adjustbox{#1}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{key}{adjbox}{background} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{background}{% + \@ifnextchar\bgroup{% + \adjbox@background + }{% + \adjbox@background{}{#1}% + }#1{}{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}% +} +% \end{macrocode} +% \end{key} +% +% \begin{key}{adjbox}{background*} +% One or two arguments, the first optional one are further \Macro\includegraphics keys. +% \begin{macrocode} +\define@key{adjbox}{background*}{% + \@ifnextchar\bgroup{% + \adjbox@background + }{% + \adjbox@background{}{#1}% + }#1{}{}\@nnil{}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{macro}{\adjbox@background} +% \begin{macrocode} +\def\adjbox@background#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustbox{#1#4}{#2}}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@backgroundbox} +% \begin{macrocode} +\def\@backgroundbox#1#2#3{% + \leavevmode + \hbox to \width{% + \hss + \adjbox@parentdims + #1{#2}{#3}% + \hss + \hskip-\width% + \BOXCONTENT + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\backgroundbox} +% \begin{macrocode} +\expandafter\newcommand\expandafter\backgroundbox\expandafter{% + \expandafter + \@ifstar + \csname backgroundbox*\endcsname + \backgroundbox@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\backgroundbox@} +% \begin{macrocode} +\newcommand\backgroundbox@[2][]{% + \collectboxcheckenv{backgroundbox}% + \@collectbox{\@backgroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{backgroundbox*} +% \begin{macrocode} +\expandafter\newcommand\csname backgroundbox*\endcsname[2][]{% + \collectboxcheckenv{backgroundbox*}% + \@collectbox{\@backgroundbox\adjustbox{#1}{#2}}% } % \end{macrocode} % \end{macro} @@ -3414,7 +4630,9 @@ % The \Macro\setlength macro is change temporary for the \env{minipage} or \env{varwidth} environment. % \begin{macrocode} \def\adjbox@@page#1#2\@nnil{% - \def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{#1}#2\adjbox@reset}{##1}{\end{#1}}}% + \adjbox@innercode + {\adjbox@set\begin{#1}#2\adjbox@reset\ignorespaces}% + {\end{#1}}% } % \end{macrocode} % \end{macro} @@ -3473,7 +4691,7 @@ % \begin{macrocode} \def\@@stackbox#1#2[#3]{% \collectbox@ - {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3} + {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3\ignorespaces} \BOXCONTENT {\end{varwidth}}% } @@ -3526,11 +4744,12 @@ % \begin{macro}{\adjbox@@stack} % \begin{macrocode} \def\adjbox@@stack#1#2#3{% - \def\adjbox@collectbox##1{% - \collectbox@{% - \begin{varwidth}[#2]{\linewidth}% - \csname adjbox@halign@#1\endcsname#3% - }{##1}{\end{varwidth}}% + \adjbox@innercode{% + \begin{varwidth}[#2]{\linewidth}% + \csname adjbox@halign@#1\endcsname#3% + \ignorespaces + }{% + \end{varwidth}% }% } % \end{macrocode} @@ -3578,8 +4797,9 @@ \ifcollectboxenv \adjbox@innerenv{#1}{#2}\@nnil \else - \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{}{##1}{}}% + \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{\adjbox@begininnercode}{##1}{\adjbox@endinnercode}}% \fi + \chardef\adjbox@innerlevel\tw@ } % \end{macrocode} % \end{macro} @@ -3614,8 +4834,9 @@ \ifcollectboxenv \adjbox@innercode{\(\begin{array}#1}{\end{array}\)}% \else - \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\(}{##1}{\)}}% + \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\adjbox@begininnercode\(}{##1}{\)\adjbox@endinnercode}}% \fi + \chardef\adjbox@innerlevel\tw@ } % \end{macrocode} % \end{macro} @@ -3638,13 +4859,16 @@ \remove@to@nnil }#1\@nnil } +\adjbox@let@key{ADJBOX}{inner env}{innerenv} % \end{macrocode} % \end{key} % % \begin{macro}{\adjbox@innerenv} % \begin{macrocode} \def\adjbox@innerenv#1#2\@nnil{% - \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}% + \adjbox@innercode + {\begin{#1}#2}% + {\end{#1}}% }% % \end{macrocode} % \end{macro} @@ -3674,20 +4898,43 @@ % \begin{macrocode} \define@key{ADJBOX}{innercode}{% \adjbox@innercode#1{}{}% -} +}% +\adjbox@let@key{ADJBOX}{inner code}{innercode} % \end{macrocode} -% \end{key} +% \end{macro} % % % \begin{macro}{\adjbox@innercode} % \begin{macrocode} -\def\adjbox@innercode#1#2{% - \def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}% +\def\adjbox@innercode{% + \ifcase\adjbox@innerlevel + \relax% 0: first inner code + \def\adjbox@collectbox##1{\collectbox@{\adjbox@begininnercode\adjustbox@ignorespaces}{##1}{\adjustbox@unskip\adjbox@endinnercode}}% + \chardef\adjbox@innerlevel\@ne + \expandafter\adjbox@@innercode + \or% 1 append inner code, no inner env + \expandafter\adjbox@@innercode + \else% 2 inner tabular exists, create warning and ignore content. + \PackageWarning{adjustbox}{Further inner code or environment ignored\MessageBreak after "tabular"-like key}% + \expandafter\@gobbletwo + \fi }% % \end{macrocode} % \end{macro} % % +% \begin{macro}{\adjbox@@innercode} +% \begin{macrocode} +\long\def\adjbox@@innercode#1#2{% + \@temptokena\expandafter{\adjbox@begininnercode#1}% + \edef\adjbox@begininnercode{\the\@temptokena}% + \@temptokena{#2}% + \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox@endinnercode}% + \edef\adjbox@endinnercode{\the\@temptokena}% +} +% \end{macrocode} +% \end{macro} +% % % % ^^A ))) @@ -3795,6 +5042,8 @@ % \begin{macro}{\adjbox@addfloat} % \begin{macrocode} \def\adjbox@addfloat#1#2#3#4{% + \Gin@esetsize + \@tempswatrue \ifnum\adjbox@caption@pos>10 \chardef\adjbox@caption@pos=0\csname adjbox@caption@#1@pos\endcsname\relax \fi diff --git a/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx index a1a6ad7cb37..31dd9eb99b8 100644 --- a/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx +++ b/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %<=*COPYRIGHT> -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -26,10 +26,10 @@ %<*driver> \ProvidesFile{trimclip.dtx}[% %<=*DATE> - 2012/05/16 + 2018/04/08 %<=/DATE> %<=*VERSION> - v1.0 + v1.1 %<=/VERSION> DTX file for the trimclip package] \documentclass[a4paper]{ydoc}[2011/11/16] @@ -179,6 +179,7 @@ % % % \changes{v1.0}{2012/05/16}{First version after extraction from \pkg{adjustbox} package.} +% \changes{v1.1}{2018/04/08}{Driver support for round corner clipping.} % % \GetFileInfo{trimclip.dtx} % @@ -533,7 +534,7 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{macrocode} \def\tc@driver{tc-\Gin@driver} -\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}} +\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\AtEndOfPackage{\RequirePackage{pgf}}} \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}} @@ -907,6 +908,7 @@ % \end{macro} % % +% % \begin{macro}{\@clipvpbox} % Clips the box using the given trim amounts. % For this the box is first trimmed and then clipped to its official size using a driver dependent macro. @@ -926,6 +928,16 @@ % The clipping support is output driver dependent. The driver selected by \pkg{graphics} is used and a definition file % is used if its exists. Otherwise either the default \texttt{pdftex} implementation or the \pkg{pgf} fall-back driver % is used. +% +% +% +% \begin{macro}{\tc@bezfacn} +% The Bezier factor required to draw rounded corners in same drivers. +% \begin{macrocode} +\def\tc@bezfacn{0.44771525}% +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \InputIfFileExists{\tc@driver}{% {\let\on@line\@gobble @@ -950,7 +962,7 @@ % \fi % \begin{macrocode} %<!COPYRIGHT> -\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF] +\ProvidesFile{tc-pgf.def}[2018/04/08 v2.1 trimclip fall-back clipping driver using PGF] % \end{macrocode} % % \begin{macrocode} @@ -976,6 +988,60 @@ % \end{macrocode} % \end{macro} % +% +% \begin{macro}{\@clipcornersofbox} +% Clips round corners off. +% \begin{macrocode} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1\hbox{\begin{pgfpicture}% + \pgfpathmoveto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpatharc{180}{90}{#2}% + \pgfpathlineto{\pgfpoint{\wd#1-#3}{\ht#1}}% + \pgfpatharc{90}{0}{#3}% + \pgfpathlineto{\pgfpoint{\wd#1}{#4-\dp#1}}% + \pgfpatharc{0}{-90}{#4}% + \pgfpathlineto{\pgfpoint{#5}{-\dp#1}}% + \pgfpatharc{270}{180}{#5}% + \pgfpathlineto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpathclose + \pgfusepathqclip + \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% + \pgfnode{rectangle}{base west}{\usebox#1}{}{}% + \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% + \end{pgfpicture}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@rndframearoundbox} +% Round frame around a box. +% \begin{macrocode} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1\hbox{\begin{pgfpicture}% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% + \pgfnode{rectangle}{base west}{\usebox#1}{}{}% + \pgfusepath{}% + \adjbox@rndframe@color + \pgfpathmoveto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpatharc{180}{90}{#2}% + \pgfpathlineto{\pgfpoint{\wd#1-#3}{\ht#1}}% + \pgfpatharc{90}{0}{#3}% + \pgfpathlineto{\pgfpoint{\wd#1}{#4-\dp#1}}% + \pgfpatharc{0}{-90}{#4}% + \pgfpathlineto{\pgfpoint{#5}{-\dp#1}}% + \pgfpatharc{270}{180}{#5}% + \pgfpathlineto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpathclose + \pgfusepath{stroke}% + \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% + \end{pgfpicture}}% +} +% \end{macrocode} +% \end{macro} +% %^^A vim: ft=tex % \iffalse %</tc-pgf.def> @@ -987,7 +1053,7 @@ % \fi % \begin{macrocode} %<!COPYRIGHT> -\ProvidesFile{tc-pdftex.def}[2012/05/13 v1.0 Clipping driver for pdftex] +\ProvidesFile{tc-pdftex.def}[2018/04/08 v2.1 Clipping driver for pdftex] % \end{macrocode} % % \begin{macro}{\@cliptoboxdim} @@ -998,23 +1064,123 @@ % \begin{macrocode} \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}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \pdfsave + \pdfliteral direct {% + 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n + }% + \hbox to 0pt{\copy#1\hss}% + \pdfrestore + \hskip\wd#1 + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@clip@bpdimens} +% \begin{macrocode} +\def\@clip@bpdimens#1#2#3#4#5{% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \adjcalc@settobp\HEIGHT{\ht#1}% + \adjcalc@settobp\DEPTH{-\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLb{\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTL{\ht#1-#2}% + \adjcalc@settobp\HEIGHTmRADIUSTLb{\ht#1-\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTR{\ht#1-#3}% + \adjcalc@settobp\HEIGHTmRADIUSTRb{\ht#1-\tc@bezfacn#3}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\WIDTHmRADIUSTRb{\wd#1-\tc@bezfacn#3}% + \adjcalc@settobp\RADIUSBRmDEPTH{#4-\dp#1}% + \adjcalc@settobp\RADIUSBRmDEPTHb{\tc@bezfacn#4-\dp#1}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBRb{\wd#1-\tc@bezfacn#4}% + \adjcalc@settobp\RADIUSBLmDEPTH{#5-\dp#1}% + \adjcalc@settobp\RADIUSBLmDEPTHb{\tc@bezfacn#5-\dp#1}% + \adjcalc@settobp\RADIUSBLb{\tc@bezfacn#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@clip@roundedbox@pdfcode} +% \begin{macrocode} +\def\@clip@roundedboxpath@pdfcode{% + 0 \HEIGHTmRADIUSTL m + 0 \HEIGHTmRADIUSTLb \RADIUSTLb \HEIGHT \RADIUSTL \HEIGHT c + \WIDTHmRADIUSTR \HEIGHT l + \WIDTHmRADIUSTRb \HEIGHT \WIDTH \HEIGHTmRADIUSTRb \WIDTH \HEIGHTmRADIUSTR c + \WIDTH \RADIUSBRmDEPTH l + \WIDTH \RADIUSBRmDEPTHb \WIDTHmRADIUSBRb \DEPTH \WIDTHmRADIUSBR \DEPTH c + \RADIUSBL \DEPTH l + \RADIUSBLb \DEPTH 0 \RADIUSBLmDEPTHb 0 \RADIUSBLmDEPTH c + 0 \RADIUSBLmDEPTH l +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@clipcornersofbox} +% Clips round corners off. +% \begin{macrocode} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + \pdfsave + \pdfliteral direct {% + \@clip@roundedboxpath@pdfcode + h W n + }% + \hbox to 0pt{\copy#1\hss}% + \pdfrestore + \hskip\wd#1% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@rndframearoundbox} +% Round frame around a box. +% \begin{macrocode} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + % + \hbox to 0pt{\copy#1\hss}% \pdfsave + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color \pdfliteral direct {% - 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n + \LINEWIDTH w + \@clip@roundedboxpath@pdfcode + h s }% - \hbox to 0pt{\copy#1\hss}% + \color@endgroup + }% \pdfrestore - \hskip \wd#1 + \hskip\wd#1% }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% } % \end{macrocode} % \end{macro} % +% %^^A vim: ft=tex % \iffalse %</tc-pdftex.def> @@ -1026,7 +1192,7 @@ % \fi % \begin{macrocode} %<!COPYRIGHT> -\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips] +\ProvidesFile{tc-dvips.def}[2018/04/08 v2.1 Clipping driver for dvips] % \end{macrocode} % % \begin{macro}{\@cliptoboxdim}[1]{box register to clip} @@ -1038,10 +1204,9 @@ % \begin{macrocode} \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}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% \special{% ps: /mtrxc matrix currentmatrix def @@ -1054,9 +1219,128 @@ newpath mtrxc setmatrix }% - \box#1% + \hbox to 0pt{\copy#1\hss}% \special{ps: grestore }% + \hskip\wd#1% + }% +} +% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@clipcornersofbox} +% Clips round corners off. +% \begin{macrocode} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjcalc@settobp\DEPTHmRADIUSBL\@tempdima + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% + \adjcalc@settobp\HEIGHT{-\ht#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}% + \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}% + \special{% + ps: + /mtrxc matrix currentmatrix def + currentpoint gsave + translate + Resolution 72 div VResolution 72 div + scale + newpath + %0 \DEPTH neg translate + %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip + 0 \RADIUSTLmHEIGHT\space moveto + \RADIUSTL\space \RADIUSTLmHEIGHT\space \RADIUSTL\space 180 -90 arc + \WIDTHmRADIUSTR\space \HEIGHT\space lineto + \WIDTHmRADIUSTR\space \RADIUSTRmHEIGHT\space \RADIUSTR\space -90 0 arc + \WIDTH\space \DEPTHmRADIUSBR\space lineto + \WIDTHmRADIUSBR\space \DEPTHmRADIUSBR\space \RADIUSBR\space 0 90 arc + \RADIUSBL\space \DEPTH\space lineto + \RADIUSBL\space \DEPTHmRADIUSBL\space \RADIUSBL\space -270 -180 arc + closepath + %gsave 0.5 0 0 setrgbcolor stroke grestore + clip + newpath + mtrxc setmatrix + }% + \hbox to 0pt{\copy#1\hss}% + \special{ps: grestore }% + \hskip \wd#1% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@rndframearoundbox} +% Clips round corners off. +% \begin{macrocode} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% + \adjcalc@settobp\HEIGHT{-\ht#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}% + \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% + % + \hbox to 0pt{\copy#1\hss}% + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color + \special{% + ps: + /mtrxc matrix currentmatrix def + currentpoint gsave + translate + Resolution 72 div VResolution 72 div + scale + newpath + %0 \DEPTH neg translate + %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip + 0 \RADIUSTLmHEIGHT moveto + \RADIUSTL \RADIUSTLmHEIGHT \RADIUSTL 180 -90 arc + \WIDTHmRADIUSTR \HEIGHT lineto + \WIDTHmRADIUSTR \RADIUSTRmHEIGHT \RADIUSTR -90 0 arc + \WIDTH \DEPTHmRADIUSBR lineto + \WIDTHmRADIUSBR \DEPTHmRADIUSBR \RADIUSBR 0 90 arc + \RADIUSBL \DEPTH lineto + \RADIUSBL \DEPTHmRADIUSBL \RADIUSBL -270 -180 arc + closepath + \LINEWIDTH setlinewidth + stroke + newpath + mtrxc setmatrix + grestore + }% + \color@endgroup + }% + \hskip \wd#1% }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% } % \end{macrocode} % \end{macro} @@ -1072,7 +1356,7 @@ % \fi % \begin{macrocode} %<!COPYRIGHT> -\ProvidesFile{tc-xetex.def}[2012/05/13 v1.0 Clipping driver for xetex] +\ProvidesFile{tc-xetex.def}[2018/04/08 v2.1 Clipping driver for xetex] % \end{macrocode} % % \begin{macro}{\@cliptoboxdim} @@ -1084,21 +1368,128 @@ % \begin{macrocode} \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 + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \special{pdf:content q }% + \special{pdf:code 0 -\DEPTH \WIDTH \TOTALHEIGHT re W 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 }% + \hbox to 0 pt{\copy#1\hss}% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \hskip\wd#1% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@clip@bpdimens} +% \begin{macrocode} +\def\@clip@bpdimens#1#2#3#4#5{% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \adjcalc@settobp\HEIGHT{\ht#1}% + \adjcalc@settobp\DEPTH{-\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLb{\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTL{\ht#1-#2}% + \adjcalc@settobp\HEIGHTmRADIUSTLb{\ht#1-\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTR{\ht#1-#3}% + \adjcalc@settobp\HEIGHTmRADIUSTRb{\ht#1-\tc@bezfacn#3}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\WIDTHmRADIUSTRb{\wd#1-\tc@bezfacn#3}% + \adjcalc@settobp\RADIUSBRmDEPTH{#4-\dp#1}% + \adjcalc@settobp\RADIUSBRmDEPTHb{\tc@bezfacn#4-\dp#1}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBRb{\wd#1-\tc@bezfacn#4}% + \adjcalc@settobp\RADIUSBLmDEPTH{#5-\dp#1}% + \adjcalc@settobp\RADIUSBLmDEPTHb{\tc@bezfacn#5-\dp#1}% + \adjcalc@settobp\RADIUSBLb{\tc@bezfacn#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@clip@roundedbox@pdfcode} +% \begin{macrocode} +\def\@clip@roundedboxpath@pdfcode{% + 0 \HEIGHTmRADIUSTL m + 0 \HEIGHTmRADIUSTLb \RADIUSTLb \HEIGHT \RADIUSTL \HEIGHT c + \WIDTHmRADIUSTR \HEIGHT l + \WIDTHmRADIUSTRb \HEIGHT \WIDTH \HEIGHTmRADIUSTRb \WIDTH \HEIGHTmRADIUSTR c + \WIDTH \RADIUSBRmDEPTH l + \WIDTH \RADIUSBRmDEPTHb \WIDTHmRADIUSBRb \DEPTH \WIDTHmRADIUSBR \DEPTH c + \RADIUSBL \DEPTH l + \RADIUSBLb \DEPTH 0 \RADIUSBLmDEPTHb 0 \RADIUSBLmDEPTH c + 0 \RADIUSBLmDEPTH l +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@clipcornersofbox} +% Clips round corners off. +% \begin{macrocode} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + \special{pdf:content q }% + \special{pdf:literal direct + \@clip@roundedboxpath@pdfcode + h W 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 }% + \hbox to 0pt{\copy#1\hss}% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \hskip\wd#1% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\@rndframearoundbox} +% Round frame around a box. +% \begin{macrocode} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + % + \hbox to 0pt{\copy#1\hss}% + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color + \special{pdf:content q }% + \special{pdf:literal direct + \LINEWIDTH w + \@clip@roundedboxpath@pdfcode + h s + }% + \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 }% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \color@endgroup }% - \special{pdf:literal direct W }% - \special{pdf:literal direct n }% - \box#1% - \special{pdf:econtent }% + \hskip\wd#1% }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty index 98c05a8e6ed..cd219dbb5c2 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -143,6 +143,13 @@ }% \let\adjsetlengthdefault\adjsetlengthdefault@ } +\def\adjcalc@settobp#1#2{% + \begingroup + \adjsetlength\@tempdima{#2}% + \@tempdima=0.99626\@tempdima + \edef\@tempa{\endgroup\def\noexpand#1{\strip@pt\@tempdima\space}}% + \@tempa +}% \def\adjcalc@overwrite{% \let\setlength\adjsetlength \let\addtolength\adjaddtolength diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty index b07f7d9c530..999d602fd1a 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-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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}[% - 2012/05/21 - v1.0 + 2018/04/08 + v1.1 Adjusting TeX boxes (trim, clip, ...)] \RequirePackage{xkeyval} \RequirePackage{adjcalc} @@ -85,23 +85,33 @@ \fi } \let\adjbox@keysafter\@empty -\newcommand\adjustbox[1]{% +\newcommand\adjustbox{% \begingroup + \collectboxcheckenv{adjustbox}% + \@adjustbox +} +\long\def\@adjustbox#1{% \edef\adjbox@line{\the\inputlineno}% \let\collectbox@mode\relax \let\collectbox@noindent\relax - \collectboxcheckenv{adjustbox}% - \ifcollectboxenv\else + \let\adjbox@collectbox\@collectbox + \let\adjbox@begininnercode\@empty + \let\adjbox@endinnercode\@empty + \chardef\adjbox@innerlevel\z@ + \ifcollectboxenv + \let\adjustbox@noindent\noindent + \let\adjustbox@unskip\unskip + \let\adjustbox@ignorespaces\ignorespaces + \else \let\adjustbox@noindent\relax + \let\adjustbox@unskip\relax + \let\adjustbox@ignorespaces\relax \fi - \begingroup + \let\XKV@checksanitizea\adjbox@kvsanitize \adjbox@setkeys{#1}% - \expandafter\expandafter\expandafter - \endgroup \expandafter \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}% } -\def\adjbox@collectbox{\@collectbox} \def\adjbox@setkeys@ba{% \expandafter\expandafter \expandafter\adjbox@@setkeys@ba @@ -115,7 +125,6 @@ \def\adjbox@setkeys{% \setkeys*{ADJBOX}% } -\let\adjustbox@noindent\noindent \def\adjustbox@#1{% \adjbox@Width\width \adjbox@Height\height @@ -136,13 +145,113 @@ \the\toks@ \endgroup } +\begingroup +\catcode`\, 3 +\catcode`\= 3 +\gdef\adjbox@comma@iii{,}% +\gdef\adjbox@equal@iii{=}% +\catcode`\, 4 +\catcode`\= 4 +\gdef\adjbox@comma@iv{,}% +\gdef\adjbox@equal@iv{=}% +\catcode`\, 7 +\catcode`\= 7 +\gdef\adjbox@comma@vii{,}% +\gdef\adjbox@equal@vii{=}% +\catcode`\, 8 +\catcode`\= 8 +\gdef\adjbox@comma@viii{,}% +\gdef\adjbox@equal@viii{=}% +\catcode`\, 10 +\catcode`\= 10 +\gdef\adjbox@comma@x{,}% +\gdef\adjbox@equal@x{=}% +\catcode`\, 11 +\catcode`\= 11 +\gdef\adjbox@comma@xi{,}% +\gdef\adjbox@equal@xi{=}% +\catcode`\, 13 +\catcode`\= 13 +\gdef\adjbox@comma@xiii{,}% +\gdef\adjbox@equal@xiii{=}% +\catcode`\, 12 +\catcode`\= 12 +\gdef\adjbox@comma@xii{,}% +\gdef\adjbox@equal@xii{=}% +\gdef\adjbox@kvsanitize#1#2{% + \def\@tempa{\expandafter\noexpand\adjbox@comma@xiii}% + \def\@tempb{}% + \ifnum\catcode`\,=12 \else + \ifnum\catcode`\,=13 \else + \@ifundefined{adjbox@comma@\romannumeral\catcode`\,}{% + \PackageError{adjustbox} + {Invalid comma catcode \the\catcode`\,}{}% + }{}% + \edef\@tempb{\csname adjbox@comma@\romannumeral\the\catcode`\,\endcsname}% + \fi + \fi + \edef\@tempa{\@tempa\@tempb}% + \XKV@tempa@toks{#1}% + \expandafter\adjbox@replacecatcodes\expandafter,\@tempa\@nnil + \def\@tempa{\expandafter\noexpand\adjbox@equal@xiii}% + \def\@tempb{}% + \ifnum\catcode`\==12 \else + \ifnum\catcode`\==13 \else + \@ifundefined{adjbox@equal@\romannumeral\catcode`\=}{% + \PackageError{adjustbox} + {Invalid equal sign catcode \the\catcode`\=}{}% + }{}% + \def\@tempb{\@tempa\csname adjbox@equal@\romannumeral\the\catcode`\,\endcsname}% + \fi + \fi + \edef\@tempa{\@tempa\@tempb}% + \expandafter\adjbox@replacecatcodes\expandafter=\@tempa\@nnil + \edef#2{\the\XKV@tempa@toks}% +} +\gdef\adjbox@replacecatcodes#1#2{% + \ifx\@nnil#2\relax\else + \def\@tempa##1#2{% + \ifx\@nnil##1\relax\else + \XKV@tempa@toks{##1}% + \expandafter\@tempb + \fi + }% + \def\@tempb##1#2{% + \ifx\@nnil##1\relax\else + \XKV@tempa@toks\expandafter{\the\XKV@tempa@toks#1##1}% + \expandafter\@tempb + \fi + }% + \expandafter\@tempa\the\XKV@tempa@toks#2\@nnil#2\relax + \expandafter\adjbox@replacecatcodes\expandafter#1% + \fi +} +\endgroup \def\adjustbox@content{% \usebox\collectedbox } +\def\smallestside{\ifdim\width<\totalheight \width\else\totalheight\fi}% +\def\largestside{\ifdim\width>\totalheight \width\else\totalheight\fi}% +\def\Smallestside{\ifdim\Width<\Totalheight \Width\else\Totalheight\fi}% +\def\Largestside{\ifdim\Width>\Totalheight \Width\else\Totalheight\fi}% \newdimen\adjbox@Width \newdimen\adjbox@Height \newdimen\adjbox@Depth \newdimen\adjbox@Totalheight +\newdimen\adjbox@pwidth +\newdimen\adjbox@pheight +\newdimen\adjbox@pdepth +\newdimen\adjbox@ptotalheight +\def\adjbox@parentdims{% + \let\pwidth\adjbox@pwidth + \let\pheight\adjbox@pheight + \let\pdepth\adjbox@pdepth + \let\ptotalheight\adjbox@ptotalheight + \pwidth\width + \pheight\height + \pdepth\depth + \ptotalheight\totalheight +}% \def\adjbox@esetsize{% \ifcase0% \ifx\Gin@ewidth\Gin@exclamation\else 1\fi @@ -164,6 +273,103 @@ \adjustbox{#1}{\Gin@clipfalse\Gin@i{#2}}% } {\csname adjustbox@minimal\endcsname} +\newcommand*\newadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\newenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ + }% +} +\newcommand*\newadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +\newcommand*\renewadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\renewenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ + }% +} +\newcommand*\renewadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ +} +\newcommand*\provideadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ + }% +} +\def\adjustbox@provideenvironment#1{% + \@ifundefined{#1}% + {\new@environment{#1}}% + {\adjustbox@gobble@oomm}% +} +\newcommand*\adjustbox@gobble@oomm[1][]{% + \adjustbox@gobble@@oomm +} +\newcommand*\adjustbox@gobble@@oomm[3][]{% +} +\def\newadjustboxenv@#1{% + \@ifnextchar{[}% + {\@newadjustboxenv{#1}}% + {\@@@newadjustboxenv{#1}{[0]}}% +} +\def\@newadjustboxenv#1[#2]{% + \@ifnextchar{[}% + {\@@newadjustboxenv{#1}{#2}}% + {\@@@newadjustboxenv{#1}{[#2]}}% +} +\def\@@newadjustboxenv#1#2[#3]{% + \@@@newadjustboxenv{#1}{[#2][#3]}% +} +\def\@@@newadjustboxenv@#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \@collectboxisenv{#1}% + \@adjustbox{#3}% + }{% + \collectboxenvend + }% +} +\def\@@@newadjustboxenv#1#2#3{% + \expandafter + \endgroup + \expandafter + \expandafter\new@adjustbox\csname #1\endcsname#2{% + \begingroup + \collectboxcheckenv{#1}% + \@adjustbox{#3}% + }% +} +\def\@@@newadjustboxcmd#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \@adjustbox{#3}% + }% +} \def\adjbox@Gin@add#1{% \def\@tempa{#1}% \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\expandafter{\the\toks@}}% @@ -254,6 +460,14 @@ \expandafter\let\csname KV@#1@#2\expandafter\endcsname\csname KV@#1@#3\endcsname \expandafter\let\csname KV@#1@#2@default\expandafter\endcsname\csname KV@#1@#3@default\endcsname } +\def\adjbox@copy@key#1{% + \expandafter\let + \csname KV@ADJBOX@#1\expandafter\endcsname + \csname KV@Gin@#1\endcsname + \expandafter\let + \csname KV@ADJBOX@#1@default\expandafter\endcsname + \csname KV@Gin@#1@default\endcsname +} \define@key{adjbox}{viewport}{% \def\adjustbox@content{% \@trimclip{% @@ -279,11 +493,87 @@ } \define@adjboxkey{Trim}{\trimbox@{#1}}% \define@adjboxkey{Clip}{\clipbox@{#1}} +\define@adjboxkey{rndcorners}{\rndcornersbox@{#1}} +\define@adjboxkey{rndframe}{% + \@ifnextchar\bgroup{% + \adjbox@rndframe{sep=\z@}% + }{% + \adjbox@rndframe{sep=\z@}{}% + }#1\@nnil +} +\define@adjboxkey{rndfbox}{% + \@ifnextchar\bgroup{% + \adjbox@rndframe{}% + }{% + \adjbox@rndframe{}{}% + }#1\@nnil +} + +\def\adjbox@rndframe#1#2#3\@nnil{% + \rndfbox[{#1,#2}]{#3}% +} \define@adjboxkey{Clip*}{\clipbox@s{#1}} \define@adjboxkey{margin}{\marginbox@{#1}} \define@adjboxkey{margin*}{\marginbox@s{#1}} \adjbox@let@key\adjbox@fam{padding}{margin} \adjbox@let@key\adjbox@fam{padding*}{margin*} +\adjbox@copy@key{bbllx} +\adjbox@copy@key{bblly} +\adjbox@copy@key{bburx} +\adjbox@copy@key{bbury} +\adjbox@copy@key{decodearray} +\adjbox@copy@key{intent} +\adjbox@copy@key{interpolate} +\adjbox@copy@key{maskarray} +\adjbox@copy@key{natheight} +\adjbox@copy@key{natwidth} +\adjbox@copy@key{ocobjnum} +\adjbox@copy@key{ocobjref} +\adjbox@copy@key{page} +\adjbox@copy@key{pagebox} +\adjbox@copy@key{print} +\adjbox@copy@key{quiet} +\adjbox@copy@key{resetcolor} +\adjbox@copy@key{resolution} +\adjbox@copy@key{xmpfile} +\newcommand\rndcornersbox{% + \collectboxcheckenv{rndcornersbox}% + \rndcornersbox@ +} +\def\rndcornersbox@#1{% + \collectbox{\@trimclip\@clipcornersofbox{#1}}% +} +\newcommand\rndframebox{% + \collectboxcheckenv{rndframebox}% + \rndframebox@ +} +\newcommand*\rndframebox@[2][]{% + \collectbox{\@trimclip{\rndframearoundbox@{sep=\z@,#1}}{#2}}% +} +\newcommand\rndfbox{% + \collectboxcheckenv{rndfbox}% + \rndfbox@ +} +\newcommand*\rndfbox@[2][]{% + \collectbox{\@trimclip{\rndframearoundbox@{#1}}{#2}}% +} +\def\rndframearoundbox@#1{% + \setkeys{adjbox@rndframe}{#1}% + \@rndframearoundbox +} +\define@key{adjbox@rndframe}{width}{% + \adjsetlength\fboxrule{#1}% +} +\define@key{adjbox@rndframe}{sep}{% + \adjsetlength\fboxsep{#1}% +} +\define@key{adjbox@rndframe}{color}{% + \def\adjbox@rndframe@color{\color{#1}}% +} +\define@key{adjbox@rndframe}{color*}{% + \def\adjbox@rndframe@color{#1}% +} +\let\adjbox@rndframe@color\relax \define@key\adjbox@fam{scale}{% \@ifnextchar\bgroup{% \adjbox@scale@xy @@ -322,15 +612,18 @@ \define@adjboxkey@defvalue{left}{\linewidth}{\adjbox@halign{#1}\relax\hss} \define@adjboxkey@defvalue{right}{\linewidth}{\adjbox@halign{#1}\hss\relax} \newcommand\centerbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{centerbox}% + \noindent \adjbox@halign{#1}\hss\hss } \newcommand\leftalignbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{leftalignbox}% + \noindent \adjbox@halign{#1}\relax\hss } \newcommand\rightalignbox[1][\linewidth]{% - \adjustbox@noindent + \collectboxcheckenv{rightalignbox}% + \noindent \adjbox@halign{#1}\hss\relax } \define@adjboxkey@defvalue{outer}{\linewidth}{% @@ -341,7 +634,7 @@ } \newcommand\outersidebox[1][\linewidth]{% \collectboxcheckenv{outersidebox}% - \adjustbox@noindent + \noindent \adjbox@halign{#1}{% \checkoddpage \ifoddpageoroneside @@ -359,7 +652,7 @@ } \newcommand\innersidebox[1][\linewidth]{% \collectboxcheckenv{innersidebox}% - \adjustbox@noindent + \noindent \adjbox@halign{#1}{% \checkoddpage \ifoddpageoroneside @@ -532,28 +825,34 @@ \newcommand*\@minmaxsizebox[4]{% \edef\@tempa{#3}% \edef\@tempb{#4}% + \ifx\@tempa\Gin@exclamation\else + \adjsetlength\@tempdima{#3}% + \fi + \ifx\@tempb\Gin@exclamation\else + \adjsetlength\@tempdimb{#4}% + \fi \ifcase0% \ifx\@tempa\Gin@exclamation \ifx\@tempb\Gin@exclamation \else - \ifdim\@tempb#1#2% + \ifdim\@tempdimb#1#2% 1% \fi \fi \else \ifx\@tempb\Gin@exclamation - \ifdim\@tempa#1\width + \ifdim\@tempdima#1\width 2% \fi \else - \ifdim\@tempa#1\width - \ifdim\@tempb#1#2% + \ifdim\@tempdima#1\width + \ifdim\@tempdimb#1#2% 3% \else 2% \fi \else - \ifdim\@tempb#1#2% + \ifdim\@tempdimb#1#2% 1% \fi \fi @@ -562,18 +861,14 @@ \relax% 0 \BOXCONTENT \or - \adjsetlength\@tempdima\@tempb - \Gscale@div\@tempa\@tempdima#2% + \Gscale@div\@tempa\@tempdimb#2% \Gscale@box\@tempa[\@tempa]\BOXCONTENT \or - \adjsetlength\@tempdima\@tempa \Gscale@div\@tempa\@tempdima\width \Gscale@box\@tempa[\@tempa]\BOXCONTENT \or - \adjsetlength\@tempdima\@tempa \Gscale@div\@tempa\@tempdima\width - \adjsetlength\@tempdima\@tempb - \Gscale@div\@tempb\@tempdima#2% + \Gscale@div\@tempb\@tempdimb#2% \ifdim\@tempa\p@#1\@tempb\p@ \let\@tempb\@tempa \else @@ -727,6 +1022,43 @@ \def\@tempa{\begin{#1}#2}% \toks@\expandafter\expandafter\expandafter{\expandafter\@tempa\the\toks@\end{#1}}% }% +\define@key{ADJBOX}{color}{% + \adjbox@checkcolor + \@ifnextchar\bgroup{% + \adjbox@color + }{% + \adjbox@color{}{#1}% + }#1\@nnil +} +\def\adjbox@color#1#2#3\@nnil{% + \ifx\@nnil#1\@nnil + \color{#2}% + \else + \color[{#1}]{#2}% + \fi +} +\define@key{ADJBOX}{color*}{% + #1% +} +\define@key{ADJBOX}{fgcolor}{% + \adjbox@checkcolor + \@ifnextchar\bgroup{% + \adjbox@fgcolor + }{% + \adjbox@fgcolor{}{#1}% + }#1\@nnil +} +\def\adjbox@fgcolor#1#2#3\@nnil{% + \ifx\@nnil#1\@nnil + \adjbox@innercode{\color{#2}}{}% + \else + \adjbox@innercode{\color[{#1}]{#2}}{}% + \fi +} +\define@key{ADJBOX}{fgcolor*}{% + \adjbox@checkcolor + \adjbox@innercode{#1}{}% +} \define@key\adjbox@fam{bgcolor}{% \adjbox@checkcolor \@ifnextchar\bgroup{% @@ -737,17 +1069,18 @@ } \def\adjbox@bgcolor#1#2#3\@nnil{% \ifx\@nnil#1\@nnil - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color{#2}}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}% \else - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}% \fi } \define@key\adjbox@fam{bgcolor*}{% \adjbox@checkcolor - \adjbox@Gin@add{\@Collectbox{\adjbox@@bgcolor{#1}}}% + \adjbox@Gin@add{\@Collectbox{\@bgcolorbox{#1}}}% } -\def\adjbox@@bgcolor#1{% - \mbox{% +\def\@bgcolorbox#1{% + \leavevmode + \hbox{% \hbox{% #1% \vrule\@width\width\@height\height\@depth\depth% @@ -756,32 +1089,175 @@ \BOXCONTENT }% }% -\newcommand*\bgimagebox[2][]{% +\expandafter\newcommand\expandafter\bgcolorbox\expandafter{% + \expandafter + \@ifstar + \csname bgcolorbox*\endcsname + \bgcolorbox@ +} +\newcommand\bgcolorbox@[2][\@nnil]{% + \collectboxcheckenv{bgcolorbox}% + \ifx\@nnil#1\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {\@collectbox{\@bgcolorbox{\color{#2}}}}% + {\@collectbox{\@bgcolorbox{\color[#1]{#2}}}}% +} +\@namedef{bgcolorbox*}#1{% + \collectboxcheckenv{bgcolorbox*}% + \@collectbox{\@bgcolorbox{#1}}% +} +\expandafter\newcommand\expandafter\fgimagebox\expandafter{% + \expandafter + \@ifstar + \csname fgimagebox*\endcsname + \fgimagebox@ +} +\newcommand\fgimagebox@[2][]{% + \collectboxcheckenv{fgimagebox}% + \@collectbox{\@foregroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +\expandafter\newcommand\csname fgimagebox*\endcsname[2][]{% + \collectboxcheckenv{fgimagebox*}% + \@collectbox{\@foregroundbox\adjustimage{#1}{#2}}% +} +\define@key{adjbox}{fgimage}{% + \@ifnextchar\bgroup{% + \adjbox@fgimage + }{% + \adjbox@fgimage{}{#1}% + }#1{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}% +} +\define@key{adjbox}{fgimage*}{% + \@ifnextchar\bgroup{% + \adjbox@fgimage + }{% + \adjbox@fgimage{}{#1}% + }#1{}\@nnil{}% +} +\def\adjbox@fgimage#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustimage{#1#4}{#2}}}% +} +\expandafter\newcommand\expandafter\bgimagebox\expandafter{% + \expandafter + \@ifstar + \csname bgimagebox*\endcsname + \bgimagebox@ +} +\newcommand\bgimagebox@[2][]{% \collectboxcheckenv{bgimagebox}% - \@collectbox{\@bgimagebox{#1}{#2}}% -} -\def\@bgimagebox#1#2{% - \mbox{% - \lower\depth\hbox{% - \edef\@tempa{\noexpand\adjustimage - {#1,width=\the\width,totalheight=\the\totalheight}% - {#2}% - }% - \@tempa - }% - \hskip-\width% - \BOXCONTENT - }% + \@collectbox{\@backgroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +\expandafter\newcommand\csname bgimagebox*\endcsname[2][]{% + \collectboxcheckenv{bgimagebox*}% + \@collectbox{\@backgroundbox\adjustimage{#1}{#2}}% } \define@key{adjbox}{bgimage}{% \@ifnextchar\bgroup{% \adjbox@bgimage }{% \adjbox@bgimage{}{#1}% - }#1\@nnil + }#1{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}% +} +\define@key{adjbox}{bgimage*}{% + \@ifnextchar\bgroup{% + \adjbox@bgimage + }{% + \adjbox@bgimage{}{#1}% + }#1{}\@nnil{}% +} +\def\adjbox@bgimage#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustimage{#1#4}{#2}}}% +} +\define@key{adjbox}{foreground}{% + \@ifnextchar\bgroup{% + \adjbox@foreground + }{% + \adjbox@foreground{}{#1}% + }#1{}{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}% +} +\define@key{adjbox}{foreground*}{% + \@ifnextchar\bgroup{% + \adjbox@foreground + }{% + \adjbox@foreground{}{#1}% + }#1{}{}\@nnil{}% } -\def\adjbox@bgimage#1#2#3\@nnil{% - \adjbox@Gin@add{\@Collectbox{\@bgimagebox{#1}{#2}}}% +\def\adjbox@foreground#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@foregroundbox\adjustbox{#1#4}{#2}}}% +} +\def\@foregroundbox#1#2#3{% + \leavevmode + \hbox to \width{% + \BOXCONTENT + \hskip-\width + \hss + \adjbox@parentdims + #1{#2}{#3}% + \hss + }% +} +\expandafter\newcommand\expandafter\foregroundbox\expandafter{% + \expandafter + \@ifstar + \csname foregroundbox*\endcsname + \foregroundbox@ +} +\newcommand\foregroundbox@[2][]{% + \collectboxcheckenv{foregroundbox}% + \@collectbox{\@foregroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +\expandafter\newcommand\csname foregroundbox*\endcsname[2][]{% + \collectboxcheckenv{foregroundbox*}% + \@collectbox{\@foregroundbox\adjustbox{#1}{#2}}% +} +\define@key{adjbox}{background}{% + \@ifnextchar\bgroup{% + \adjbox@background + }{% + \adjbox@background{}{#1}% + }#1{}{}\@nnil + {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}% +} +\define@key{adjbox}{background*}{% + \@ifnextchar\bgroup{% + \adjbox@background + }{% + \adjbox@background{}{#1}% + }#1{}{}\@nnil{}% +} +\def\adjbox@background#1#2#3\@nnil#4{% + \adjbox@Gin@Add{\@Collectbox{\@backgroundbox\adjustbox{#1#4}{#2}}}% +} +\def\@backgroundbox#1#2#3{% + \leavevmode + \hbox to \width{% + \hss + \adjbox@parentdims + #1{#2}{#3}% + \hss + \hskip-\width% + \BOXCONTENT + }% +} +\expandafter\newcommand\expandafter\backgroundbox\expandafter{% + \expandafter + \@ifstar + \csname backgroundbox*\endcsname + \backgroundbox@ +} +\newcommand\backgroundbox@[2][]{% + \collectboxcheckenv{backgroundbox}% + \@collectbox{\@backgroundbox\adjustbox{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#2}}% +} +\expandafter\newcommand\csname backgroundbox*\endcsname[2][]{% + \collectboxcheckenv{backgroundbox*}% + \@collectbox{\@backgroundbox\adjustbox{#1}{#2}}% } \define@key\adjbox@fam{lap}{% \@ifnextchar\bgroup{% @@ -844,7 +1320,9 @@ }#2\@nnil } \def\adjbox@@page#1#2\@nnil{% - \def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{#1}#2\adjbox@reset}{##1}{\end{#1}}}% + \adjbox@innercode + {\adjbox@set\begin{#1}#2\adjbox@reset\ignorespaces}% + {\end{#1}}% } \def\adjbox@set{% \let\adjbox@origsetlength\setlength @@ -864,7 +1342,7 @@ } \def\@@stackbox#1#2[#3]{% \collectbox@ - {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3} + {\begin{varwidth}[#2]{\linewidth}\csname adjbox@halign@#1\endcsname#3\ignorespaces} \BOXCONTENT {\end{varwidth}}% } @@ -886,11 +1364,12 @@ \fi\fi } \def\adjbox@@stack#1#2#3{% - \def\adjbox@collectbox##1{% - \collectbox@{% - \begin{varwidth}[#2]{\linewidth}% - \csname adjbox@halign@#1\endcsname#3% - }{##1}{\end{varwidth}}% + \adjbox@innercode{% + \begin{varwidth}[#2]{\linewidth}% + \csname adjbox@halign@#1\endcsname#3% + \ignorespaces + }{% + \end{varwidth}% }% } \IfFileExists{varwidth.sty} @@ -914,8 +1393,9 @@ \ifcollectboxenv \adjbox@innerenv{#1}{#2}\@nnil \else - \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{}{##1}{}}% + \def\adjbox@collectbox##1{\collectbox@tab{#1}{#2}{\adjbox@begininnercode}{##1}{\adjbox@endinnercode}}% \fi + \chardef\adjbox@innerlevel\tw@ } \define@key{ADJBOX}{tabular*}{% \adjbox@tabular{tabular*}#1\@nnil @@ -932,8 +1412,9 @@ \ifcollectboxenv \adjbox@innercode{\(\begin{array}#1}{\end{array}\)}% \else - \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\(}{##1}{\)}}% + \def\adjbox@collectbox##1{\collectbox@tab{array}{#1}{\adjbox@begininnercode\(}{##1}{\)\adjbox@endinnercode}}% \fi + \chardef\adjbox@innerlevel\tw@ } \define@key{ADJBOX}{innerenv}{% \@ifnextchar\bgroup{% @@ -943,8 +1424,11 @@ \remove@to@nnil }#1\@nnil } +\adjbox@let@key{ADJBOX}{inner env}{innerenv} \def\adjbox@innerenv#1#2\@nnil{% - \def\adjbox@collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}% + \adjbox@innercode + {\begin{#1}#2}% + {\end{#1}}% }% \def\adjbox@@innerenv#1{% \adjbox@@@innerenv{#1}{}% @@ -957,10 +1441,28 @@ }% \define@key{ADJBOX}{innercode}{% \adjbox@innercode#1{}{}% -} -\def\adjbox@innercode#1#2{% - \def\adjbox@collectbox##1{\collectbox@{#1}{##1}{#2}}% }% +\adjbox@let@key{ADJBOX}{inner code}{innercode} +\def\adjbox@innercode{% + \ifcase\adjbox@innerlevel + \relax% 0: first inner code + \def\adjbox@collectbox##1{\collectbox@{\adjbox@begininnercode\adjustbox@ignorespaces}{##1}{\adjustbox@unskip\adjbox@endinnercode}}% + \chardef\adjbox@innerlevel\@ne + \expandafter\adjbox@@innercode + \or% 1 append inner code, no inner env + \expandafter\adjbox@@innercode + \else% 2 inner tabular exists, create warning and ignore content. + \PackageWarning{adjustbox}{Further inner code or environment ignored\MessageBreak after "tabular"-like key}% + \expandafter\@gobbletwo + \fi +}% +\long\def\adjbox@@innercode#1#2{% + \@temptokena\expandafter{\adjbox@begininnercode#1}% + \edef\adjbox@begininnercode{\the\@temptokena}% + \@temptokena{#2}% + \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox@endinnercode}% + \edef\adjbox@endinnercode{\the\@temptokena}% +} \define@key\adjbox@fam{label}{% \def\adjbox@label{\label{#1}}% } @@ -1013,6 +1515,8 @@ } \def\adjbox@caption@table@pos{1} \def\adjbox@addfloat#1#2#3#4{% + \Gin@esetsize + \@tempswatrue \ifnum\adjbox@caption@pos>10 \chardef\adjbox@caption@pos=0\csname adjbox@caption@#1@pos\endcsname\relax \fi diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def index b643bf5bd1b..4bd2f36c001 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def +++ b/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -17,13 +17,12 @@ %% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def. %% Further author information are located in the .def files. %% -\ProvidesFile{tc-dvips.def}[2012/05/13 v1.0 Clipping driver for dvips] +\ProvidesFile{tc-dvips.def}[2018/04/08 v2.1 Clipping 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}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% \special{% ps: /mtrxc matrix currentmatrix def @@ -36,10 +35,113 @@ newpath mtrxc setmatrix }% - \box#1% + \hbox to 0pt{\copy#1\hss}% \special{ps: grestore }% + \hskip\wd#1% }% } +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjcalc@settobp\DEPTHmRADIUSBL\@tempdima + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% + \adjcalc@settobp\HEIGHT{-\ht#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}% + \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}% + \special{% + ps: + /mtrxc matrix currentmatrix def + currentpoint gsave + translate + Resolution 72 div VResolution 72 div + scale + newpath + %0 \DEPTH neg translate + %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip + 0 \RADIUSTLmHEIGHT\space moveto + \RADIUSTL\space \RADIUSTLmHEIGHT\space \RADIUSTL\space 180 -90 arc + \WIDTHmRADIUSTR\space \HEIGHT\space lineto + \WIDTHmRADIUSTR\space \RADIUSTRmHEIGHT\space \RADIUSTR\space -90 0 arc + \WIDTH\space \DEPTHmRADIUSBR\space lineto + \WIDTHmRADIUSBR\space \DEPTHmRADIUSBR\space \RADIUSBR\space 0 90 arc + \RADIUSBL\space \DEPTH\space lineto + \RADIUSBL\space \DEPTHmRADIUSBL\space \RADIUSBL\space -270 -180 arc + closepath + %gsave 0.5 0 0 setrgbcolor stroke grestore + clip + newpath + mtrxc setmatrix + }% + \hbox to 0pt{\copy#1\hss}% + \special{ps: grestore }% + \hskip \wd#1% + }% +} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}% + \adjcalc@settobp\HEIGHT{-\ht#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}% + \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% + % + \hbox to 0pt{\copy#1\hss}% + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color + \special{% + ps: + /mtrxc matrix currentmatrix def + currentpoint gsave + translate + Resolution 72 div VResolution 72 div + scale + newpath + %0 \DEPTH neg translate + %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip + 0 \RADIUSTLmHEIGHT moveto + \RADIUSTL \RADIUSTLmHEIGHT \RADIUSTL 180 -90 arc + \WIDTHmRADIUSTR \HEIGHT lineto + \WIDTHmRADIUSTR \RADIUSTRmHEIGHT \RADIUSTR -90 0 arc + \WIDTH \DEPTHmRADIUSBR lineto + \WIDTHmRADIUSBR \DEPTHmRADIUSBR \RADIUSBR 0 90 arc + \RADIUSBL \DEPTH lineto + \RADIUSBL \DEPTHmRADIUSBL \RADIUSBL -270 -180 arc + closepath + \LINEWIDTH setlinewidth + stroke + newpath + mtrxc setmatrix + grestore + }% + \color@endgroup + }% + \hskip \wd#1% + }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% +} \endinput %% %% 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 index e18f0909122..c69189939da 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def +++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -17,22 +17,93 @@ %% 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] +\ProvidesFile{tc-pdftex.def}[2018/04/08 v2.1 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}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% \pdfsave + \pdfliteral direct {% + 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n + }% + \hbox to 0pt{\copy#1\hss}% + \pdfrestore + \hskip\wd#1 + }% +} +\def\@clip@bpdimens#1#2#3#4#5{% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \adjcalc@settobp\HEIGHT{\ht#1}% + \adjcalc@settobp\DEPTH{-\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLb{\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTL{\ht#1-#2}% + \adjcalc@settobp\HEIGHTmRADIUSTLb{\ht#1-\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTR{\ht#1-#3}% + \adjcalc@settobp\HEIGHTmRADIUSTRb{\ht#1-\tc@bezfacn#3}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\WIDTHmRADIUSTRb{\wd#1-\tc@bezfacn#3}% + \adjcalc@settobp\RADIUSBRmDEPTH{#4-\dp#1}% + \adjcalc@settobp\RADIUSBRmDEPTHb{\tc@bezfacn#4-\dp#1}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBRb{\wd#1-\tc@bezfacn#4}% + \adjcalc@settobp\RADIUSBLmDEPTH{#5-\dp#1}% + \adjcalc@settobp\RADIUSBLmDEPTHb{\tc@bezfacn#5-\dp#1}% + \adjcalc@settobp\RADIUSBLb{\tc@bezfacn#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% +} +\def\@clip@roundedboxpath@pdfcode{% + 0 \HEIGHTmRADIUSTL m + 0 \HEIGHTmRADIUSTLb \RADIUSTLb \HEIGHT \RADIUSTL \HEIGHT c + \WIDTHmRADIUSTR \HEIGHT l + \WIDTHmRADIUSTRb \HEIGHT \WIDTH \HEIGHTmRADIUSTRb \WIDTH \HEIGHTmRADIUSTR c + \WIDTH \RADIUSBRmDEPTH l + \WIDTH \RADIUSBRmDEPTHb \WIDTHmRADIUSBRb \DEPTH \WIDTHmRADIUSBR \DEPTH c + \RADIUSBL \DEPTH l + \RADIUSBLb \DEPTH 0 \RADIUSBLmDEPTHb 0 \RADIUSBLmDEPTH c + 0 \RADIUSBLmDEPTH l +} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + \pdfsave + \pdfliteral direct {% + \@clip@roundedboxpath@pdfcode + h W n + }% + \hbox to 0pt{\copy#1\hss}% + \pdfrestore + \hskip\wd#1% + }% +} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + % + \hbox to 0pt{\copy#1\hss}% + \pdfsave + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color \pdfliteral direct {% - 0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n + \LINEWIDTH w + \@clip@roundedboxpath@pdfcode + h s }% - \hbox to 0pt{\copy#1\hss}% + \color@endgroup + }% \pdfrestore - \hskip \wd#1 + \hskip\wd#1% }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% } \endinput %% diff --git a/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def index 0b32c59cffd..10dbef59d4c 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def +++ b/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -17,7 +17,7 @@ %% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def. %% Further author information are located in the .def files. %% -\ProvidesFile{tc-pgf.def}[2012/05/13 v1.0 trimclip fall-back clipping driver using PGF] +\ProvidesFile{tc-pgf.def}[2018/04/08 v2.1 trimclip fall-back clipping driver using PGF] \RequirePackage{pgf} \def\@cliptoboxdim#1{% \setbox#1\hbox{\begin{pgfpicture}% @@ -32,6 +32,46 @@ \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% \end{pgfpicture}}% } +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1\hbox{\begin{pgfpicture}% + \pgfpathmoveto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpatharc{180}{90}{#2}% + \pgfpathlineto{\pgfpoint{\wd#1-#3}{\ht#1}}% + \pgfpatharc{90}{0}{#3}% + \pgfpathlineto{\pgfpoint{\wd#1}{#4-\dp#1}}% + \pgfpatharc{0}{-90}{#4}% + \pgfpathlineto{\pgfpoint{#5}{-\dp#1}}% + \pgfpatharc{270}{180}{#5}% + \pgfpathlineto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpathclose + \pgfusepathqclip + \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% + \pgfnode{rectangle}{base west}{\usebox#1}{}{}% + \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% + \end{pgfpicture}}% +} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1\hbox{\begin{pgfpicture}% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \pgfset{inner sep=\z@,outer sep=\z@,minimum size=\z@}% + \pgfnode{rectangle}{base west}{\usebox#1}{}{}% + \pgfusepath{}% + \adjbox@rndframe@color + \pgfpathmoveto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpatharc{180}{90}{#2}% + \pgfpathlineto{\pgfpoint{\wd#1-#3}{\ht#1}}% + \pgfpatharc{90}{0}{#3}% + \pgfpathlineto{\pgfpoint{\wd#1}{#4-\dp#1}}% + \pgfpatharc{0}{-90}{#4}% + \pgfpathlineto{\pgfpoint{#5}{-\dp#1}}% + \pgfpatharc{270}{180}{#5}% + \pgfpathlineto{\pgfpoint{\z@}{\ht#1-#2}}% + \pgfpathclose + \pgfusepath{stroke}% + \pgfsetbaselinepointnow{\pgfpoint\z@\z@}% + \end{pgfpicture}}% +} \endinput %% %% 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 index 2aa3dc0c21e..ea28e71c1b4 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def +++ b/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -17,24 +17,103 @@ %% 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] +\ProvidesFile{tc-xetex.def}[2018/04/08 v2.1 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 + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\DEPTH{\dp#1}% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \special{pdf:content q }% + \special{pdf:code 0 -\DEPTH \WIDTH \TOTALHEIGHT re W 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 }% + \hbox to 0 pt{\copy#1\hss}% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \hskip\wd#1% + }% +} +\def\@clip@bpdimens#1#2#3#4#5{% + \adjcalc@settobp\TOTALHEIGHT{\ht#1+\dp#1}% + \adjcalc@settobp\HEIGHT{\ht#1}% + \adjcalc@settobp\DEPTH{-\dp#1}% + \adjcalc@settobp\WIDTH{\wd#1}% + \adjcalc@settobp\RADIUSTL{#2}% + \adjcalc@settobp\RADIUSTR{#3}% + \adjcalc@settobp\RADIUSBR{#4}% + \adjcalc@settobp\RADIUSBL{#5}% + \adjcalc@settobp\RADIUSTLb{\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTL{\ht#1-#2}% + \adjcalc@settobp\HEIGHTmRADIUSTLb{\ht#1-\tc@bezfacn#2}% + \adjcalc@settobp\HEIGHTmRADIUSTR{\ht#1-#3}% + \adjcalc@settobp\HEIGHTmRADIUSTRb{\ht#1-\tc@bezfacn#3}% + \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}% + \adjcalc@settobp\WIDTHmRADIUSTRb{\wd#1-\tc@bezfacn#3}% + \adjcalc@settobp\RADIUSBRmDEPTH{#4-\dp#1}% + \adjcalc@settobp\RADIUSBRmDEPTHb{\tc@bezfacn#4-\dp#1}% + \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}% + \adjcalc@settobp\WIDTHmRADIUSBRb{\wd#1-\tc@bezfacn#4}% + \adjcalc@settobp\RADIUSBLmDEPTH{#5-\dp#1}% + \adjcalc@settobp\RADIUSBLmDEPTHb{\tc@bezfacn#5-\dp#1}% + \adjcalc@settobp\RADIUSBLb{\tc@bezfacn#5}% + \adjcalc@settobp\LINEWIDTH{\fboxrule}% +} +\def\@clip@roundedboxpath@pdfcode{% + 0 \HEIGHTmRADIUSTL m + 0 \HEIGHTmRADIUSTLb \RADIUSTLb \HEIGHT \RADIUSTL \HEIGHT c + \WIDTHmRADIUSTR \HEIGHT l + \WIDTHmRADIUSTRb \HEIGHT \WIDTH \HEIGHTmRADIUSTRb \WIDTH \HEIGHTmRADIUSTR c + \WIDTH \RADIUSBRmDEPTH l + \WIDTH \RADIUSBRmDEPTHb \WIDTHmRADIUSBRb \DEPTH \WIDTHmRADIUSBR \DEPTH c + \RADIUSBL \DEPTH l + \RADIUSBLb \DEPTH 0 \RADIUSBLmDEPTHb 0 \RADIUSBLmDEPTH c + 0 \RADIUSBLmDEPTH l +} +\def\@clipcornersofbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + \special{pdf:content q }% + \special{pdf:literal direct + \@clip@roundedboxpath@pdfcode + h W 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 }% + \hbox to 0pt{\copy#1\hss}% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \hskip\wd#1% + }% +} +\def\@rndframearoundbox#1#2#3#4#5{% + \setbox#1=\hbox{% + \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% + \@clip@bpdimens{#1}{#2}{#3}{#4}{#5}% + % + \hbox to 0pt{\copy#1\hss}% + \hbox to 0pt{% + \color@setgroup + \adjbox@rndframe@color + \special{pdf:content q }% + \special{pdf:literal direct + \LINEWIDTH w + \@clip@roundedboxpath@pdfcode + h s + }% + \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 }% + \special{pdf:literal direct Q }% + \special{pdf:literal direct Q }% + \color@endgroup }% - \special{pdf:literal direct W }% - \special{pdf:literal direct n }% - \box#1% - \special{pdf:econtent }% + \hskip\wd#1% }% + \adjsetlength\@tempdima{.5\fboxrule}% + \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima% } \endinput %% diff --git a/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty index d0dcb815ac8..6592bcd3f20 100644 --- a/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty +++ b/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2018 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 @@ -18,11 +18,11 @@ %% Further author information are located in the .def files. %% \ProvidesPackage{trimclip}[% - 2012/05/16 - v1.0 + 2018/04/08 + v1.1 Trim and clip general TeX material] \def\tc@driver{tc-\Gin@driver} -\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}} +\DeclareOption{pgf}{\def\tc@driver{tc-pgf.def}\AtEndOfPackage{\RequirePackage{pgf}}} \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}} @@ -247,6 +247,7 @@ \@viewportbox{#1}{#2}{#3}{#4}{#5}% \@cliptoboxdim{#1}% } +\def\tc@bezfacn{0.44771525}% \InputIfFileExists{\tc@driver}{% {\let\on@line\@gobble \PackageInfo{trimclip}{Using driver '\tc@driver'.}}% |