texlive[47405] Master/texmf-dist: adjustbox (9apr18)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 9 23:14:28 CEST 2018


Revision: 47405
          http://tug.org/svn/texlive?view=revision&revision=47405
Author:   karl
Date:     2018-04-09 23:14:28 +0200 (Mon, 09 Apr 2018)
Log Message:
-----------
adjustbox (9apr18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/adjustbox/README
    trunk/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf
    trunk/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf
    trunk/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf
    trunk/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx
    trunk/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
    trunk/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
    trunk/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
    trunk/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
    trunk/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
    trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
    trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
    trunk/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
    trunk/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty

Modified: trunk/Master/texmf-dist/doc/latex/adjustbox/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/adjustbox/README	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/doc/latex/adjustbox/README	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,6 +1,6 @@
 LaTeX bundle adjustbox
 =========================
-Copyright (c) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>  
+Copyright (c) 2011-2018 by Martin Scharrer <martin at 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.

Modified: trunk/Master/texmf-dist/doc/latex/adjustbox/adjcalc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/adjustbox/trimclip.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/source/latex/adjustbox/adjcalc.dtx	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %<=*COPYRIGHT>
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at settobp}
+%    \begin{macrocode}
+\def\adjcalc at settobp#1#2{%
+    \begingroup
+    \adjsetlength\@tempdima{#2}%
+    \@tempdima=0.99626\@tempdima
+    \edef\@tempa{\endgroup\def\noexpand#1{\strip at pt\@tempdima\space}}%
+    \@tempa
+}%
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\adjcalc at overwrite}
 %    \begin{macrocode}
 \def\adjcalc at overwrite{%

Modified: trunk/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %<=*COPYRIGHT>
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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.
 %
-% \subsection{Setting keys globally} ^^A (((2
+%
+% \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.
+%
+%
+% \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,7 +1738,13 @@
 % 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.
 % More complex code should be enclosed in braces.
@@ -1427,7 +1752,14 @@
 % \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.
 % Previous (normal) keys won't have an effect yet.
@@ -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 at line{\the\inputlineno}%
     \let\collectbox at mode\relax
     \let\collectbox at noindent\relax
-    \collectboxcheckenv{adjustbox}%
-    \ifcollectboxenv\else
+    \let\adjbox at collectbox\@collectbox
+    \let\adjbox at begininnercode\@empty
+    \let\adjbox at endinnercode\@empty
+    \chardef\adjbox at innerlevel\z@
+    \ifcollectboxenv
+        \let\adjustbox at noindent\noindent
+        \let\adjustbox at unskip\unskip
+        \let\adjustbox at ignorespaces\ignorespaces
+    \else
         \let\adjustbox at noindent\relax
+        \let\adjustbox at unskip\relax
+        \let\adjustbox at ignorespaces\relax
     \fi
-    \begingroup
+    \let\XKV at checksanitizea\adjbox at kvsanitize
     \adjbox at setkeys{#1}%
-    \expandafter\expandafter\expandafter
-    \endgroup
     \expandafter
     \adjbox at collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV at rm}}%
 }
-\def\adjbox at collectbox{\@collectbox}
 \def\adjbox at setkeys@ba{%
     \expandafter\expandafter
     \expandafter\adjbox@@setkeys at ba
@@ -1771,7 +2112,6 @@
 \def\adjbox at setkeys{%
     \setkeys*{ADJBOX}%
 }
-\let\adjustbox at noindent\noindent
 %    \end{macrocode}
 % \end{environment}
 %
@@ -1803,7 +2143,105 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+\begingroup
+\catcode`\, 3
+\catcode`\= 3
+\gdef\adjbox at comma@iii{,}%
+\gdef\adjbox at equal@iii{=}%
+\catcode`\, 4
+\catcode`\= 4
+\gdef\adjbox at comma@iv{,}%
+\gdef\adjbox at equal@iv{=}%
+\catcode`\, 7
+\catcode`\= 7
+\gdef\adjbox at comma@vii{,}%
+\gdef\adjbox at equal@vii{=}%
+\catcode`\, 8
+\catcode`\= 8
+\gdef\adjbox at comma@viii{,}%
+\gdef\adjbox at equal@viii{=}%
+\catcode`\, 10
+\catcode`\= 10
+\gdef\adjbox at comma@x{,}%
+\gdef\adjbox at equal@x{=}%
+\catcode`\, 11
+\catcode`\= 11
+\gdef\adjbox at comma@xi{,}%
+\gdef\adjbox at equal@xi{=}%
+\catcode`\, 13
+\catcode`\= 13
+\gdef\adjbox at comma@xiii{,}%
+\gdef\adjbox at equal@xiii{=}%
+\catcode`\, 12
+\catcode`\= 12
+\gdef\adjbox at comma@xii{,}%
+\gdef\adjbox at equal@xii{=}%
+% \end{macro}
 %
+% \begin{macro}{\adjbox at kvsanitize}
+%    \begin{macrocode}
+\gdef\adjbox at kvsanitize#1#2{%
+    \def\@tempa{\expandafter\noexpand\adjbox at comma@xiii}%
+    \def\@tempb{}%
+    \ifnum\catcode`\,=12 \else
+        \ifnum\catcode`\,=13 \else
+            \@ifundefined{adjbox at comma@\romannumeral\catcode`\,}{%
+                \PackageError{adjustbox}
+                {Invalid comma catcode \the\catcode`\,}{}%
+            }{}%
+            \edef\@tempb{\csname adjbox at comma@\romannumeral\the\catcode`\,\endcsname}%
+        \fi
+    \fi
+    \edef\@tempa{\@tempa\@tempb}%
+    \XKV at tempa@toks{#1}%
+    \expandafter\adjbox at replacecatcodes\expandafter,\@tempa\@nnil
+    \def\@tempa{\expandafter\noexpand\adjbox at equal@xiii}%
+    \def\@tempb{}%
+    \ifnum\catcode`\==12 \else
+        \ifnum\catcode`\==13 \else
+            \@ifundefined{adjbox at equal@\romannumeral\catcode`\=}{%
+                \PackageError{adjustbox}
+                {Invalid equal sign catcode \the\catcode`\=}{}%
+            }{}%
+            \def\@tempb{\@tempa\csname adjbox at equal@\romannumeral\the\catcode`\,\endcsname}%
+        \fi
+    \fi
+    \edef\@tempa{\@tempa\@tempb}%
+    \expandafter\adjbox at replacecatcodes\expandafter=\@tempa\@nnil
+    \edef#2{\the\XKV at tempa@toks}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\adjbox at replacecatcodes}
+%    \begin{macrocode}
+\gdef\adjbox at replacecatcodes#1#2{%
+    \ifx\@nnil#2\relax\else
+        \def\@tempa##1#2{%
+            \ifx\@nnil##1\relax\else
+                \XKV at tempa@toks{##1}%
+                \expandafter\@tempb
+            \fi
+        }%
+        \def\@tempb##1#2{%
+            \ifx\@nnil##1\relax\else
+                \XKV at tempa@toks\expandafter{\the\XKV at tempa@toks#1##1}%
+                \expandafter\@tempb
+            \fi
+        }%
+        \expandafter\@tempa\the\XKV at tempa@toks#2\@nnil#2\relax
+        \expandafter\adjbox at replacecatcodes\expandafter#1%
+    \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\endgroup
+%    \end{macrocode}
+%
+%
 % \begin{macro}{\adjustbox at content}
 % The default content, which is simply the collected box.
 % This macro can be redefined if required.
@@ -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 at Width}
 % \begin{macro}{\adjbox at Height}
 % \begin{macro}{\adjbox at Depth}
@@ -1831,7 +2297,38 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\adjbox at pwidth}
+% \begin{macro}{\adjbox at pheight}
+% \begin{macro}{\adjbox at pdepth}
+% \begin{macro}{\adjbox at ptotalheight}
+% Dimension registers for parent sizes; used for keys which use an internal adjustbox.
+%    \begin{macrocode}
+\newdimen\adjbox at pwidth
+\newdimen\adjbox at pheight
+\newdimen\adjbox at pdepth
+\newdimen\adjbox at ptotalheight
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
+% \begin{macro}{\adjbox at parentdims}
+%    \begin{macrocode}
+\def\adjbox at parentdims{%
+    \let\pwidth\adjbox at pwidth
+    \let\pheight\adjbox at pheight
+    \let\pdepth\adjbox at pdepth
+    \let\ptotalheight\adjbox at ptotalheight
+    \pwidth\width
+    \pheight\height
+    \pdepth\depth
+    \ptotalheight\totalheight
+}%
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % \begin{macro}{\adjbox at esetsize}
 % Replacement of \Macro\Gin at esetsize.
 % Now always called in external mode. Checks if any size is set and, as an optimation, does nothing otherwise.
@@ -1885,8 +2382,200 @@
 {\csname adjustbox at 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 at adjustbox{\newenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\newcommand}%
+        \newadjustboxenv@
+    }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\newadjustboxcmd}
+%    \begin{macrocode}
+\newcommand*\newadjustboxcmd{%
+    \begingroup
+    \let\@@@newadjustboxenv\@@@newadjustboxcmd
+    \def\new at adjustbox{\newcommand}%
+    \newadjustboxenv@
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\newadjustboxenv}
+%    \begin{macrocode}
+\newcommand*\renewadjustboxenv{%
+    \begingroup
+    \@ifstar{%
+        \let\@@@newadjustboxenv\@@@newadjustboxenv@
+        \def\new at adjustbox{\renewenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\renewcommand}%
+        \newadjustboxenv@
+    }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\renewadjustboxcmd}
+%    \begin{macrocode}
+\newcommand*\renewadjustboxcmd{%
+    \begingroup
+    \let\@@@newadjustboxenv\@@@newadjustboxcmd
+    \def\new at adjustbox{\renewcommand}%
+    \newadjustboxenv@
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\newadjustboxenv}
+%    \begin{macrocode}
+\newcommand*\provideadjustboxenv{%
+    \begingroup
+    \@ifstar{%
+        \let\@@@newadjustboxenv\@@@newadjustboxenv@
+        \def\new at adjustbox{\@star at or@long\adjustbox at provideenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\providecommand}%
+        \newadjustboxenv@
+    }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjustbox at 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 at provideenvironment#1{%
+    \@ifundefined{#1}%
+        {\new at environment{#1}}%
+        {\adjustbox at gobble@oomm}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjustbox at gobble@oomm}
+% Gobbles the first optional argument.
+%    \begin{macrocode}
+\newcommand*\adjustbox at gobble@oomm[1][]{%
+    \adjustbox at gobble@@oomm
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\adjustbox at gobble@@oomm}
+% Gobbles the second optional and two mandatory arguments.
+%    \begin{macrocode}
+\newcommand*\adjustbox at 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 at 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 at 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 at 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 at copy@key}
+% Aliases one key to another.
+%    \begin{macrocode}
+\def\adjbox at copy@key#1{%
+    \expandafter\let
+    \csname KV at ADJBOX@#1\expandafter\endcsname
+    \csname KV at Gin@#1\endcsname
+    \expandafter\let
+    \csname KV at ADJBOX@#1 at default\expandafter\endcsname
+    \csname KV at Gin@#1 at default\endcsname
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
 % ^^A )))
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \subsection{Keys for trimming, clipping, viewport and margin} ^^A (((
@@ -2142,7 +2846,41 @@
 %    \end{macrocode}
 % \end{key}
 %
+% \begin{key}{adjbox}{rndcorners}
+%    \begin{macrocode}
+\define at adjboxkey{rndcorners}{\rndcornersbox@{#1}}
+%    \end{macrocode}
+% \end{key}
 %
+% \begin{key}{adjbox}{rndframe}
+%    \begin{macrocode}
+\define at adjboxkey{rndframe}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at rndframe{sep=\z@}%
+    }{%
+        \adjbox at rndframe{sep=\z@}{}%
+    }#1\@nnil
+}
+%    \end{macrocode}
+% \end{key}
+%
+% \begin{key}{adjbox}{rndfbox}
+%    \begin{macrocode}
+\define at adjboxkey{rndfbox}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at rndframe{}%
+    }{%
+        \adjbox at rndframe{}{}%
+    }#1\@nnil
+}
+
+\def\adjbox at rndframe#1#2#3\@nnil{%
+    \rndfbox[{#1,#2}]{#3}%
+}
+%    \end{macrocode}
+% \end{key}
+%
+%
 % \begin{key}{adjbox}{Clip*}
 %    \begin{macrocode}
 \define at adjboxkey{Clip*}{\clipbox at s{#1}}
@@ -2177,9 +2915,103 @@
 % \end{key}
 %
 %
+%    \begin{macrocode}
+\adjbox at copy@key{bbllx}
+\adjbox at copy@key{bblly}
+\adjbox at copy@key{bburx}
+\adjbox at copy@key{bbury}
+\adjbox at copy@key{decodearray}
+\adjbox at copy@key{intent}
+\adjbox at copy@key{interpolate}
+\adjbox at copy@key{maskarray}
+\adjbox at copy@key{natheight}
+\adjbox at copy@key{natwidth}
+\adjbox at copy@key{ocobjnum}
+\adjbox at copy@key{ocobjref}
+\adjbox at copy@key{page}
+\adjbox at copy@key{pagebox}
+\adjbox at copy@key{print}
+\adjbox at copy@key{quiet}
+\adjbox at copy@key{resetcolor}
+\adjbox at copy@key{resolution}
+\adjbox at 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 at rndframe}{#1}%
+    \@rndframearoundbox
+}
+\define at key{adjbox at rndframe}{width}{%
+    \adjsetlength\fboxrule{#1}%
+}
+\define at key{adjbox at rndframe}{sep}{%
+    \adjsetlength\fboxsep{#1}%
+}
+\define at key{adjbox at rndframe}{color}{%
+    \def\adjbox at rndframe@color{\color{#1}}%
+}
+\define at key{adjbox at rndframe}{color*}{%
+    \def\adjbox at rndframe@color{#1}%
+}
+\let\adjbox at 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 )))
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \subsection{Scaling and rotating keys} ^^A (((
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -2288,7 +3120,8 @@
 % \begin{macro}{\centerbox}
 %    \begin{macrocode}
 \newcommand\centerbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{centerbox}%
+    \noindent
     \adjbox at halign{#1}\hss\hss
 }
 %    \end{macrocode}
@@ -2298,7 +3131,8 @@
 % \begin{macro}{\leftalignbox}
 %    \begin{macrocode}
 \newcommand\leftalignbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{leftalignbox}%
+    \noindent
     \adjbox at halign{#1}\relax\hss
 }
 %    \end{macrocode}
@@ -2308,7 +3142,8 @@
 % \begin{macro}{\rightalignbox}
 %    \begin{macrocode}
 \newcommand\rightalignbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{rightalignbox}%
+    \noindent
     \adjbox at halign{#1}\hss\relax
 }
 %    \end{macrocode}
@@ -2337,7 +3172,7 @@
 %    \begin{macrocode}
 \newcommand\outersidebox[1][\linewidth]{%
     \collectboxcheckenv{outersidebox}%
-    \adjustbox at noindent
+    \noindent
     \adjbox at halign{#1}{%
         \checkoddpage
         \ifoddpageoroneside
@@ -2361,7 +3196,7 @@
 %    \begin{macrocode}
 \newcommand\innersidebox[1][\linewidth]{%
     \collectboxcheckenv{innersidebox}%
-    \adjustbox at noindent
+    \noindent
     \adjbox at halign{#1}{%
         \checkoddpage
         \ifoddpageoroneside
@@ -2802,6 +3637,12 @@
 \newcommand*\@minmaxsizebox[4]{%
     \edef\@tempa{#3}%
     \edef\@tempb{#4}%
+    \ifx\@tempa\Gin at exclamation\else
+        \adjsetlength\@tempdima{#3}%
+    \fi
+    \ifx\@tempb\Gin at 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 at exclamation
         \ifx\@tempb\Gin at 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 at 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 at div\@tempa\@tempdima#2%
+        \Gscale at div\@tempa\@tempdimb#2%
         \Gscale at 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 at div\@tempa\@tempdima\width
         \Gscale at 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 at div\@tempa\@tempdima\width
-        \adjsetlength\@tempdima\@tempb
-        \Gscale at div\@tempb\@tempdima#2%
+        \Gscale at 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 at key{ADJBOX}{color}{%
+    \adjbox at checkcolor
+    \@ifnextchar\bgroup{%
+        \adjbox at color
+    }{%
+        \adjbox at color{}{#1}%
+    }#1\@nnil
+}
+%    \end{macrocode}
+% \end{key}
+%
+% \begin{macro}{\adjbox at color}
+% Check for the optional color argument.
+%    \begin{macrocode}
+\def\adjbox at 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 at 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 at key{ADJBOX}{fgcolor}{%
+    \adjbox at checkcolor
+    \@ifnextchar\bgroup{%
+        \adjbox at fgcolor
+    }{%
+        \adjbox at fgcolor{}{#1}%
+    }#1\@nnil
+}
+%    \end{macrocode}
+% \end{key}
+%
+% \begin{macro}{\adjbox at fgcolor}
+% Parses the two possible arguments and adds the color macro
+% to the token register.
+%    \begin{macrocode}
+\def\adjbox at fgcolor#1#2#3\@nnil{%
+    \ifx\@nnil#1\@nnil
+        \adjbox at innercode{\color{#2}}{}%
+    \else
+        \adjbox at 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 at key{ADJBOX}{fgcolor*}{%
+    \adjbox at checkcolor
+    \adjbox at 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 at bgcolor#1#2#3\@nnil{%
     \ifx\@nnil#1\@nnil
-        \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{\color{#2}}}}%
+        \adjbox at Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}%
     \else
-        \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
+        \adjbox at Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
     \fi
 }
 %    \end{macrocode}
@@ -3204,13 +4126,13 @@
 %    \begin{macrocode}
 \define at key\adjbox at fam{bgcolor*}{%
     \adjbox at checkcolor
-    \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{#1}}}%
+    \adjbox at 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 at key{adjbox}{fgimage}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at fgimage
+    }{%
+        \adjbox at 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 at key{adjbox}{fgimage*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at fgimage
+    }{%
+        \adjbox at fgimage{}{#1}%
+    }#1{}\@nnil{}%
+}
+%    \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\adjbox at fgimage}
+%    \begin{macrocode}
+\def\adjbox at fgimage#1#2#3\@nnil#4{%
+    \adjbox at Gin@Add{\@Collectbox{\@foregroundbox\adjustimage{#1#4}{#2}}}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
 % \begin{macro}{\bgimagebox}
 %    \begin{macrocode}
-\newcommand*\bgimagebox[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{\@bgimagebox{#1}{#2}}%
+    \@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,22 +4302,205 @@
         \adjbox at bgimage
     }{%
         \adjbox at 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 at key{adjbox}{bgimage*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at bgimage
+    }{%
+        \adjbox at bgimage{}{#1}%
+    }#1{}\@nnil{}%
+}
+%    \end{macrocode}
+% \end{key}
 %
+%
 % \begin{macro}{\adjbox at bgimage}
 %    \begin{macrocode}
-\def\adjbox at bgimage#1#2#3\@nnil{%
-    \adjbox at Gin@add{\@Collectbox{\@bgimagebox{#1}{#2}}}%
+\def\adjbox at bgimage#1#2#3\@nnil#4{%
+    \adjbox at 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 at key{adjbox}{foreground}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at foreground
+    }{%
+        \adjbox at 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 at key{adjbox}{foreground*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at foreground
+    }{%
+        \adjbox at foreground{}{#1}%
+    }#1{}{}\@nnil{}%
+}
+%    \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\adjbox at foreground}
+%    \begin{macrocode}
+\def\adjbox at foreground#1#2#3\@nnil#4{%
+    \adjbox at 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 at 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 at key{adjbox}{background}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at background
+    }{%
+        \adjbox at 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 at key{adjbox}{background*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at background
+    }{%
+        \adjbox at background{}{#1}%
+    }#1{}{}\@nnil{}%
+}
+%    \end{macrocode}
+% \end{key}
+%
+%
+% \begin{macro}{\adjbox at background}
+%    \begin{macrocode}
+\def\adjbox at background#1#2#3\@nnil#4{%
+    \adjbox at 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 at 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}
+%
+%
+%
 % ^^A )))
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \subsection{Lapping keys and macros} ^^A (((
@@ -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 at collectbox##1{\collectbox@{\adjbox at set\begin{#1}#2\adjbox at reset}{##1}{\end{#1}}}%
+    \adjbox at innercode
+        {\adjbox at set\begin{#1}#2\adjbox at 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 at halign@#1\endcsname#3}
+        {\begin{varwidth}[#2]{\linewidth}\csname adjbox at 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 at collectbox##1{%
-        \collectbox@{%
-            \begin{varwidth}[#2]{\linewidth}%
-            \csname adjbox at halign@#1\endcsname#3%
-        }{##1}{\end{varwidth}}%
+    \adjbox at innercode{%
+        \begin{varwidth}[#2]{\linewidth}%
+        \csname adjbox at halign@#1\endcsname#3%
+        \ignorespaces
+    }{%
+        \end{varwidth}%
     }%
 }
 %    \end{macrocode}
@@ -3578,8 +4797,9 @@
     \ifcollectboxenv
         \adjbox at innerenv{#1}{#2}\@nnil
     \else
-        \def\adjbox at collectbox##1{\collectbox at tab{#1}{#2}{}{##1}{}}%
+        \def\adjbox at collectbox##1{\collectbox at tab{#1}{#2}{\adjbox at begininnercode}{##1}{\adjbox at endinnercode}}%
     \fi
+    \chardef\adjbox at innerlevel\tw@
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3614,8 +4834,9 @@
     \ifcollectboxenv
         \adjbox at innercode{\(\begin{array}#1}{\end{array}\)}%
     \else
-        \def\adjbox at collectbox##1{\collectbox at tab{array}{#1}{\(}{##1}{\)}}%
+        \def\adjbox at collectbox##1{\collectbox at tab{array}{#1}{\adjbox at begininnercode\(}{##1}{\)\adjbox at endinnercode}}%
     \fi
+    \chardef\adjbox at innerlevel\tw@
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3638,6 +4859,7 @@
         \remove at to@nnil
     }#1\@nnil
 }
+\adjbox at let@key{ADJBOX}{inner env}{innerenv}
 %    \end{macrocode}
 % \end{key}
 %
@@ -3644,7 +4866,9 @@
 % \begin{macro}{\adjbox at innerenv}
 %    \begin{macrocode}
 \def\adjbox at innerenv#1#2\@nnil{%
-    \def\adjbox at collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}%
+    \adjbox at innercode
+        {\begin{#1}#2}%
+        {\end{#1}}%
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -3674,22 +4898,45 @@
 %    \begin{macrocode}
 \define at key{ADJBOX}{innercode}{%
     \adjbox at innercode#1{}{}%
-}
+}%
+\adjbox at let@key{ADJBOX}{inner code}{innercode}
 %    \end{macrocode}
-% \end{key}
+% \end{macro}
 %
 %
 % \begin{macro}{\adjbox at innercode}
 %    \begin{macrocode}
-\def\adjbox at innercode#1#2{%
-    \def\adjbox at collectbox##1{\collectbox@{#1}{##1}{#2}}%
+\def\adjbox at innercode{%
+    \ifcase\adjbox at innerlevel
+    \relax% 0: first inner code
+        \def\adjbox at collectbox##1{\collectbox@{\adjbox at begininnercode\adjustbox at ignorespaces}{##1}{\adjustbox at unskip\adjbox at endinnercode}}%
+        \chardef\adjbox at 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 at begininnercode#1}%
+    \edef\adjbox at begininnercode{\the\@temptokena}%
+    \@temptokena{#2}%
+    \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox at endinnercode}%
+    \edef\adjbox at endinnercode{\the\@temptokena}%
+}
+%    \end{macrocode}
+% \end{macro}
 %
 %
+%
 % ^^A )))
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \subsection{Float keys} ^^A (((
@@ -3795,6 +5042,8 @@
 % \begin{macro}{\adjbox at addfloat}
 %    \begin{macrocode}
 \def\adjbox at addfloat#1#2#3#4{%
+    \Gin at esetsize
+    \@tempswatrue
     \ifnum\adjbox at caption@pos>10
         \chardef\adjbox at caption@pos=0\csname adjbox at caption@#1 at pos\endcsname\relax
     \fi

Modified: trunk/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/source/latex/adjustbox/trimclip.dtx	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %<=*COPYRIGHT>
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at driver{tc-\Gin at driver}
-\DeclareOption{pgf}{\def\tc at driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
+\DeclareOption{pgf}{\def\tc at driver{tc-pgf.def}\AtEndOfPackage{\RequirePackage{pgf}}}
 \DeclareOption{pdftex}{\def\tc at driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
 \DeclareOption{xetex}{\def\tc at driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
 \DeclareOption{dvips}{\def\tc at 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,7 +928,17 @@
 % 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 at bezfacn}
+% The Bezier factor required to draw rounded corners in same drivers.
 %    \begin{macrocode}
+\def\tc at bezfacn{0.44771525}%
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
 \InputIfFileExists{\tc at driver}{%
     {\let\on at line\@gobble
     \PackageInfo{trimclip}{Using driver '\tc at driver'.}}%
@@ -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 at 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 at defaultbp\WIDTH{\wd#1}%
-        \Gin at defaultbp\DEPTH{\dp#1}%
-        \@tempdima\ht#1%
-        \advance\@tempdima\dp#1%
-        \Gin at defaultbp\TOTALHEIGHT{\@tempdima}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at 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 at bpdimens}
+%    \begin{macrocode}
+\def\@clip at bpdimens#1#2#3#4#5{%
+    \adjcalc at settobp\TOTALHEIGHT{\ht#1+\dp#1}%
+    \adjcalc at settobp\HEIGHT{\ht#1}%
+    \adjcalc at settobp\DEPTH{-\dp#1}%
+    \adjcalc at settobp\WIDTH{\wd#1}%
+    \adjcalc at settobp\RADIUSTL{#2}%
+    \adjcalc at settobp\RADIUSTR{#3}%
+    \adjcalc at settobp\RADIUSBR{#4}%
+    \adjcalc at settobp\RADIUSBL{#5}%
+    \adjcalc at settobp\RADIUSTLb{\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTL{\ht#1-#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTLb{\ht#1-\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTR{\ht#1-#3}%
+    \adjcalc at settobp\HEIGHTmRADIUSTRb{\ht#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTRb{\wd#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\RADIUSBRmDEPTH{#4-\dp#1}%
+    \adjcalc at settobp\RADIUSBRmDEPTHb{\tc at bezfacn#4-\dp#1}%
+    \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+    \adjcalc at settobp\WIDTHmRADIUSBRb{\wd#1-\tc at bezfacn#4}%
+    \adjcalc at settobp\RADIUSBLmDEPTH{#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLmDEPTHb{\tc at bezfacn#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLb{\tc at bezfacn#5}%
+    \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@clip at roundedbox@pdfcode}
+%    \begin{macrocode}
+\def\@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        \pdfsave
+        \pdfliteral direct {%
+            \@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \pdfsave
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at rndframe@color
             \pdfliteral direct {%
-                0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
+                \LINEWIDTH w
+                \@clip at roundedboxpath@pdfcode
+                h s
             }%
-            \hbox to 0pt{\copy#1\hss}%
+            \color at 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 at pt\@tempdima\space}%
-        \edef\DEPTH{\strip at pt\dp#1\space}%
-        \edef\WIDTH{\strip at pt\wd#1\space}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
         \special{%
             ps:
               /mtrxc matrix currentmatrix def
@@ -1054,13 +1219,132 @@
               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 at settobp\DEPTHmRADIUSBL\@tempdima
+        \adjcalc at settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
+        \adjcalc at settobp\HEIGHT{-\ht#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\RADIUSTL{#2}%
+        \adjcalc at settobp\RADIUSTR{#3}%
+        \adjcalc at settobp\RADIUSBR{#4}%
+        \adjcalc at settobp\RADIUSBL{#5}%
+        \adjcalc at settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
+        \adjcalc at settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
+        \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+        \adjcalc at settobp\DEPTHmRADIUSBR{\dp#1-#4}%
+        \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+        \adjcalc at 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 at settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
+        \adjcalc at settobp\HEIGHT{-\ht#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\RADIUSTL{#2}%
+        \adjcalc at settobp\RADIUSTR{#3}%
+        \adjcalc at settobp\RADIUSBR{#4}%
+        \adjcalc at settobp\RADIUSBL{#5}%
+        \adjcalc at settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
+        \adjcalc at settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
+        \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+        \adjcalc at settobp\DEPTHmRADIUSBR{\dp#1-#4}%
+        \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+        \adjcalc at settobp\DEPTHmRADIUSBL{\dp#1-#5}%
+        \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at 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 at endgroup
+        }%
+        \hskip \wd#1%
+    }%
+    \adjsetlength\@tempdima{.5\fboxrule}%
+    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
+}
+%    \end{macrocode}
+% \end{macro}
+%
 %^^A vim: ft=tex
 % \iffalse
 %</tc-dvips.def>
@@ -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,25 +1368,132 @@
 %    \begin{macrocode}
 \def\@cliptoboxdim#1{%
     \setbox#1=\hbox{%
-        \Gin at defaultbp\WIDTH{\wd#1}%
-        \Gin at defaultbp\DEPTH{\dp#1}%
-        \@tempdima\ht#1%
-        \advance\@tempdima\dp#1%
-        \Gin at defaultbp\TOTALHEIGHT{\@tempdima}%
-        \special{pdf:bcontent }%
-        \special{%
-            pdf:literal direct
-                0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at 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 at bpdimens}
+%    \begin{macrocode}
+\def\@clip at bpdimens#1#2#3#4#5{%
+    \adjcalc at settobp\TOTALHEIGHT{\ht#1+\dp#1}%
+    \adjcalc at settobp\HEIGHT{\ht#1}%
+    \adjcalc at settobp\DEPTH{-\dp#1}%
+    \adjcalc at settobp\WIDTH{\wd#1}%
+    \adjcalc at settobp\RADIUSTL{#2}%
+    \adjcalc at settobp\RADIUSTR{#3}%
+    \adjcalc at settobp\RADIUSBR{#4}%
+    \adjcalc at settobp\RADIUSBL{#5}%
+    \adjcalc at settobp\RADIUSTLb{\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTL{\ht#1-#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTLb{\ht#1-\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTR{\ht#1-#3}%
+    \adjcalc at settobp\HEIGHTmRADIUSTRb{\ht#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTRb{\wd#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\RADIUSBRmDEPTH{#4-\dp#1}%
+    \adjcalc at settobp\RADIUSBRmDEPTHb{\tc at bezfacn#4-\dp#1}%
+    \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+    \adjcalc at settobp\WIDTHmRADIUSBRb{\wd#1-\tc at bezfacn#4}%
+    \adjcalc at settobp\RADIUSBLmDEPTH{#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLmDEPTHb{\tc at bezfacn#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLb{\tc at bezfacn#5}%
+    \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@clip at roundedbox@pdfcode}
+%    \begin{macrocode}
+\def\@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        \special{pdf:content q }%
+        \special{pdf:literal direct
+            \@clip at roundedboxpath@pdfcode
+            h W n
         }%
-        \special{pdf:literal direct W }%
-        \special{pdf:literal direct n }%
-            \box#1%
-        \special{pdf:econtent }%
+        \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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at rndframe@color
+            \special{pdf:content q }%
+            \special{pdf:literal direct
+                \LINEWIDTH w
+                \@clip at 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 at endgroup
+        }%
+        \hskip\wd#1%
+    }%
+    \adjsetlength\@tempdima{.5\fboxrule}%
+    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
+}
+%    \end{macrocode}
+% \end{macro}
+%
 %^^A vim: ft=tex
 % \iffalse
 %</tc-xetex.def>

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/adjcalc.sty	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at settobp#1#2{%
+    \begingroup
+    \adjsetlength\@tempdima{#2}%
+    \@tempdima=0.99626\@tempdima
+    \edef\@tempa{\endgroup\def\noexpand#1{\strip at pt\@tempdima\space}}%
+    \@tempa
+}%
 \def\adjcalc at overwrite{%
     \let\setlength\adjsetlength
     \let\addtolength\adjaddtolength

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at keysafter\@empty
-\newcommand\adjustbox[1]{%
+\newcommand\adjustbox{%
     \begingroup
+    \collectboxcheckenv{adjustbox}%
+    \@adjustbox
+}
+\long\def\@adjustbox#1{%
     \edef\adjbox at line{\the\inputlineno}%
     \let\collectbox at mode\relax
     \let\collectbox at noindent\relax
-    \collectboxcheckenv{adjustbox}%
-    \ifcollectboxenv\else
+    \let\adjbox at collectbox\@collectbox
+    \let\adjbox at begininnercode\@empty
+    \let\adjbox at endinnercode\@empty
+    \chardef\adjbox at innerlevel\z@
+    \ifcollectboxenv
+        \let\adjustbox at noindent\noindent
+        \let\adjustbox at unskip\unskip
+        \let\adjustbox at ignorespaces\ignorespaces
+    \else
         \let\adjustbox at noindent\relax
+        \let\adjustbox at unskip\relax
+        \let\adjustbox at ignorespaces\relax
     \fi
-    \begingroup
+    \let\XKV at checksanitizea\adjbox at kvsanitize
     \adjbox at setkeys{#1}%
-    \expandafter\expandafter\expandafter
-    \endgroup
     \expandafter
     \adjbox at collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV at rm}}%
 }
-\def\adjbox at collectbox{\@collectbox}
 \def\adjbox at setkeys@ba{%
     \expandafter\expandafter
     \expandafter\adjbox@@setkeys at ba
@@ -115,7 +125,6 @@
 \def\adjbox at setkeys{%
     \setkeys*{ADJBOX}%
 }
-\let\adjustbox at noindent\noindent
 \def\adjustbox@#1{%
     \adjbox at Width\width
     \adjbox at Height\height
@@ -136,13 +145,113 @@
     \the\toks@
     \endgroup
 }
+\begingroup
+\catcode`\, 3
+\catcode`\= 3
+\gdef\adjbox at comma@iii{,}%
+\gdef\adjbox at equal@iii{=}%
+\catcode`\, 4
+\catcode`\= 4
+\gdef\adjbox at comma@iv{,}%
+\gdef\adjbox at equal@iv{=}%
+\catcode`\, 7
+\catcode`\= 7
+\gdef\adjbox at comma@vii{,}%
+\gdef\adjbox at equal@vii{=}%
+\catcode`\, 8
+\catcode`\= 8
+\gdef\adjbox at comma@viii{,}%
+\gdef\adjbox at equal@viii{=}%
+\catcode`\, 10
+\catcode`\= 10
+\gdef\adjbox at comma@x{,}%
+\gdef\adjbox at equal@x{=}%
+\catcode`\, 11
+\catcode`\= 11
+\gdef\adjbox at comma@xi{,}%
+\gdef\adjbox at equal@xi{=}%
+\catcode`\, 13
+\catcode`\= 13
+\gdef\adjbox at comma@xiii{,}%
+\gdef\adjbox at equal@xiii{=}%
+\catcode`\, 12
+\catcode`\= 12
+\gdef\adjbox at comma@xii{,}%
+\gdef\adjbox at equal@xii{=}%
+\gdef\adjbox at kvsanitize#1#2{%
+    \def\@tempa{\expandafter\noexpand\adjbox at comma@xiii}%
+    \def\@tempb{}%
+    \ifnum\catcode`\,=12 \else
+        \ifnum\catcode`\,=13 \else
+            \@ifundefined{adjbox at comma@\romannumeral\catcode`\,}{%
+                \PackageError{adjustbox}
+                {Invalid comma catcode \the\catcode`\,}{}%
+            }{}%
+            \edef\@tempb{\csname adjbox at comma@\romannumeral\the\catcode`\,\endcsname}%
+        \fi
+    \fi
+    \edef\@tempa{\@tempa\@tempb}%
+    \XKV at tempa@toks{#1}%
+    \expandafter\adjbox at replacecatcodes\expandafter,\@tempa\@nnil
+    \def\@tempa{\expandafter\noexpand\adjbox at equal@xiii}%
+    \def\@tempb{}%
+    \ifnum\catcode`\==12 \else
+        \ifnum\catcode`\==13 \else
+            \@ifundefined{adjbox at equal@\romannumeral\catcode`\=}{%
+                \PackageError{adjustbox}
+                {Invalid equal sign catcode \the\catcode`\=}{}%
+            }{}%
+            \def\@tempb{\@tempa\csname adjbox at equal@\romannumeral\the\catcode`\,\endcsname}%
+        \fi
+    \fi
+    \edef\@tempa{\@tempa\@tempb}%
+    \expandafter\adjbox at replacecatcodes\expandafter=\@tempa\@nnil
+    \edef#2{\the\XKV at tempa@toks}%
+}
+\gdef\adjbox at replacecatcodes#1#2{%
+    \ifx\@nnil#2\relax\else
+        \def\@tempa##1#2{%
+            \ifx\@nnil##1\relax\else
+                \XKV at tempa@toks{##1}%
+                \expandafter\@tempb
+            \fi
+        }%
+        \def\@tempb##1#2{%
+            \ifx\@nnil##1\relax\else
+                \XKV at tempa@toks\expandafter{\the\XKV at tempa@toks#1##1}%
+                \expandafter\@tempb
+            \fi
+        }%
+        \expandafter\@tempa\the\XKV at tempa@toks#2\@nnil#2\relax
+        \expandafter\adjbox at replacecatcodes\expandafter#1%
+    \fi
+}
+\endgroup
 \def\adjustbox at 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 at Width
 \newdimen\adjbox at Height
 \newdimen\adjbox at Depth
 \newdimen\adjbox at Totalheight
+\newdimen\adjbox at pwidth
+\newdimen\adjbox at pheight
+\newdimen\adjbox at pdepth
+\newdimen\adjbox at ptotalheight
+\def\adjbox at parentdims{%
+    \let\pwidth\adjbox at pwidth
+    \let\pheight\adjbox at pheight
+    \let\pdepth\adjbox at pdepth
+    \let\ptotalheight\adjbox at ptotalheight
+    \pwidth\width
+    \pheight\height
+    \pdepth\depth
+    \ptotalheight\totalheight
+}%
 \def\adjbox at esetsize{%
   \ifcase0%
     \ifx\Gin at ewidth\Gin at exclamation\else 1\fi
@@ -164,6 +273,103 @@
     \adjustbox{#1}{\Gin at clipfalse\Gin at i{#2}}%
 }
 {\csname adjustbox at minimal\endcsname}
+\newcommand*\newadjustboxenv{%
+    \begingroup
+    \@ifstar{%
+        \let\@@@newadjustboxenv\@@@newadjustboxenv@
+        \def\new at adjustbox{\newenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\newcommand}%
+        \newadjustboxenv@
+    }%
+}
+\newcommand*\newadjustboxcmd{%
+    \begingroup
+    \let\@@@newadjustboxenv\@@@newadjustboxcmd
+    \def\new at adjustbox{\newcommand}%
+    \newadjustboxenv@
+}
+\newcommand*\renewadjustboxenv{%
+    \begingroup
+    \@ifstar{%
+        \let\@@@newadjustboxenv\@@@newadjustboxenv@
+        \def\new at adjustbox{\renewenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\renewcommand}%
+        \newadjustboxenv@
+    }%
+}
+\newcommand*\renewadjustboxcmd{%
+    \begingroup
+    \let\@@@newadjustboxenv\@@@newadjustboxcmd
+    \def\new at adjustbox{\renewcommand}%
+    \newadjustboxenv@
+}
+\newcommand*\provideadjustboxenv{%
+    \begingroup
+    \@ifstar{%
+        \let\@@@newadjustboxenv\@@@newadjustboxenv@
+        \def\new at adjustbox{\@star at or@long\adjustbox at provideenvironment}%
+        \newadjustboxenv@
+    }{%
+        \def\new at adjustbox{\providecommand}%
+        \newadjustboxenv@
+    }%
+}
+\def\adjustbox at provideenvironment#1{%
+    \@ifundefined{#1}%
+        {\new at environment{#1}}%
+        {\adjustbox at gobble@oomm}%
+}
+\newcommand*\adjustbox at gobble@oomm[1][]{%
+    \adjustbox at gobble@@oomm
+}
+\newcommand*\adjustbox at 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 at adjustbox{#1}#2{%
+        \begingroup
+        \@collectboxisenv{#1}%
+        \@adjustbox{#3}%
+    }{%
+        \collectboxenvend
+    }%
+}
+\def\@@@newadjustboxenv#1#2#3{%
+    \expandafter
+    \endgroup
+    \expandafter
+    \expandafter\new at adjustbox\csname #1\endcsname#2{%
+        \begingroup
+        \collectboxcheckenv{#1}%
+        \@adjustbox{#3}%
+    }%
+}
+\def\@@@newadjustboxcmd#1#2#3{%
+    \expandafter
+    \endgroup
+    \new at adjustbox{#1}#2{%
+        \begingroup
+        \@adjustbox{#3}%
+    }%
+}
 \def\adjbox at 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 at default\expandafter\endcsname\csname KV@#1@#3 at default\endcsname
 }
+\def\adjbox at copy@key#1{%
+    \expandafter\let
+    \csname KV at ADJBOX@#1\expandafter\endcsname
+    \csname KV at Gin@#1\endcsname
+    \expandafter\let
+    \csname KV at ADJBOX@#1 at default\expandafter\endcsname
+    \csname KV at Gin@#1 at default\endcsname
+}
 \define at key{adjbox}{viewport}{%
     \def\adjustbox at content{%
         \@trimclip{%
@@ -279,11 +493,87 @@
 }
 \define at adjboxkey{Trim}{\trimbox@{#1}}%
 \define at adjboxkey{Clip}{\clipbox@{#1}}
+\define at adjboxkey{rndcorners}{\rndcornersbox@{#1}}
+\define at adjboxkey{rndframe}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at rndframe{sep=\z@}%
+    }{%
+        \adjbox at rndframe{sep=\z@}{}%
+    }#1\@nnil
+}
+\define at adjboxkey{rndfbox}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at rndframe{}%
+    }{%
+        \adjbox at rndframe{}{}%
+    }#1\@nnil
+}
+
+\def\adjbox at rndframe#1#2#3\@nnil{%
+    \rndfbox[{#1,#2}]{#3}%
+}
 \define at adjboxkey{Clip*}{\clipbox at s{#1}}
 \define at adjboxkey{margin}{\marginbox@{#1}}
 \define at adjboxkey{margin*}{\marginbox at s{#1}}
 \adjbox at let@key\adjbox at fam{padding}{margin}
 \adjbox at let@key\adjbox at fam{padding*}{margin*}
+\adjbox at copy@key{bbllx}
+\adjbox at copy@key{bblly}
+\adjbox at copy@key{bburx}
+\adjbox at copy@key{bbury}
+\adjbox at copy@key{decodearray}
+\adjbox at copy@key{intent}
+\adjbox at copy@key{interpolate}
+\adjbox at copy@key{maskarray}
+\adjbox at copy@key{natheight}
+\adjbox at copy@key{natwidth}
+\adjbox at copy@key{ocobjnum}
+\adjbox at copy@key{ocobjref}
+\adjbox at copy@key{page}
+\adjbox at copy@key{pagebox}
+\adjbox at copy@key{print}
+\adjbox at copy@key{quiet}
+\adjbox at copy@key{resetcolor}
+\adjbox at copy@key{resolution}
+\adjbox at 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 at rndframe}{#1}%
+    \@rndframearoundbox
+}
+\define at key{adjbox at rndframe}{width}{%
+    \adjsetlength\fboxrule{#1}%
+}
+\define at key{adjbox at rndframe}{sep}{%
+    \adjsetlength\fboxsep{#1}%
+}
+\define at key{adjbox at rndframe}{color}{%
+    \def\adjbox at rndframe@color{\color{#1}}%
+}
+\define at key{adjbox at rndframe}{color*}{%
+    \def\adjbox at rndframe@color{#1}%
+}
+\let\adjbox at rndframe@color\relax
 \define at key\adjbox at fam{scale}{%
     \@ifnextchar\bgroup{%
         \adjbox at scale@xy
@@ -322,15 +612,18 @@
 \define at adjboxkey@defvalue{left}{\linewidth}{\adjbox at halign{#1}\relax\hss}
 \define at adjboxkey@defvalue{right}{\linewidth}{\adjbox at halign{#1}\hss\relax}
 \newcommand\centerbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{centerbox}%
+    \noindent
     \adjbox at halign{#1}\hss\hss
 }
 \newcommand\leftalignbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{leftalignbox}%
+    \noindent
     \adjbox at halign{#1}\relax\hss
 }
 \newcommand\rightalignbox[1][\linewidth]{%
-    \adjustbox at noindent
+    \collectboxcheckenv{rightalignbox}%
+    \noindent
     \adjbox at halign{#1}\hss\relax
 }
 \define at adjboxkey@defvalue{outer}{\linewidth}{%
@@ -341,7 +634,7 @@
 }
 \newcommand\outersidebox[1][\linewidth]{%
     \collectboxcheckenv{outersidebox}%
-    \adjustbox at noindent
+    \noindent
     \adjbox at halign{#1}{%
         \checkoddpage
         \ifoddpageoroneside
@@ -359,7 +652,7 @@
 }
 \newcommand\innersidebox[1][\linewidth]{%
     \collectboxcheckenv{innersidebox}%
-    \adjustbox at noindent
+    \noindent
     \adjbox at halign{#1}{%
         \checkoddpage
         \ifoddpageoroneside
@@ -532,28 +825,34 @@
 \newcommand*\@minmaxsizebox[4]{%
     \edef\@tempa{#3}%
     \edef\@tempb{#4}%
+    \ifx\@tempa\Gin at exclamation\else
+        \adjsetlength\@tempdima{#3}%
+    \fi
+    \ifx\@tempb\Gin at exclamation\else
+        \adjsetlength\@tempdimb{#4}%
+    \fi
     \ifcase0%
     \ifx\@tempa\Gin at exclamation
         \ifx\@tempb\Gin at exclamation
         \else
-            \ifdim\@tempb#1#2%
+            \ifdim\@tempdimb#1#2%
                 1%
             \fi
         \fi
     \else
         \ifx\@tempb\Gin at 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 at div\@tempa\@tempdima#2%
+        \Gscale at div\@tempa\@tempdimb#2%
         \Gscale at box\@tempa[\@tempa]\BOXCONTENT
     \or
-        \adjsetlength\@tempdima\@tempa
         \Gscale at div\@tempa\@tempdima\width
         \Gscale at box\@tempa[\@tempa]\BOXCONTENT
     \or
-        \adjsetlength\@tempdima\@tempa
         \Gscale at div\@tempa\@tempdima\width
-        \adjsetlength\@tempdima\@tempb
-        \Gscale at div\@tempb\@tempdima#2%
+        \Gscale at 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 at key{ADJBOX}{color}{%
+    \adjbox at checkcolor
+    \@ifnextchar\bgroup{%
+        \adjbox at color
+    }{%
+        \adjbox at color{}{#1}%
+    }#1\@nnil
+}
+\def\adjbox at color#1#2#3\@nnil{%
+    \ifx\@nnil#1\@nnil
+        \color{#2}%
+    \else
+        \color[{#1}]{#2}%
+    \fi
+}
+\define at key{ADJBOX}{color*}{%
+    #1%
+}
+\define at key{ADJBOX}{fgcolor}{%
+    \adjbox at checkcolor
+    \@ifnextchar\bgroup{%
+        \adjbox at fgcolor
+    }{%
+        \adjbox at fgcolor{}{#1}%
+    }#1\@nnil
+}
+\def\adjbox at fgcolor#1#2#3\@nnil{%
+    \ifx\@nnil#1\@nnil
+        \adjbox at innercode{\color{#2}}{}%
+    \else
+        \adjbox at innercode{\color[{#1}]{#2}}{}%
+    \fi
+}
+\define at key{ADJBOX}{fgcolor*}{%
+    \adjbox at checkcolor
+    \adjbox at innercode{#1}{}%
+}
 \define at key\adjbox at fam{bgcolor}{%
     \adjbox at checkcolor
     \@ifnextchar\bgroup{%
@@ -737,17 +1069,18 @@
 }
 \def\adjbox at bgcolor#1#2#3\@nnil{%
     \ifx\@nnil#1\@nnil
-        \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{\color{#2}}}}%
+        \adjbox at Gin@add{\@Collectbox{\@bgcolorbox{\color{#2}}}}%
     \else
-        \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{\color[#1]{#2}}}}%
+        \adjbox at Gin@add{\@Collectbox{\@bgcolorbox{\color[#1]{#2}}}}%
     \fi
 }
 \define at key\adjbox at fam{bgcolor*}{%
     \adjbox at checkcolor
-    \adjbox at Gin@add{\@Collectbox{\adjbox@@bgcolor{#1}}}%
+    \adjbox at 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,22 +1089,71 @@
         \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 at key{adjbox}{fgimage}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at fgimage
+    }{%
+        \adjbox at fgimage{}{#1}%
+    }#1{}\@nnil
+    {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
+}
+\define at key{adjbox}{fgimage*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at fgimage
+    }{%
+        \adjbox at fgimage{}{#1}%
+    }#1{}\@nnil{}%
+}
+\def\adjbox at fgimage#1#2#3\@nnil#4{%
+    \adjbox at 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}}%
+    \@collectbox{\@backgroundbox\adjustimage{#1,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}{#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
-    }%
+\expandafter\newcommand\csname bgimagebox*\endcsname[2][]{%
+    \collectboxcheckenv{bgimagebox*}%
+    \@collectbox{\@backgroundbox\adjustimage{#1}{#2}}%
 }
 \define at key{adjbox}{bgimage}{%
     \@ifnextchar\bgroup{%
@@ -778,11 +1160,105 @@
         \adjbox at bgimage
     }{%
         \adjbox at bgimage{}{#1}%
-    }#1\@nnil
+    }#1{}\@nnil
+    {,width=\pwidth,totalheight=\ptotalheight,raise=-\pdepth}%
 }
-\def\adjbox at bgimage#1#2#3\@nnil{%
-    \adjbox at Gin@add{\@Collectbox{\@bgimagebox{#1}{#2}}}%
+\define at key{adjbox}{bgimage*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at bgimage
+    }{%
+        \adjbox at bgimage{}{#1}%
+    }#1{}\@nnil{}%
 }
+\def\adjbox at bgimage#1#2#3\@nnil#4{%
+    \adjbox at Gin@Add{\@Collectbox{\@backgroundbox\adjustimage{#1#4}{#2}}}%
+}
+\define at key{adjbox}{foreground}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at foreground
+    }{%
+        \adjbox at foreground{}{#1}%
+    }#1{}{}\@nnil
+    {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
+}
+\define at key{adjbox}{foreground*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at foreground
+    }{%
+        \adjbox at foreground{}{#1}%
+    }#1{}{}\@nnil{}%
+}
+\def\adjbox at foreground#1#2#3\@nnil#4{%
+    \adjbox at Gin@Add{\@Collectbox{\@foregroundbox\adjustbox{#1#4}{#2}}}%
+}
+\def\@foregroundbox#1#2#3{%
+    \leavevmode
+    \hbox to \width{%
+        \BOXCONTENT
+        \hskip-\width
+        \hss
+        \adjbox at 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 at key{adjbox}{background}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at background
+    }{%
+        \adjbox at background{}{#1}%
+    }#1{}{}\@nnil
+    {,width=\pwidth,totalheight=\ptotalheight,raise=\depth-\pdepth}%
+}
+\define at key{adjbox}{background*}{%
+    \@ifnextchar\bgroup{%
+        \adjbox at background
+    }{%
+        \adjbox at background{}{#1}%
+    }#1{}{}\@nnil{}%
+}
+\def\adjbox at background#1#2#3\@nnil#4{%
+    \adjbox at Gin@Add{\@Collectbox{\@backgroundbox\adjustbox{#1#4}{#2}}}%
+}
+\def\@backgroundbox#1#2#3{%
+    \leavevmode
+    \hbox to \width{%
+        \hss
+        \adjbox at 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 at key\adjbox at fam{lap}{%
     \@ifnextchar\bgroup{%
         \adjbox at lapbox
@@ -844,7 +1320,9 @@
     }#2\@nnil
 }
 \def\adjbox@@page#1#2\@nnil{%
-    \def\adjbox at collectbox##1{\collectbox@{\adjbox at set\begin{#1}#2\adjbox at reset}{##1}{\end{#1}}}%
+    \adjbox at innercode
+        {\adjbox at set\begin{#1}#2\adjbox at reset\ignorespaces}%
+        {\end{#1}}%
 }
 \def\adjbox at set{%
     \let\adjbox at origsetlength\setlength
@@ -864,7 +1342,7 @@
 }
 \def\@@stackbox#1#2[#3]{%
     \collectbox@
-        {\begin{varwidth}[#2]{\linewidth}\csname adjbox at halign@#1\endcsname#3}
+        {\begin{varwidth}[#2]{\linewidth}\csname adjbox at halign@#1\endcsname#3\ignorespaces}
         \BOXCONTENT
         {\end{varwidth}}%
 }
@@ -886,11 +1364,12 @@
     \fi\fi
 }
 \def\adjbox@@stack#1#2#3{%
-    \def\adjbox at collectbox##1{%
-        \collectbox@{%
-            \begin{varwidth}[#2]{\linewidth}%
-            \csname adjbox at halign@#1\endcsname#3%
-        }{##1}{\end{varwidth}}%
+    \adjbox at innercode{%
+        \begin{varwidth}[#2]{\linewidth}%
+        \csname adjbox at halign@#1\endcsname#3%
+        \ignorespaces
+    }{%
+        \end{varwidth}%
     }%
 }
 \IfFileExists{varwidth.sty}
@@ -914,8 +1393,9 @@
     \ifcollectboxenv
         \adjbox at innerenv{#1}{#2}\@nnil
     \else
-        \def\adjbox at collectbox##1{\collectbox at tab{#1}{#2}{}{##1}{}}%
+        \def\adjbox at collectbox##1{\collectbox at tab{#1}{#2}{\adjbox at begininnercode}{##1}{\adjbox at endinnercode}}%
     \fi
+    \chardef\adjbox at innerlevel\tw@
 }
 \define at key{ADJBOX}{tabular*}{%
     \adjbox at tabular{tabular*}#1\@nnil
@@ -932,8 +1412,9 @@
     \ifcollectboxenv
         \adjbox at innercode{\(\begin{array}#1}{\end{array}\)}%
     \else
-        \def\adjbox at collectbox##1{\collectbox at tab{array}{#1}{\(}{##1}{\)}}%
+        \def\adjbox at collectbox##1{\collectbox at tab{array}{#1}{\adjbox at begininnercode\(}{##1}{\)\adjbox at endinnercode}}%
     \fi
+    \chardef\adjbox at innerlevel\tw@
 }
 \define at key{ADJBOX}{innerenv}{%
     \@ifnextchar\bgroup{%
@@ -943,8 +1424,11 @@
         \remove at to@nnil
     }#1\@nnil
 }
+\adjbox at let@key{ADJBOX}{inner env}{innerenv}
 \def\adjbox at innerenv#1#2\@nnil{%
-    \def\adjbox at collectbox##1{\collectbox@{\begin{#1}#2}{##1}{\end{#1}}}%
+    \adjbox at innercode
+        {\begin{#1}#2}%
+        {\end{#1}}%
 }%
 \def\adjbox@@innerenv#1{%
     \adjbox@@@innerenv{#1}{}%
@@ -957,10 +1441,28 @@
 }%
 \define at key{ADJBOX}{innercode}{%
     \adjbox at innercode#1{}{}%
+}%
+\adjbox at let@key{ADJBOX}{inner code}{innercode}
+\def\adjbox at innercode{%
+    \ifcase\adjbox at innerlevel
+    \relax% 0: first inner code
+        \def\adjbox at collectbox##1{\collectbox@{\adjbox at begininnercode\adjustbox at ignorespaces}{##1}{\adjustbox at unskip\adjbox at endinnercode}}%
+        \chardef\adjbox at 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 at begininnercode#1}%
+    \edef\adjbox at begininnercode{\the\@temptokena}%
+    \@temptokena{#2}%
+    \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\adjbox at endinnercode}%
+    \edef\adjbox at endinnercode{\the\@temptokena}%
 }
-\def\adjbox at innercode#1#2{%
-    \def\adjbox at collectbox##1{\collectbox@{#1}{##1}{#2}}%
-}%
 \define at key\adjbox at fam{label}{%
     \def\adjbox at label{\label{#1}}%
 }
@@ -1013,6 +1515,8 @@
 }
 \def\adjbox at caption@table at pos{1}
 \def\adjbox at addfloat#1#2#3#4{%
+    \Gin at esetsize
+    \@tempswatrue
     \ifnum\adjbox at caption@pos>10
         \chardef\adjbox at caption@pos=0\csname adjbox at caption@#1 at pos\endcsname\relax
     \fi

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/tc-dvips.def	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at pt\@tempdima\space}%
-        \edef\DEPTH{\strip at pt\dp#1\space}%
-        \edef\WIDTH{\strip at pt\wd#1\space}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at 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 at settobp\DEPTHmRADIUSBL\@tempdima
+        \adjcalc at settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
+        \adjcalc at settobp\HEIGHT{-\ht#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\RADIUSTL{#2}%
+        \adjcalc at settobp\RADIUSTR{#3}%
+        \adjcalc at settobp\RADIUSBR{#4}%
+        \adjcalc at settobp\RADIUSBL{#5}%
+        \adjcalc at settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
+        \adjcalc at settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
+        \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+        \adjcalc at settobp\DEPTHmRADIUSBR{\dp#1-#4}%
+        \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+        \adjcalc at 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 at settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
+        \adjcalc at settobp\HEIGHT{-\ht#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\RADIUSTL{#2}%
+        \adjcalc at settobp\RADIUSTR{#3}%
+        \adjcalc at settobp\RADIUSBR{#4}%
+        \adjcalc at settobp\RADIUSBL{#5}%
+        \adjcalc at settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
+        \adjcalc at settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
+        \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+        \adjcalc at settobp\DEPTHmRADIUSBR{\dp#1-#4}%
+        \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+        \adjcalc at settobp\DEPTHmRADIUSBL{\dp#1-#5}%
+        \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at 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 at endgroup
+        }%
+        \hskip \wd#1%
+    }%
+    \adjsetlength\@tempdima{.5\fboxrule}%
+    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
+}
 \endinput
 %%
 %% End of file `tc-dvips.def'.

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pdftex.def	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at defaultbp\WIDTH{\wd#1}%
-        \Gin at defaultbp\DEPTH{\dp#1}%
-        \@tempdima\ht#1%
-        \advance\@tempdima\dp#1%
-        \Gin at defaultbp\TOTALHEIGHT{\@tempdima}%
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at 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 at bpdimens#1#2#3#4#5{%
+    \adjcalc at settobp\TOTALHEIGHT{\ht#1+\dp#1}%
+    \adjcalc at settobp\HEIGHT{\ht#1}%
+    \adjcalc at settobp\DEPTH{-\dp#1}%
+    \adjcalc at settobp\WIDTH{\wd#1}%
+    \adjcalc at settobp\RADIUSTL{#2}%
+    \adjcalc at settobp\RADIUSTR{#3}%
+    \adjcalc at settobp\RADIUSBR{#4}%
+    \adjcalc at settobp\RADIUSBL{#5}%
+    \adjcalc at settobp\RADIUSTLb{\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTL{\ht#1-#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTLb{\ht#1-\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTR{\ht#1-#3}%
+    \adjcalc at settobp\HEIGHTmRADIUSTRb{\ht#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTRb{\wd#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\RADIUSBRmDEPTH{#4-\dp#1}%
+    \adjcalc at settobp\RADIUSBRmDEPTHb{\tc at bezfacn#4-\dp#1}%
+    \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+    \adjcalc at settobp\WIDTHmRADIUSBRb{\wd#1-\tc at bezfacn#4}%
+    \adjcalc at settobp\RADIUSBLmDEPTH{#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLmDEPTHb{\tc at bezfacn#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLb{\tc at bezfacn#5}%
+    \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+}
+\def\@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        \pdfsave
+        \pdfliteral direct {%
+            \@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \pdfsave
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at rndframe@color
             \pdfliteral direct {%
-                0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re W n
+                \LINEWIDTH w
+                \@clip at roundedboxpath@pdfcode
+                h s
             }%
-            \hbox to 0pt{\copy#1\hss}%
+            \color at endgroup
+        }%
         \pdfrestore
-        \hskip \wd#1
+        \hskip\wd#1%
     }%
+    \adjsetlength\@tempdima{.5\fboxrule}%
+    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
 }
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/tc-pgf.def	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at 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'.

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/tc-xetex.def	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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,25 +17,104 @@
 %% 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 at defaultbp\WIDTH{\wd#1}%
-        \Gin at defaultbp\DEPTH{\dp#1}%
-        \@tempdima\ht#1%
-        \advance\@tempdima\dp#1%
-        \Gin at defaultbp\TOTALHEIGHT{\@tempdima}%
-        \special{pdf:bcontent }%
-        \special{%
-            pdf:literal direct
-                0 -\DEPTH\space \WIDTH\space \TOTALHEIGHT\space re
+        \adjcalc at settobp\WIDTH{\wd#1}%
+        \adjcalc at settobp\DEPTH{\dp#1}%
+        \adjcalc at 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 at bpdimens#1#2#3#4#5{%
+    \adjcalc at settobp\TOTALHEIGHT{\ht#1+\dp#1}%
+    \adjcalc at settobp\HEIGHT{\ht#1}%
+    \adjcalc at settobp\DEPTH{-\dp#1}%
+    \adjcalc at settobp\WIDTH{\wd#1}%
+    \adjcalc at settobp\RADIUSTL{#2}%
+    \adjcalc at settobp\RADIUSTR{#3}%
+    \adjcalc at settobp\RADIUSBR{#4}%
+    \adjcalc at settobp\RADIUSBL{#5}%
+    \adjcalc at settobp\RADIUSTLb{\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTL{\ht#1-#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTLb{\ht#1-\tc at bezfacn#2}%
+    \adjcalc at settobp\HEIGHTmRADIUSTR{\ht#1-#3}%
+    \adjcalc at settobp\HEIGHTmRADIUSTRb{\ht#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTR{\wd#1-#3}%
+    \adjcalc at settobp\WIDTHmRADIUSTRb{\wd#1-\tc at bezfacn#3}%
+    \adjcalc at settobp\RADIUSBRmDEPTH{#4-\dp#1}%
+    \adjcalc at settobp\RADIUSBRmDEPTHb{\tc at bezfacn#4-\dp#1}%
+    \adjcalc at settobp\WIDTHmRADIUSBR{\wd#1-#4}%
+    \adjcalc at settobp\WIDTHmRADIUSBRb{\wd#1-\tc at bezfacn#4}%
+    \adjcalc at settobp\RADIUSBLmDEPTH{#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLmDEPTHb{\tc at bezfacn#5-\dp#1}%
+    \adjcalc at settobp\RADIUSBLb{\tc at bezfacn#5}%
+    \adjcalc at settobp\LINEWIDTH{\fboxrule}%
+}
+\def\@clip at 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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        \special{pdf:content q }%
+        \special{pdf:literal direct
+            \@clip at roundedboxpath@pdfcode
+            h W n
         }%
-        \special{pdf:literal direct W }%
-        \special{pdf:literal direct n }%
-            \box#1%
-        \special{pdf:econtent }%
+        \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 at bpdimens{#1}{#2}{#3}{#4}{#5}%
+        %
+        \hbox to 0pt{\copy#1\hss}%
+        \hbox to 0pt{%
+            \color at setgroup
+            \adjbox at rndframe@color
+            \special{pdf:content q }%
+            \special{pdf:literal direct
+                \LINEWIDTH w
+                \@clip at 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 at endgroup
+        }%
+        \hskip\wd#1%
+    }%
+    \adjsetlength\@tempdima{.5\fboxrule}%
+    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
+}
 \endinput
 %%
 %% End of file `tc-xetex.def'.

Modified: trunk/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty	2018-04-09 21:14:12 UTC (rev 47404)
+++ trunk/Master/texmf-dist/tex/latex/adjustbox/trimclip.sty	2018-04-09 21:14:28 UTC (rev 47405)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin at scharrer-online.de>
+%% Copyright (C) 2011-2018 by Martin Scharrer <martin at 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 at driver{tc-\Gin at driver}
-\DeclareOption{pgf}{\def\tc at driver{tc-pgf.def}\PassOptionsToPackage{pgf}{graphicx}}
+\DeclareOption{pgf}{\def\tc at driver{tc-pgf.def}\AtEndOfPackage{\RequirePackage{pgf}}}
 \DeclareOption{pdftex}{\def\tc at driver{tc-pdftex.def}\PassOptionsToPackage{pdftex}{graphicx}}
 \DeclareOption{xetex}{\def\tc at driver{tc-xetex.def}\PassOptionsToPackage{xetex}{graphicx}}
 \DeclareOption{dvips}{\def\tc at driver{tc-dvips.def}\PassOptionsToPackage{dvips}{graphicx}}
@@ -247,6 +247,7 @@
     \@viewportbox{#1}{#2}{#3}{#4}{#5}%
     \@cliptoboxdim{#1}%
 }
+\def\tc at bezfacn{0.44771525}%
 \InputIfFileExists{\tc at driver}{%
     {\let\on at line\@gobble
     \PackageInfo{trimclip}{Using driver '\tc at driver'.}}%



More information about the tex-live-commits mailing list