diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx | 948 |
1 files changed, 833 insertions, 115 deletions
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx index 7453b574924..ebcfeb71763 100644 --- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx +++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %<=*COPYRIGHT> -%% Copyright (C) 2011-2018 by Martin Scharrer <martin@scharrer-online.de> +%% Copyright (C) 2011-2019 by Martin Scharrer <martin@scharrer-online.de> %% ---------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -26,10 +26,10 @@ %<*driver> \ProvidesFile{adjustbox.dtx}[% %<=*DATE> - 2018/04/08 + 2019/01/04 %<=/DATE> %<=*VERSION> - v1.1 + v1.2 %<=/VERSION> DTX file for the adjustbox package] \documentclass[a4paper]{ydoc}[2011/08/11] @@ -38,6 +38,7 @@ \usepackage[utf8]{inputenc} \usepackage{fourier} \usepackage{newverbs} +\usepackage{xparse} \MakeSpecialShortVerb\qverb\" %\AtBeginDocument{\MakeShortMacroArgs\`\relax} %\AtEndDocument{\DeleteShortVerb\`} @@ -147,7 +148,7 @@ % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ^^A Title page ((( -% \CheckSum{2141} +% \CheckSum{3447} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -238,6 +239,22 @@ % * Several bug fixes. % * Support for round corners and frames. % } +% \changes{v1.2}{2019/01/04}{%^^A +% * Added missing 'clip' feature for rounded frames. +% * Changed order of corner values for rounded frames. This includes an update to the clipping drivers. +% * Corrected 'adjnofloat' environment used by the 'nofloat' key to support the 'hypcap' feature of the 'caption' and 'hypcap' packages. +% * Updated manual description of `export` option as requested by Issue #9. +% * Updated manual to use (left, bottom, right, top) for the side values instead of (llx, lly, urx, ury). +% * Some other improvements in the manual. +% * Added keys and matching commands and environments to align to the page margins and text area borders: +% 'pagecenter', 'pageleft', 'pageright', 'pageinner', 'pageouter', +% 'textareacenter', 'textarealeft', 'textarearight', 'textareainner', 'textareaouter'. +% * Added 'noindent' key. +% * Added \newadjustimage and \NewAdjustImage commands to define custom versions of \adjustimage with predefined key +% lists. This include variation to renew, provide and declare such macros. +% * Added \provideadjustboxenv and \declareadjustboxenv. +% * Added \provideadjustboxcmd and \declareadjustboxcmd. +% } % % \GetFileInfo{adjustbox.dtx} % @@ -317,8 +334,10 @@ % This package accepts the following options: % % \begin{description}\def\oitem#1{\item[{\normalfont\opt{#1}}]} -% \oitem{export} Exports most keys of \Macro\adjustbox to \Macro\includegraphics so that they can be used with this -% macro as well. +% \oitem{export} Exports the keys of \Macro\adjustbox to \Macro\includegraphics so that they can be used with this +% macro as well. Note that not all keys will works properly with \Macro\includegraphics as its internal +% code does not support all features. If problems occur the option |Export| should be used. +% For new documents it is recommended to use the macro \Macro\adjustimage{<keys>}{<filename>} instead. % \oitem{Export} Sets \Macro\includegraphics to be identical to \Macro\adjincludegraphics, which also allows the usage % of all \Macro\adjustbox keys. % \oitem{pgf} This option is passed to \pkg{trimclip} and makes it to use the \pkg{pgf} package for all clip operations. @@ -436,6 +455,11 @@ % yet. % % +% \DescribeMacro\declareadjustboxenv{<name>}[<num>][<default>]{<key=value,\ldots>} +% \DescribeMacro\declareadjustboxenv*{<name>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxenv and \Macro\newadjustboxenv* but will always define a macro/environment even if it does already exist. +% +% % \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. @@ -451,11 +475,64 @@ % \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. % +% +% \DescribeMacro\provideadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxcmd but will define the macro only if it does not exist yet. +% +% +% \DescribeMacro\declareadjustboxcmd{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustboxcmd but will define the macro in any case even if it does exist yet.% +% +% +% \DescribeMacro\newadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% \DescribeMacro\renewadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% \DescribeMacro\provideadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% These macros allow to define new versions of \Macro\adjustimage with predefined key lists. +% The new define image macros can also have arguments which can be used in the predefined key list to +% substitude values or one or multiple keys. +% +% They work like \Macro\newcommand, \Macro\renewcommand and \Macro\providecommand, respectively, where +% \meta{num} is the number of arguments and \meta{default} provides a default value for the then optional +% first argument. However, instead of a macro content a \meta{key=value} list must be present, which can +% contain the arguments (|#1|, |#2|, etc). If arguments are used as values they should be wrapped in braces. +% If there are only part of a value the whole value should be wrapped in braces. This is to avoid causes commas +% inside the arguments to cause issues with the key=value list. +% +% \begin{example} +% \begin{examplecode} +% \newadjustimage{\myimage}[2][red]{width={#2},cfbox={#1}}% +% \myimage{2cm}{example-image} +% \myimage[blue]{2cm}{example-image} +% \end{examplecode} +% \end{example} +% +% \DescribeMacro\declareadjustimage{<\textbackslash macro>}[<num>][<default>]{<key=value,\ldots>} +% Like \Macro\newadjustimage but will not cause an error if the macro is already defined. +% +% +% \DescribeMacro\NewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>} +% \DescribeMacro\RenewAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>} +% \DescribeMacro\ProvideAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>} +% \DescribeMacro\DeclareAdjustImage{<\textbackslash macro>}{<xparse argument specification>}{<key=value,\ldots>} +% These macros also allow to define new versions of \Macro\adjustimage with predefined key lists, but use +% the \pkg{xparse} package (which must be loaded separately!) and its macros \Macro\NewDocumentCommand, \Macro\RenewDocumentCommand, +% \Macro\ProvideDocumentCommand and \Macro\DeclareDocumentCommand instead of the standard \LaTeX\ macro creation +% macros. This allows a larger variety of optional and mandatory arguments. Please see the \pkg{xparse} manual +% for more details. +% +% \begin{example} +% \begin{examplecode} +% \NewAdjustImage{\myimage}{O{red}m}{width={#2},cfbox={#1}}% +% \myimage{2cm}{example-image} +% \myimage[blue]{2cm}{example-image} +% \end{examplecode} +% \end{example} +% +% % ^^A )))2 % \clearpage\subsection{Setting keys globally} ^^A (((2 % \vskip-\lastskip @@ -545,7 +622,7 @@ % % % \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 +% If no unit is provided for of the bounding box coordinates (left, bottom, right, top) 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 % the \Key{trim} and \Key{viewport} options of \pkg{graphicx}'s \Macro\includegraphics. Note that \pkg{graphicx} % converts all values, independent if a unit is provided or not, internally to bp, because graphics where traditionally @@ -569,19 +646,17 @@ % and environments (\env{trimbox}, \env{clipbox}, etc.) are included in the % accompanying \pkg{trimclip} package and are explained in its manual. % -% \DescribeKey{trim}'='<llx>~<lly>~<urx>~<ury> % \DescribeKey{trim}'='<all sites> % \DescribeKey{trim}'='<left/right>~<top/bottom> +% \DescribeKey{trim}'='<left>~<bottom>~<right>~<top> % This key represents the original \Key{trim} key of \Macro\includegraphics but accepts its value in different forms. % Unlike most other keys it always acts on the original content independent in which order it is used with other keys. -% The key trims the given amounts from the lower left (ll) and the upper right (ur) corner of the box. This means that -% the amount \meta{llx} is trimmed from the left side, \meta{lly} from the bottom and \meta{urx} and \meta{ury} from the -% right and top of the box, respectively. % If only one value is given it will be used for all four sites. -% If only two values are given the first one will be used for the left and right side (llx, urx) and the second for the -% bottom and top side (lly, ury). +% If only two values are given, seperated by a space, the first one will be used for the left and right side and the second for the +% bottom and top side. +% % -% \DescribeKey{viewport}'='<llx>~<lly>~<urx>~<ury> +% \DescribeKey{viewport}'='<left>~<bottom>~<right>~<top> % This key represents the original \Key{viewport} key of \Macro\includegraphics. % It always trims the original content to the given view port independent from its position. % @@ -594,10 +669,10 @@ % bad idea. % % -% \DescribeKey{Trim}'='<llx>~<lly>~<urx>~<ury> % \DescribeKey{Trim}'='<all sites> % \DescribeKey{Trim}'='<left/right>~<top/bottom> -% \DescribeKey{Viewport}'='<llx>~<lly>~<urx>~<ury> +% \DescribeKey{Trim}'='<left>~<bottom>~<right>~<top> +% \DescribeKey{Viewport}'='<left>~<bottom>~<right>~<top> % The normal \Key{trim} and \Key{viewport} keys are applied on the original content before any resizing or (most) other % keys take effect. This is because for \Macro\includegraphics the trimming is done by the internal graphic driver, % while the effects can be applied later (but can also be driver dependent). @@ -608,24 +683,26 @@ % has no effect on them. % % -% \DescribeKey{Clip}'='<llx>~<lly>~<urx>~<ury> % \DescribeKey{Clip}'='<all sites> % \DescribeKey{Clip}'='<left/right>~<top/bottom> -% \DescribeKey{Clip*}'='<llx>~<lly>~<urx>~<ury> +% \DescribeKey{Clip}'='<left>~<bottom>~<right>~<top> +% \DescribeKey{Clip*}'='<left>~<bottom>~<right>~<top> % The \Key{Clip} key will clip the given amounts from the current content and can be used several times if required. % 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> +% \DescribeKey{rndcorners}'='<left corners>~<right corners> +% \DescribeKey{rndcorners}'='<upper left>~<upper right>~<lower left>~<lower right> % 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. +% The radius of the every round corner can be given separately if wanted. If only one value is given +% it is used for all four corners. If only two values are given they will be used for the left and right side, respectively. +% 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. -% +% Please see also the related keys \Key{rndfbox} and \Key{rndframe}, which allow to add a rounded frame around the content as well. % % % ^^A )))2 @@ -634,9 +711,9 @@ % % \DescribeKey{margin}'='<all sites> % \DescribeKey{margin}'='<left/right>~<top/bottom> -% \DescribeKey{margin}'='<llx>~<lly>~<urx>~<ury> +% \DescribeKey{margin}'='<left>~<bottom>~<right>~<top> % This key can be used to add a margin (white space) around the content. It can be seen as the opposite of \Key{Trim}. -% The original baseline of the content is preserved because \meta{lly} is added to the depth. +% The original baseline of the content is preserved because \meta{bottom} is added to the depth. % It is also available under the alternative name \Key{padding}, which can be used to more visually distinguish an inner % margin from an outer margin e.g.\ if a frame is added. % @@ -648,8 +725,8 @@ % % \DescribeKey{margin*}'='<all sites> % \DescribeKey{margin*}'='<left/right>~<top/bottom> -% \DescribeKey{margin*}'='<llx>~<lly>~<urx>~<ury> -% This starred version is almost identical to the normal \Key{margin} key, but also raises the content by the \MacroArgs<lly> +% \DescribeKey{margin*}'='<left>~<bottom>~<right>~<top> +% This starred version is almost identical to the normal \Key{margin} key, but also raises the content by the \MacroArgs<bottom> % amount, so that the original depth is preserved instead of the original baseline. % Note that while \Key{margin} is basically the opposite of \Key{Trim}, \Key{margin*} is not the opposite of \Key{Trim*}. % Instead it also takes the same values as the unstarred key and not viewport values like \Key{Trim*}. @@ -893,12 +970,12 @@ % \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>} +% \DescribeKey{rndframe}'='<radius for all four corners> +% \DescribeKey{rndframe}'='<left corners>~<right corners> +% \DescribeKey{rndframe}'='<upper left>~<upper right>~<lower left>~<lower right> +% \DescribeKey{rndframe}'='{<options>}{<radius for all four corners>} +% \DescribeKey{rndframe}'='{<options>}{<left corners>~<right corners>} +% \DescribeKey{rndframe}'='{<options>}{<upper left>~<upper right>~<lower left>~<lower right>} % % \begingroup % \colorlet{keydesc}{keydesc!50!green} @@ -931,7 +1008,7 @@ % \DescribeMacro\rndcornersbox % \DescribeMacro\rndframebox % \DescribeMacro\rndfbox -% Standlone macro versions of the corresponding keys. See there for the list of arguments. +% Standalone macro versions of the corresponding keys. See there for the list of arguments. % % ^^A )))2 % \clearpage\subsection{Vertical Alignment} ^^A (((2 @@ -1138,8 +1215,80 @@ % If the content is wider than the available width it will stick into the outer inner without causing an overfull hbox warning. % % +% \DescribeKey{pagecenter} +% \DescribeKey{pagecenter}'='<width> +% This key centers the content relative to the page and independent from the text area. Afterwards the content has the same distance to the +% left and right page borders. It differs from the \Key{center} key when the left and right page margins are different which is the case in +% |twoside| documents or in environments which change the margins. +% +% Note that the content will look misalign to the text paragraphs before and afterwards and is therefore only +% pleasing for overwide images or similar content. +% +% The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected +% following material will be placed on the same line while maybe overlapping the content. +% Larger values will cause an |Overfull \hbox| warning. +% +% \DescribeKey{pageleftalign} +% \DescribeKey{pageleftalign}'='<width> +% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it. +% +% \DescribeKey{pagerightalign} +% \DescribeKey{pagerightalign}'='<width> +% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the left side of the page instead of centering it. +% +% \DescribeKey{pageinner} +% \DescribeKey{pageinner}'='<width> +% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the inner side of the page instead of centering it. +% This assumes that the document is compiled in |twoside| mode. +% In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the page. +% +% \DescribeKey{pageouter} +% \DescribeKey{pageouter}'='<width> +% Similar to \Key{pagecenter}\relax{} (see remarks there) but aligns the content on the outer side of the page instead of centering it. +% This assumes that the document is compiled in |twoside| mode. +% In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the page. +% +% +% \DescribeKey{textareacenter} +% \DescribeKey{textareacenter}'='<width> +% This key centers the content on the text area (the box with size \Macro\textwidth$\times$\Macro\textheight containing the text on a page) +% even if the box is inside an indending environment like \env{enumerate}. For this it is assumed that the adjusted box is on the start +% of a line or paragraph. If this is not the case the content will be overlapping the material on its left side. +% +% The optional width defaults to \Macro\linewidth and determines the official width of the content. If a smaller value is selected +% following material will be placed on the same line while maybe overlapping the content. +% Larger values will cause an |Overfull \hbox| warning.% +% +% +% \DescribeKey{textareatalign} +% \DescribeKey{textareatalign}'='<width> +% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it. +% +% \DescribeKey{textareatalign} +% \DescribeKey{textareatalign}'='<width> +% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the left side of the text area instead of centering it. +% +% \DescribeKey{textareainner} +% \DescribeKey{textareainner}'='<width> +% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the inner side of the text area instead of centering it. +% This assumes that the document is compiled in |twoside| mode. +% In |oneside| mode the macro is identical to \Key{pageleftalign}, i.e. always aligns to the left of the text area. +% +% \DescribeKey{textareaouter} +% \DescribeKey{textareaouter}'='<width> +% Similar to \Key{textareacenter}\relax{} (see remarks there) but aligns the content on the outer side of the text area instead of centering it. +% This assumes that the document is compiled in |twoside| mode. +% In |oneside| mode the macro is identical to \Key{pagerightalign}, i.e. always aligns to the right of the text area. +% +% +% +% \DescribeKey{noindent} +% This key will issue an \Macro\noindent for the \Macro\adjustbox to avoid a paragraph indention if it starts a paragraph. +% It does not expect a value and will ignore it if provided. +% +% % \DescribeMacro\centerbox[<width>]{<content>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \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 @@ -1147,7 +1296,7 @@ % % % \DescribeMacro\leftalignbox[<width>]{<content>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \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 @@ -1155,7 +1304,7 @@ % % % \DescribeMacro\rightalignbox[<width>]{<content>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \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 @@ -1163,7 +1312,7 @@ % % % \DescribeMacro\innersidebox[<width>]{<content>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \DescribeEnv[<content>]{innersidebox}[<width>] % Macro and environment version of the \Key{inner} 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 @@ -1171,13 +1320,91 @@ % % % \DescribeMacro\outersidebox[<width>]{<content>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \DescribeEnv[<content>]{outersidebox}[<width>] % Macro and environment version of the \Key{outer} 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\centerpagebox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{centerpagebox}[<width>] +% Macro and environment version of the \Key{centerpage} 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\pagecenterbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{pagecenterbox}[<width>] +% Macro and environment version of the \Key{pagecenterbox} 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\pageleftalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{pageleftalignbox}[<width>] +% Macro and environment version of the \Key{pageleftalignbox} 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\pagerightalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{pagerightalignbox}[<width>] +% Macro and environment version of the \Key{pagerightalignbox} 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\pageinnerbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{pageinnerbox}[<width>] +% Macro and environment version of the \Key{pageinnerbox} 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\pageouterbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{pageouterbox}[<width>] +% Macro and environment version of the \Key{pageouterbox} 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\textareacenterbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{textareacenterbox}[<width>] +% Macro and environment version of the \Key{textareacenterbox} 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\textareatalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{textareatalignbox}[<width>] +% Macro and environment version of the \Key{textareatalignbox} 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\textareatalignbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{textareatalignbox}[<width>] +% Macro and environment version of the \Key{textareatalignbox} 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\textareainnerbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{textareainnerbox}[<width>] +% Macro and environment version of the \Key{textareainnerbox} 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\textareaouterbox[<width>]{<content>} +% \vspace{-1.5\baselineskip}\nopagebreak +% \DescribeEnv[<content>]{textareaouterbox}[<width>] +% Macro and environment version of the \Key{textareaouterbox} 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. +% % \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. @@ -1378,9 +1605,9 @@ % % \DescribeMacro{\bgcolorbox}[<model>]{<color>} % \DescribeMacro{\bgcolorbox}*{<color macro>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \DescribeEnv[<content>]{bgcolorbox}[<model>]{<color>} -% \vspace{-1.5\baselineskip} +% \vspace{-1.5\baselineskip}\nopagebreak % \DescribeEnv[<content>]{bgcolorbox*}{<color macro>} % Standalone macro and environment versions of the \Key{bgcolorbox} and \Key{bgcolorbox*} keys. % @@ -1468,7 +1695,7 @@ % % % \DescribeKey{foreground}'='<foreground content> -% \DescribeKey{foreground}'='{<key=value pairs for image>}{<foreground content>} +% \DescribeKey{foreground}'='{<key=value pairs for content>}{<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). @@ -1479,7 +1706,7 @@ % \end{examples} % % \DescribeKey{foreground*}'='<foreground content> -% \DescribeKey{foreground*}'='{<key=value pairs for image>}{<foreground content>} +% \DescribeKey{foreground*}'='{<key=value pairs for content>}{<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. % @@ -1712,12 +1939,11 @@ % type. % A previously used \Key{caption} and \Key{label} will be added. % -% % \DescribeEnv[<content>]{adjnofloat}{<float type>} % This environment is used internally by \Key{nofloat} to create a non-floating replacement of the given float type % (|figure|, |table|, etc.). It can also be used directly with other code or be redefined to change the % behavior of \Key{nofloat}. -% Any redefinition should include |\def\@captype{#1}| to set the caption type. +% Any redefinition should include |\adjbox@nofloatcaptionsetup{#1}| to set the caption type. % The environment will be used in plain form, i.e.\ \Macro\adjnofloat\ldots\Macro\endadjnofloat, so % if a group is required in a redefinition it should be added manually using \Macro\begingroup and \Macro\endgroup. % @@ -1746,16 +1972,20 @@ % 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. +% Appends the given \LaTeX\ code after the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code +% added by the previous keys. +% +% It is recommended to wrap complex code into braces. % % \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 +% Prepends the given \LaTeX\ code before the currently accumulated content. Note that this is the original content of the adjusted box \emph{and} all code +% added by the previous keys. The content is wrapped into curly braces, so the given code can use it as a macro argument. +% 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. % +% It is recommended to wrap complex code into braces. +% +% % \DescribeKey{Precode}'='{<code before>} % Identical to \Key{precode} but does not sets the size of the content first. % @@ -2022,7 +2252,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\adjbox@addkeysbefore} +% \begin{macro}{\adjbox@addkeysbefore}[1]{<keys>} % \begin{macrocode} \def\adjbox@addkeysbefore#1{% \ifx\@nnil#1\@nnil @@ -2036,7 +2266,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\adjbox@addkeysafter} +% \begin{macro}{\adjbox@addkeysafter}[1]{<keys>} % \begin{macrocode} \def\adjbox@addkeysafter#1{% \begingroup @@ -2062,7 +2292,7 @@ % % % -% \begin{macro}{\adjustbox} +% \begin{macro}{\adjustbox}[1]{<keys>} % Now processes the keys before the box is read to allow for parbox or similar modes. % % This code was originally adapted from the \Macro\Gin@ii macro from the |graphicx| package. @@ -2113,10 +2343,10 @@ \setkeys*{ADJBOX}% } % \end{macrocode} -% \end{environment} +% \end{macro} % % -% \begin{macro}{\adjustbox@} +% \begin{macro}{\adjustbox@}[1]{<keys>} % Second part of \Macro\adjustbox, after the content has been boxed. % This sets the dimension macros, processes the keys and finally typesets the content. % \begin{macrocode} @@ -2177,7 +2407,7 @@ \catcode`\= 12 \gdef\adjbox@comma@xii{,}% \gdef\adjbox@equal@xii{=}% -% \end{macro} +% \end{macrocode} % % \begin{macro}{\adjbox@kvsanitize} % \begin{macrocode} @@ -2366,7 +2596,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\adjincludegraphics} +% \begin{macro}{\adjincludegraphics}[2]{<keys>}{<filename>} % Simple wrapper to use \Macro\adjustbox for images in the same format of \Macro\includegraphics. % This allows to simply do |\let\includegraphics\adjincludegraphics|, which is done by the \opt{Export} option. % \begin{macrocode} @@ -2405,32 +2635,72 @@ % \end{macro} % % -% \begin{macro}{\newadjustboxcmd} +% \begin{macro}{\renewadjustboxenv} % \begin{macrocode} -\newcommand*\newadjustboxcmd{% +\newcommand*\renewadjustboxenv{% \begingroup - \let\@@@newadjustboxenv\@@@newadjustboxcmd - \def\new@adjustbox{\newcommand}% - \newadjustboxenv@ + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox{\renewenvironment}% + \newadjustboxenv@ + }{% + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ + }% } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\newadjustboxenv} +% \begin{macro}{\provideadjustboxenv} % \begin{macrocode} -\newcommand*\renewadjustboxenv{% +\newcommand*\provideadjustboxenv{% \begingroup \@ifstar{% \let\@@@newadjustboxenv\@@@newadjustboxenv@ - \def\new@adjustbox{\renewenvironment}% + \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}% \newadjustboxenv@ }{% - \def\new@adjustbox{\renewcommand}% + \def\new@adjustbox{\providecommand}% \newadjustboxenv@ }% } % \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\declareadjustboxenv} +% \begin{macrocode} +\newcommand*\declareadjustboxenv{% + \begingroup + \@ifstar{% + \let\@@@newadjustboxenv\@@@newadjustboxenv@ + \def\new@adjustbox##1{% + \expandafter\let\csname ##1\endcsname\@undefined + \newenvironment{##1}% + }% + \newadjustboxenv@ + }{% + \def\new@adjustbox##1{% + \let##1\@undefined + \newcommand{##1}% + }% + \newadjustboxenv@ + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newadjustboxcmd} +% \begin{macrocode} +\newcommand*\newadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +% \end{macrocode} % \end{macro} % % @@ -2446,24 +2716,31 @@ % \end{macro} % % -% \begin{macro}{\newadjustboxenv} +% \begin{macro}{\provideadjustboxcmd} % \begin{macrocode} -\newcommand*\provideadjustboxenv{% +\newcommand*\provideadjustboxcmd{% \begingroup - \@ifstar{% - \let\@@@newadjustboxenv\@@@newadjustboxenv@ - \def\new@adjustbox{\@star@or@long\adjustbox@provideenvironment}% - \newadjustboxenv@ - }{% - \def\new@adjustbox{\providecommand}% - \newadjustboxenv@ - }% + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ } % \end{macrocode} -% \end{macro} +% \end{macro}% % % -% \begin{macro}{\adjustbox@provideenvironment} +% \begin{macro}{\provideadjustboxcmd} +% \begin{macrocode} +\newcommand*\declareadjustboxcmd{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustboxcmd + \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\adjustbox@provideenvironment}[1]{<environment name>} % 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. @@ -2496,7 +2773,7 @@ % \end{macro} % % -% \begin{macro}{\newadjustboxenv@} +% \begin{macro}{\newadjustboxenv@}[1]{<environment name>} % \begin{macrocode} \def\newadjustboxenv@#1{% \@ifnextchar{[}% @@ -2507,7 +2784,7 @@ % \end{macro} % % -% \begin{macro}{\@newadjustboxenv} +% \begin{macro}{\@newadjustboxenv}[2]{<environment name>}{<optional argument>} % \begin{macrocode} \def\@newadjustboxenv#1[#2]{% \@ifnextchar{[}% @@ -2518,7 +2795,7 @@ % \end{macro} % % -% \begin{macro}{\@@newadjustboxenv} +% \begin{macro}{\@@newadjustboxenv}[3]{<environment name>}{<previous optional argument>}{<optional argument>} % \begin{macrocode} \def\@@newadjustboxenv#1#2[#3]{% \@@@newadjustboxenv{#1}{[#2][#3]}% @@ -2527,7 +2804,7 @@ % \end{macro} % % -% \begin{macro}{\@@@newadjustboxenv@} +% \begin{macro}{\@@@newadjustboxenv@}[3]{<environment name>}{<optional arguments in brackets>}{<keys>} % \begin{macrocode} \def\@@@newadjustboxenv@#1#2#3{% \expandafter @@ -2544,7 +2821,7 @@ % \end{macro} % % -% \begin{macro}{\@@@newadjustboxenv} +% \begin{macro}{\@@@newadjustboxenv}[3]{<environment name>}{<optional arguments in brackets>}{<keys>} % \begin{macrocode} \def\@@@newadjustboxenv#1#2#3{% \expandafter @@ -2560,7 +2837,7 @@ % \end{macro} % % -% \begin{macro}{\@@@newadjustboxcmd} +% \begin{macro}{\@@@newadjustboxcmd}[3]{<environment name>}{<optional arguments in brackets>}{<keys>} % \begin{macrocode} \def\@@@newadjustboxcmd#1#2#3{% \expandafter @@ -2573,13 +2850,147 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\newadjustimage} +% \begin{macrocode} +\newcommand*\newadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\newcommand}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\renewadjustimage} +% \begin{macrocode} +\newcommand*\renewadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\renewcommand}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro}% +% +% \begin{macro}{\provideadjustimage} +% \begin{macrocode} +\newcommand*\provideadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox{\providecommand}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\declareadjustimage} +% \begin{macrocode} +\newcommand*\declareadjustimage{% + \begingroup + \let\@@@newadjustboxenv\@@@newadjustimage + \def\new@adjustbox##1{\let##1\@undefined\newcommand{##1}}% + \newadjustboxenv@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@@newadjustimage}[3]{<macro name>}{<optional arguments in brackets>}{<keys>} +% \begin{macrocode} +\def\@@@newadjustimage#1#2#3{% + \expandafter + \endgroup + \new@adjustbox{#1}#2{% + \begingroup + \def\@tempa####1{% + \def\IMAGEFILENAME{####1}% + \@adjustbox{#3}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}% + }% + \@tempa + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\NewAdjustImage} +% \begin{macrocode} +\newcommand*\adjustbox@NewAdjustImage[4]{% + \adjustbox@checkforxparse + #1{#2}{#3}{% + \begingroup + \def\@tempa####1{% + \def\IMAGEFILENAME{####1}% + \@adjustbox{#4}{\Gin@clipfalse\expandafter\Gin@i\expandafter{\IMAGEFILENAME}}% + }% + \@tempa + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\NewAdjustImage} +% \begin{macrocode} +\newcommand*\NewAdjustImage{% + \adjustbox@NewAdjustImage\NewDocumentCommand +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\RenewDocumentCommand} +% \begin{macrocode} +\newcommand*\RenewAdjustImage{% + \adjustbox@NewAdjustImage\RenewDocumentCommand +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\ProvideAdjustImage} +% \begin{macrocode} +\newcommand*\ProvideAdjustImage{% + \adjustbox@NewAdjustImage\ProvideDocumentCommand +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\DeclareAdjustImage} +% \begin{macrocode} +\newcommand*\DeclareAdjustImage{% + \adjustbox@NewAdjustImage\ProvideDocumentCommand +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\NewAdjustImage} +% \begin{macrocode} +\def\adjustbox@checkforxparse{% + \begingroup + \expandafter\ifx\csname ver@xparse.sty\endcsname\relax + \PackageError{adjustbox}{% + The 'xparse' package must be loaded separately in\MessageBreak + order to use the following macros: \MessageBreak + \string\NewAdjustImage, + \string\RenewAdjustImage, \MessageBreak + \string\ProvideAdjustImage, + \string\DeclareAdjustImage}{} + \fi + \endgroup + \let\adjustbox@checkforxparse\relax +} +% \end{macrocode} +% \end{macro} +% % % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Internal code adding macros} ^^A ((( % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \begin{macro}{\adjbox@Gin@add} +% \begin{macro}{\adjbox@Gin@add}[1]{<code>} % \begin{macrocode} \def\adjbox@Gin@add#1{% \def\@tempa{#1}% @@ -2630,7 +3041,7 @@ % \end{macro} % % -% \begin{macro}{\@adjustboxkey} +% \begin{macro}{\@adjustboxkey}[1]{<key name>} % \begin{macrocode} \def\@adjustboxkey#1{% \@ifstar @@ -2982,9 +3393,10 @@ % % \begin{macro}{\rndframearoundbox@} % \begin{macrocode} -\def\rndframearoundbox@#1{% +\newif\ifadjbox@rndframe@clip +\def\rndframearoundbox@#1#2#3#4#5#6{% \setkeys{adjbox@rndframe}{#1}% - \@rndframearoundbox + \@rndframearoundbox{#2}{#3}{#4}{#5}{#6}{\ifadjbox@rndframe@clip\relax\fi}% } \define@key{adjbox@rndframe}{width}{% \adjsetlength\fboxrule{#1}% @@ -2999,6 +3411,9 @@ \def\adjbox@rndframe@color{#1}% } \let\adjbox@rndframe@color\relax +\define@key{adjbox@rndframe}{clip}[true]{% + \csname adjbox@rndframe@clip#1\endcsname +} % \end{macrocode} % \end{macro} % @@ -3078,7 +3493,7 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % -% \begin{macro}{\adjbox@halign} +% \begin{macro}{\adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>} % \begin{macrocode} \def\adjbox@halign#1#2#3{% \@collectbox{\@adjbox@halign{#1}{#2}{#3}}% @@ -3087,7 +3502,7 @@ % \end{macro} % % -% \begin{macro}{\@adjbox@halign} +% \begin{macro}{\@adjbox@halign}[3]{<official width>}{<aligner left>}{<aligner right>} % \begin{macrocode} \def\@adjbox@halign#1#2#3{% \begingroup @@ -3098,26 +3513,26 @@ % \end{macrocode} % \end{macro} % -% \begin{key}{adjbox}{center} +% \begin{key}{adjbox}{center}[1]{<official width>} % \begin{macrocode} \define@adjboxkey@defvalue{center}{\linewidth}{\adjbox@halign{#1}\hss\hss} % \end{macrocode} % \end{key} % -% \begin{key}{adjbox}{left} +% \begin{key}{adjbox}{left}[1]{<official width>} % \begin{macrocode} \define@adjboxkey@defvalue{left}{\linewidth}{\adjbox@halign{#1}\relax\hss} % \end{macrocode} % \end{key} % -% \begin{key}{adjbox}{right} +% \begin{key}{adjbox}{right}[1]{<official width>} % \begin{macrocode} \define@adjboxkey@defvalue{right}{\linewidth}{\adjbox@halign{#1}\hss\relax} % \end{macrocode} % \end{key} % % -% \begin{macro}{\centerbox} +% \begin{macro}{\centerbox}[1]{<official width>} % \begin{macrocode} \newcommand\centerbox[1][\linewidth]{% \collectboxcheckenv{centerbox}% @@ -3128,7 +3543,7 @@ % \end{macro} % % -% \begin{macro}{\leftalignbox} +% \begin{macro}{\leftalignbox}[1]{<official width>} % \begin{macrocode} \newcommand\leftalignbox[1][\linewidth]{% \collectboxcheckenv{leftalignbox}% @@ -3139,7 +3554,7 @@ % \end{macro} % % -% \begin{macro}{\rightalignbox} +% \begin{macro}{\rightalignbox}[1]{<official width>} % \begin{macrocode} \newcommand\rightalignbox[1][\linewidth]{% \collectboxcheckenv{rightalignbox}% @@ -3150,7 +3565,7 @@ % \end{macro} % % -% \begin{key}{adjbox}{outer} +% \begin{key}{adjbox}{outer}[1]{<official width>} % \begin{macrocode} \define@adjboxkey@defvalue{outer}{\linewidth}{% \outersidebox[{#1}]% @@ -3159,7 +3574,7 @@ % \end{key} % % -% \begin{key}{adjbox}{inner} +% \begin{key}{adjbox}{inner}[1]{<official width>} % \begin{macrocode} \define@adjboxkey@defvalue{inner}{\linewidth}{% \innersidebox[{#1}]% @@ -3168,7 +3583,7 @@ % \end{key} % % -% \begin{macro}{\outersidebox} +% \begin{macro}{\outersidebox}[1]{<official width>} % \begin{macrocode} \newcommand\outersidebox[1][\linewidth]{% \collectboxcheckenv{outersidebox}% @@ -3192,7 +3607,7 @@ % \end{macro} % % -% \begin{macro}{\innersidebox} +% \begin{macro}{\innersidebox}[1]{<official width>} % \begin{macrocode} \newcommand\innersidebox[1][\linewidth]{% \collectboxcheckenv{innersidebox}% @@ -3215,21 +3630,307 @@ % \end{macrocode} % \end{macro} % +% +% \begin{key}{adjbox}{pagecenter}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{pagecenter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pagecenterbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{pageleftalign}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{pageleftalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageleftalignbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{pagerightalign}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{pagerightalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pagerightalignbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{pageinner}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{pageinner}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageinnerbox[{#1}]}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{pageouter}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{pageouter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\pageouterbox[{#1}]}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{textareacenter}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{textareacenter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareacenterbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{textarealeftalign}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{textarealeftalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textarealeftalignbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{textarearightalign}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{textarearightalign}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textarearightalignbox[{#1}]}% +}% +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{textareainner}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{textareainner}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareainnerbox[{#1}]}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{textareaouter}[1]{<official width>} +% \begin{macrocode} +\define@key\adjbox@fam{textareaouter}[\linewidth]{% + \noindent\leavevmode + \adjbox@Gin@Add{\textareaouterbox[{#1}]}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{macro}{\pagecenterbox}[1]{<official width>} +% \begin{macrocode} +\newcommand\pagecenterbox[1][\linewidth]{% + \collectboxcheckenv{pagecenterbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@pagecenterbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi+.5\paperwidth-.5\@tempdimc-\@totalleftmargin}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@pagecenterbox}[2]{<official width>}{<lap amount>} +% \begin{macrocode} +\def\@pagecenterbox#1#2{% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \adjsetlength\@tempdima{#2}% + \ifdim\@tempdima<\z@ + \@tempdimb=-\@tempdima + \else + \@tempdimb=\@tempdima + \fi + \ifdim\@tempdima<\z@ + \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdimb{\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}\hss}\hskip\@tempdimc}% + \else + \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdimb{\hss\hb@xt@\@tempdimc{\hss\usebox\collectedbox\hss}}\hss}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\textareacenterbox}[1]{<official width>} +% \begin{macrocode} +\newcommand\textareacenterbox[1][\linewidth]{% + \collectboxcheckenv{textareacenterbox}% + \noindent\leavevmode + \@collectbox{\@pagecenterbox{#1}{-\@totalleftmargin+.5\textwidth-.5\linewidth}}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\pageleftalignbox}[1]{<official width>} +% \begin{macrocode} +\newcommand\pageleftalignbox[1][\linewidth]{% + \collectboxcheckenv{pageleftalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin}}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\pagerightalignbox}[1]{<official width>} +% Note: \Macro\@tempdimc holds the official width inside \Macro\@lapbox. +% \begin{macrocode} +\newcommand\pagerightalignbox[1][\linewidth]{% + \collectboxcheckenv{pagerightalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@lapbox{#1}{-1in-\hoffset-\ifoddpage\oddsidemargin\else\evensidemargin\fi-\@totalleftmargin+\paperwidth-(#1)}}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\textarealeftalignbox}[1]{<official width>} +% \begin{macrocode} +\newcommand\textarealeftalignbox[1][\linewidth]{% + \collectboxcheckenv{textarealeftalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@textarealeftalignbox{#1}}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\@textarealeftalignbox}[1]{<official width>} +% \begin{macrocode} +\def\@textarealeftalignbox#1{% + \adjsetlength\@tempdima{\@totalleftmargin}% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \leavevmode + \hb@xt@\@tempdimc{\hss\hb@xt@\@tempdima{\usebox\collectedbox\hss}\hskip\@tempdimc}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\textarearightalignbox}[1]{<official width>} +% \begin{macrocode} +\newcommand\textarearightalignbox[1][\linewidth]{% + \collectboxcheckenv{textarearightalignbox}% + \noindent\leavevmode\checkoddpage + \@collectbox{\@textarearightalignbox{#1}{+\textwidth}}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{\@textarearightalignbox}[1]{<official width>} +% \begin{macrocode} +\def\@textarearightalignbox#1#2{% + \adjsetlength\@tempdimc{#1}% + \ifdim\@tempdimc<\z@ + \@tempdimc=\z@ + \fi + \adjsetlength\@tempdima{-\@totalleftmargin+\textwidth-\@tempdimc}% + \ifdim\@tempdima<\z@ + \@tempdima=-\@tempdima + \fi + \leavevmode + \hb@xt@\@tempdimc{\hskip\@tempdimc\hb@xt@\@tempdima{\hss\usebox\collectedbox}\hss}% +} +% \end{macrocode} +% \end{macro}% +% +% +% \begin{macro}{pageinnerbox} +% \begin{macrocode} +\newcommand\pageinnerbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\pageleftalignbox + \else + \expandafter\pagerightalignbox + \fi +}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{pageouterbox} +% \begin{macrocode} +\newcommand\pageouterbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\pagerightalignbox + \else + \expandafter\pageleftalignbox + \fi +}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{textareaouterbox} +% \begin{macrocode} +\newcommand\textareainnerbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\textarealeftalignbox + \else + \expandafter\textarearightalignbox + \fi +}% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{textareaouterbox} +% \begin{macrocode} +\newcommand\textareaouterbox{% + \noindent\leavevmode\checkoddpage + \ifoddpageoroneside + \expandafter\textarearightalignbox + \else + \expandafter\textarealeftalignbox + \fi +}% +% \end{macrocode} +% \end{macro}% +% +% % \begin{macrocode} \IfFileExists{ifoddpage.sty}{% \RequirePackage{ifoddpage}% }{% - \renewcommand\outersidebox[1][]{% + \def\checkoddpage{% \PackageError{adjustbox}{% - The 'outer' and 'inner' keys as well as the\MessageBreak - \string\outersidebox\space and \string\innersidebox\space macros\MessageBreak - require the 'ifoddpage' package, which is not\MessageBreak - installed}{}% - }% - \let\innersidebox\outersidebox + The used key, macro or environment requires \MessageBreak + the 'ifoddpage' package which is not installed!}{}% + } }% % \end{macrocode} % +% +% \begin{key}{adjbox}{noindent} +% \begin{macrocode} +\define@key\adjbox@fam{noindent}[]{% + \noindent +} +% \end{macrocode} +% \end{key}% +% % ^^A ))) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Vertical alignment keys} ^^A ((( @@ -4901,7 +5602,7 @@ }% \adjbox@let@key{ADJBOX}{inner code}{innercode} % \end{macrocode} -% \end{macro} +% \end{key} % % % \begin{macro}{\adjbox@innercode} @@ -5083,18 +5784,35 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\adjbox@nofloatenv} +% \begin{macrocode} +\def\adjbox@nofloatenv{minipage} +% \end{macrocode} +% \end{macro} % +% \begin{macro}{\adjbox@nofloatcaptionsetup} +% Calls \Macro\captionsetup from the \pkg{caption} package if defined, otherwise sets \Macro\@captype directly. +% Calls \Macro\capstart from the \pkg{hypcap} package if defined. Both are done to ensure correct hypertargets on top +% of the content and not at the caption position. +% \begin{macrocode} +\def\adjbox@nofloatcaptionsetup#1{% + \@ifundefined{captionsetup}% + {\def\@captype{#1}}% + {\captionsetup{type={#1}}}% +\csname capstart\endcsname +} +% \end{macrocode} +% \end{macro}% % % \begin{environment}{adjnofloat} % Environment used for non-floats. % \begin{macrocode} \newenvironment{adjnofloat}[1]{% - \trivlist - \def\@captype{#1}% - \parindent\z@ - \item\relax + \par\noindent + \minipage{\linewidth}% + \adjbox@nofloatcaptionsetup{#1}% }{% - \endtrivlist + \endminipage\par } % \end{macrocode} % \end{environment} |