diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx | 711 |
1 files changed, 562 insertions, 149 deletions
diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx index 855ad15f342..798254d9739 100644 --- a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx +++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx @@ -1,31 +1,35 @@ % \iffalse meta-comment -% -% Copyright (C) 2011 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.3c -% of this license or (at your option) any later version. -% The latest version of this license is in -% -% http://www.latex-project.org/lppl.txt -% -% and version 1.3c or later is part of all distributions of LaTeX -% version 2008/05/04 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Martin Scharrer. -% -% This work consists of the files adjustbox.dtx, adjustbox.ins -% and the derived file adjustbox.sty. -% -% $Id$ +%<=*COPYRIGHT> +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% --------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files adjustbox.dtx, adjustbox.ins +%% and the derived file adjustbox.sty. +%% +%<=/COPYRIGHT> % \fi % % \iffalse %<*driver> -\ProvidesFile{adjustbox.dtx}[2011/08/21 v0.5a DTX File] +\ProvidesFile{adjustbox.dtx}[% +%<=*DATE> + 2011/10/30 +%<=/DATE> +%<=*VERSION> + v0.7 +%<=/VERSION> + DTX file for the adjustbox package] \expandafter\ifx\csname ifenglish\endcsname\relax \expandafter\newif\csname ifenglish\endcsname \englishtrue @@ -43,12 +47,12 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fourier} -\GetFileInfo{adjustbox.dtx} \usepackage{newverbs} \MakeSpecialShortVerb\qverb\" %\AtBeginDocument{\MakeShortMacroArgs\`\relax} %\AtEndDocument{\DeleteShortVerb\`} -\usepackage{adjustbox}[2011/08/21] +\GetFileInfo{adjustbox.dtx} +\usepackage{adjustbox}[\filedate] \usepackage{tikz} \normalmarginpar @@ -162,7 +166,7 @@ %</driver> % \fi % -% \CheckSum{1842} +% \CheckSum{2207} % % \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 @@ -188,6 +192,8 @@ % \changes{v0.5}{2011/08/13}{Added more macros and keys} % \changes{v0.5a}{2011/08/21}{Fixed \Key{left} and \Key{right} keys. Fixed \Key{valign}'='t} % \changes{v0.6}{2011/09/04}{Added tabular support.} +% \changes{v0.6a}{2011/10/29}{Fixed issue with keys affecting the content in an unwanted way.} +% \changes{v0.7}{2011/10/30}{Added \cs{adjustboxset} and \cs{adjustimage} macros.} % % \GetFileInfo{adjustbox.dtx} % @@ -218,13 +224,13 @@ % \end{abstract} % \else % \begin{abstract} -% Dieses Paket stellt einige Makros zur Verfügung die im \pkg{graphics} Paket vermisst werden +% Dieses Paket stellt einige Makros zur Verf^^c3^^bcgung die im \pkg{graphics} Paket vermisst werden % und \LaTeX{} Material zu beschneiden (\emph{trim}, \emph{clip}) oder allgemein zu modifizieren. % Die Makros erlauben Inhalt das im \emph{verbatim} Modus gesetzt ist. -% Ebenfalls werden passende Umgebungen für die Makros bereitgestellt. +% Ebenfalls werden passende Umgebungen f^^c3^^bcr die Makros bereitgestellt. % Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht, -% dass sowohl das PS und PDF Ausgabeformat unterstützt.\\ -% \textcolor{red}{Dieses Paket ist noch neu und seine Implementieren kann sich in zukünftigen Versionen noch ändern!} +% dass sowohl das PS und PDF Ausgabeformat unterst^^c3^^bctzt.\\ +% \textcolor{red}{Dieses Paket ist noch neu und seine Implementieren kann sich in zuk^^c3^^bcnftigen Versionen noch ^^c3^^a4ndern!} % \end{abstract} % \fi % @@ -232,7 +238,7 @@ % \section{Introduction} % 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. -% The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding +% The macros \Macro\scalebox, \Macro\resizebox and \Macro\rotatebox are also provided to apply the corresponding % operation on \LATeX{} material, which is subsequently placed inside a \Macro\hbox. % However no macros are provided to trim or clip \LATeX{} material, most likely because this operations % are not done by \TeX{} but by the output format, i.e. using PostScript (PS) or PDF operations. @@ -244,17 +250,17 @@ % author. % \else % \section{Einleitung} -% Das \LaTeX{} Paket \pkg{graphicx} (die erweiterte Version von \pkg{graphics}) stellt das Macro \Macro\includegraphics[<Optionen>]{<Dateiname>} zur Verfügung -% mit dem Bilddateien eingebunden werden können. Zahlreiche Optionen können benutzt werden um das Bild zu skalieren, an eine vorgegebene Größe anzupassen, es zu rotieren +% Das \LaTeX{} Paket \pkg{graphicx} (die erweiterte Version von \pkg{graphics}) stellt das Macro \Macro\includegraphics[<Optionen>]{<Dateiname>} zur Verf^^c3^^bcgung +% mit dem Bilddateien eingebunden werden k^^c3^^b6nnen. Zahlreiche Optionen k^^c3^^b6nnen benutzt werden um das Bild zu skalieren, an eine vorgegebene Gr^^c3^^b6^^c3^^9fe anzupassen, es zu rotieren % oder den Rand zu beschneiden. -% Ebenfalls stellt das Paket die Makros \Macro\scalebox\relax (skalieren), \Macro\resizebox\relax (Größe ändern) und \Macro\rotatebox\relax (rotieren) zur Verfügung um \LATeX{} Material, +% Ebenfalls stellt das Paket die Makros \Macro\scalebox\relax (skalieren), \Macro\resizebox\relax (Gr^^c3^^b6^^c3^^9fe ^^c3^^a4ndern) und \Macro\rotatebox\relax (rotieren) zur Verf^^c3^^bcgung um \LATeX{} Material, % z.B.\ normalen Text, entsprechend anzupassen. Dies wird dazu in eine horizontale Box (\Macro\hbox) gesetzt. % Allerdings fehlen Makros um \LATeX{} Material zu beschneiden, wobei der abgeschnittenen Rand entweder sichtbar bleibt (engl.: \emph{trim}) oder ausgeblendet wird (engl. \emph{clip}). % Dies ist wahrscheinlich der Fall, weil diese Operationen nicht von \TeX{} selbst vorgenommen werden, sondern von dem verwendeten Ausgabeformat, z.B.\ durch PostScript (PS) % oder PDF Operationen. % % Das \textsf{adjustbox} Paket definiert die Makros \Macro\clipbox und \Macro\trimbox, sowie das allgemeine \Macro\adjustbox Macro (engl.: \emph{adjust} = anpassen). -% Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht, dass sowohl das PS und PDF Ausgabeformat unterstützt. +% Das Beschneiden wird durch eine \env{pgfpicture} Umgebung des Pakets \pkg{pgf} verwirklicht, dass sowohl das PS und PDF Ausgabeformat unterst^^c3^^bctzt. % \fi % % \section{Package Option}\label{sec:options} @@ -338,9 +344,9 @@ % \def\urx{orx} % \def\ury{ory} % \def\TEXT{Inhalt} -% \def\height{Höhe} +% \def\height{H^^c3^^b6he} % \def\width{Weite} -% \def\totalheight{Totale Höhe} +% \def\totalheight{Totale H^^c3^^b6he} % \def\depth{Tiefe} % \def\factor{Faktor} % \def\xfactor{X-Faktor} @@ -353,23 +359,23 @@ % \section{Usage} % This section describes the usage of the provided macros, which are outlined in \autoref{sec:basicmacros}. % Possible advanced values for the macro arguments are mentioned in \autoref{sec:argval}. The existing verbatim support -% is explained in \autoref{sec:verbatim}. Finally \autoref{sec:alternatives} compares the existing macros with the +% is explained in \autoref{sec:verbatim}. Finally \autoref{sec:alternatives} compares the existing macros with the % corresponding options of \Macro\adjustbox. % Further box modification macros and keys are described in \autoref{sec:moremacros} and \autoref{sec:newkeys}, respectively. % % It is recommended to also read the \emph{Graphics Guide} (\pkg{grfguide}, i.e.~the manual of the \pkg{graphics}/|x| packages), -% to understand the existing options for \Macro\includegraphics. +% to understand the existing options for \Macro\includegraphics. % \else % \newpage % \section{Anleitung} % Dieser Abschnitt beschreibt die Verwendung der Makros dieses Pakets. Diese werden zuerst im \autoref{sec:basicmacros} beschrieben. -% \autoref{sec:argval} erklärt welche Werte in den Makroargumenten verwendet werden können. Die Makros unterstützen sogenannten +% \autoref{sec:argval} erkl^^c3^^a4rt welche Werte in den Makroargumenten verwendet werden k^^c3^^b6nnen. Die Makros unterst^^c3^^bctzen sogenannten % \emph{verbatim} (engl.: wortgetreu) Inhalt was im \autoref{sec:verbatim} erleutert wird. % Schlussendlich wird im \autoref{sec:alternatives} die exisitierenden Makros mit den entsprechendem Optionen von \Macro\adjustbox -% verglichen. Beispiele für die beschriebenen Makros befinden sich im folgendem \autoref{sec:example}. +% verglichen. Beispiele f^^c3^^bcr die beschriebenen Makros befinden sich im folgendem \autoref{sec:example}. % -% Dem Leser wird darüberhinaus die Lektüre der Anleitung der \pkg{graphic}/|x| Pakete, der \emph{Graphics Guide}, empfohlen wo -% die möglichen Optionen für das Makro \Macro\includegraphics gelistet sind, die auch für \Macro\adjustbox verwendet werden. +% Dem Leser wird dar^^c3^^bcberhinaus die Lekt^^c3^^bcre der Anleitung der \pkg{graphic}/|x| Pakete, der \emph{Graphics Guide}, empfohlen wo +% die m^^c3^^b6glichen Optionen f^^c3^^bcr das Makro \Macro\includegraphics gelistet sind, die auch f^^c3^^bcr \Macro\adjustbox verwendet werden. % \fi % % \ifenglish @@ -384,7 +390,7 @@ % \ifenglish % \subsubsection*{Trim Box Content} % \else -% \subsubsection*{Rand beschneiden ohne Überhang auszublenden} +% \subsubsection*{Rand beschneiden ohne ^^c3^^9cberhang auszublenden} % \fi % \vskip-\lastskip % \DescribeMacro\trimbox{<all sites>}{<\TEXT>} @@ -403,14 +409,14 @@ % If the starred version is used the four coordinates are taken as the \Key{viewport} instead, i.e. the box % is trimmed to the rectangle described by the coordinates. In this case using all four values must be specified. % \else -% Das Makro \Macro\trimbox setzt den \meta{Text} in eine \TeX{} Box und reduziert dessen offizielle Größe -% (\emph{bounding box}, engl.: begrenzende Box), so dass \TeX{} annimmt es wäre entsprechend kleiner. Überstehendes Material +% Das Makro \Macro\trimbox setzt den \meta{Text} in eine \TeX{} Box und reduziert dessen offizielle Gr^^c3^^b6^^c3^^9fe +% (\emph{bounding box}, engl.: begrenzende Box), so dass \TeX{} annimmt es w^^c3^^a4re entsprechend kleiner. ^^c3^^9cberstehendes Material % ragt deswegen in den umgebenden Text hinein. -% Die angegebenen Werte im ersten Argument stehen für die Beträge die von der unteren linken (lu) und der oberen rechten (or) +% Die angegebenen Werte im ersten Argument stehen f^^c3^^bcr die Betr^^c3^^a4ge die von der unteren linken (lu) und der oberen rechten (or) % Ecke entfernt werden. Das heisst, dass der Wert \meta{lux} vom linken Rand, \meta{lly} vom unterem Rand und \meta{orx} und \meta{ory} % von rechten bzw. oberen Rand abgezogen werden. -% Wird das Makro allerdings in der Sternvariante aufgerufen, stehen die vier Werte für den Darstellungsbereich (\emph{viewport}) und -% alles ausserhalb wird von der offiziellen Größe abgeschnitten. +% Wird das Makro allerdings in der Sternvariante aufgerufen, stehen die vier Werte f^^c3^^bcr den Darstellungsbereich (\emph{viewport}) und +% alles ausserhalb wird von der offiziellen Gr^^c3^^b6^^c3^^9fe abgeschnitten. % \fi % % @@ -422,20 +428,20 @@ % Special care is taken so that the macros and the environments can have the same name. % Because of this the star can be either part of the name or an optional argument. % Also the plain\TeX{} syntax for environments (|\trimbox ... \endtrimbox|) can not be used -% because it will trigger \Macro\trimbox as a macro. +% because it will trigger \Macro\trimbox as a macro. % \else % Die Umgebungen \env{trimbox} und \env{trimbox*} erzeugen den selben Effekt wie die gleichnamigen Makros. -% Ein spezieller Trick wird verwendet, damit der selbe Name für ein Makro und für eine Umgebung verwendet werden kann, +% Ein spezieller Trick wird verwendet, damit der selbe Name f^^c3^^bcr ein Makro und f^^c3^^bcr eine Umgebung verwendet werden kann, % was normallerweise nicht der Fall ist. Aufgrund dessen akzeptier die \env{trimbox} Umgebung auch einen optionallen Stern. -% Die plain\TeX{} Schreibweise für Umgebungen (|\trimbox ... \endtrimbox|) kann allerdings nicht verwendet werden, -% da es \Macro\trimbox als Makro aufrufen würde. +% Die plain\TeX{} Schreibweise f^^c3^^bcr Umgebungen (|\trimbox ... \endtrimbox|) kann allerdings nicht verwendet werden, +% da es \Macro\trimbox als Makro aufrufen w^^c3^^bcrde. % \fi % % % \ifenglish % \subsubsection*{Clip Box Content} % \else -% \subsubsection*{Rand beschneiden und Überhang ausblenden} +% \subsubsection*{Rand beschneiden und ^^c3^^9cberhang ausblenden} % \fi % \vskip-\lastskip % \DescribeMacro\clipbox{<all sites>}{<\TEXT>} @@ -448,10 +454,10 @@ % Note that the material will still be part of the output file but is simply not shown. % It might be exported using special tools, so using \Macro\clipbox\relax (or \Macro\includegraphics[clip,trim=...]) % to censor classified information would be a bad idea. -% The starred version will again use the given coordinates as \Key{viewport}. +% The starred version will again use the given coordinates as \Key{viewport}. % \else -% Das \Macro\clipbox Makro arbeiten ähnlich wie \Macro\trimbox nur, dass der entfernte Rand auch wirklich -% ausgeblendet wird. Allerdings bleibt dieses Material Teil der Ausgabedatei und könnte durch spezielle Software exportiert werden. +% Das \Macro\clipbox Makro arbeiten ^^c3^^a4hnlich wie \Macro\trimbox nur, dass der entfernte Rand auch wirklich +% ausgeblendet wird. Allerdings bleibt dieses Material Teil der Ausgabedatei und k^^c3^^b6nnte durch spezielle Software exportiert werden. % Von der Verwendung von \Macro\clipbox\relax (oder \Macro\includegraphics'[clip,trim=...]') um vertrauliche Informationen zu zensieren % kann deswegen nur abgeraten werden. % Die Sternvariante verwendet die angegebenen Werte als den zu darstellenden Bereich wie bei \Macro\trimbox'*'. @@ -473,29 +479,40 @@ % \subsubsection*{Allgemeine Manipulationen von \LaTeX{} Material} % \fi % \vskip-\lastskip -% \DescribeMacro\adjustbox{<includegraphics \options>}{<\TEXT>} +% \DescribeMacro\adjustbox{<key/value pairs>}{<\TEXT>} % \ifenglish % The \Macro\adjustbox macro is the general form of all box modifying macros mentioned in the introduction. -% It can be thought as an \Macro\includegraphics for \LATeX{} material. -% It supports the same set of \meta{options}, however they are provided as a mandatory not as an optional argument. +% It can be thought as an extended \Macro\includegraphics for \LATeX{} material. +% It supports the same \meta{key/value pairs} and many more. However, they are provided as a mandatory not as an optional argument. % An \Macro\adjustbox without options would not make sense and can be replaced by a simple \Macro\mbox. % There is no starred version of this macro. See also \autoref{tab:alternatives} for a comparison of \Macro\adjustbox % with the other macros. % \else -% Mit Hilfe des \Macro\adjustbox Makros (engl.\ \emph{adjust} = anpassen, justieren) ist es möglich die selben Optionen -% die \Macro\inludegraphics für Bilder zur Verfügung stellt auch auf beliebiges \LATeX{} Material anzuwenden. +% Mit Hilfe des \Macro\adjustbox Makros (engl.\ \emph{adjust} = anpassen, justieren) ist es m^^c3^^b6glich die selben Optionen +% die \Macro\inludegraphics f^^c3^^bcr Bilder zur Verf^^c3^^bcgung stellt auch auf beliebiges \LATeX{} Material anzuwenden. % Die \meta{Optionen} sind dabei allerdings nicht optional, da \Macro\adjustbox ohne jegliche Optionen einem \Macro\mbox -% gleich käme. Eine Sternvariante existiert für dieses Makro nicht. -% Es kann dazu verwendet werden Kombinationen von anderen ähnlichen Makros zu ersetzen, was in \autoref{tab:alternatives} dargestellt wird. +% gleich k^^c3^^a4me. Eine Sternvariante existiert f^^c3^^bcr dieses Makro nicht. +% Es kann dazu verwendet werden Kombinationen von anderen ^^c3^^a4hnlichen Makros zu ersetzen, was in \autoref{tab:alternatives} dargestellt wird. % \fi % % \DescribeEnv[<\TEXT>]{adjustbox}{<includegraphics \options>} % \ifenglish % The environment version of \Macro\adjustbox. % \else -% Wie für die anderen Makros gibt es auch für \Macro\adjustbox eine passende Umgebung. +% Wie f^^c3^^bcr die anderen Makros gibt es auch f^^c3^^bcr \Macro\adjustbox eine passende Umgebung. % \fi % +% \subsubsection*{Adjust Images} +% \DescribeMacro\adjustimage{<key/value pairs>}{<image filename>} +% This macro can be used as an extension of \Macro\includegraphics. +% While \Macro\adjustbox is based on the same interface as \Macro\includegraphics it provides more keys and allows global keys +% set by \Macro\adjustboxset. Most keys can be exported to \Macro\includegraphics using the \opt{export} option, but there is no support +% for global keys\footnote{However some keys, but not all, can be set globally using \Macro\setkeys{Gin}{<includegraphic key/value pairs>}}. +% Therefore it can make sense to use \Macro\adjustbox{<key/value pairs>}{\AlsoMacro\includegraphics{<filename>}}. +% The \Macro\adjustimage macro is a wrapper for exactly this. This does not require the \opt{export} option and therefore helps to avoid option clashes +% if \pkg{adjustbox} is loaded at several places. +% +% \clearpage % \ifenglish % \section*{Examples} % The following examples show the application of the aforementioned macros on an example text. @@ -503,7 +520,7 @@ % \else % \section*{Beispiele} % Die folgenden Beispiele zeigen die Anwendung der Makros dieses Packets auf einen Beispieltext (\Macro\example). -% Das Ergebnis wird mit einer engen, farbigen Umrandung dargestellt um die entgültigen Dimensionen sichtbar zu machen. +% Das Ergebnis wird mit einer engen, farbigen Umrandung dargestellt um die entg^^c3^^bcltigen Dimensionen sichtbar zu machen. % \fi % \begingroup % \def\examplecontent{\begin{tabular}{@{}|c|c|@{}} @@ -544,12 +561,12 @@ % are separated by spaces. If the expression of any of this values holds a space or ends with a macro (eats trailing spaces!) it must be wrapped into braces "{ }". % \else % \newpage -% \subsection{Erlaubte Werte für Makroargumente}\label{sec:argval} -% Die numerischen Werte für die Makros werden durch das vielseitige \Macro\pgfmathparse Makro des sowieso schon verwendeten \pkg{pgf} Paketes +% \subsection{Erlaubte Werte f^^c3^^bcr Makroargumente}\label{sec:argval} +% Die numerischen Werte f^^c3^^bcr die Makros werden durch das vielseitige \Macro\pgfmathparse Makro des sowieso schon verwendeten \pkg{pgf} Paketes % eingelesen. Dies erlaubt die Verwendung von einfachen oder komplizierten Formeln. -% Eine genaue Beschreibung der unterstützten mathematischen Operationen befindet sich im Handbuch des \pkg{pgf} Paketes. -% Dabei muss beachtet werden das die vier Werte für die \Macro\trimbox und \Macro\clipbox Makros sowie für die \Key{trim} und \Key{viewport} Optionen von \Macro\adjustbox -% durch Leerzeichen getrennt werden müssen. Komplizierte Angaben die ein Leerzeichen enthalten oder auf ein Makro enden (entfernt nachfolgende Leerzeichen) müssen +% Eine genaue Beschreibung der unterst^^c3^^bctzten mathematischen Operationen befindet sich im Handbuch des \pkg{pgf} Paketes. +% Dabei muss beachtet werden das die vier Werte f^^c3^^bcr die \Macro\trimbox und \Macro\clipbox Makros sowie f^^c3^^bcr die \Key{trim} und \Key{viewport} Optionen von \Macro\adjustbox +% durch Leerzeichen getrennt werden m^^c3^^bcssen. Komplizierte Angaben die ein Leerzeichen enthalten oder auf ein Makro enden (entfernt nachfolgende Leerzeichen) m^^c3^^bcssen % deswegen in geschweifte Klammern "{ }" gesetzt werden. % \fi % @@ -561,15 +578,15 @@ % These \LaTeX{} lengths hold the original dimension of \meta{text} and can be used as part of the arguments to \Macro\adjustbox, \Macro\trimbox and \Macro\clipbox. % The totalheight is the height plus depth. With the \pkg{patch} option these lengths can also be used for \Macro\includegraphics. % \else -% Diese \LaTeX{} Längen enthalten die Weite, Höhe, Tiefe bzw.\ die totale Höhe (Höhe + Tiefe) des \meta{\TEXT} Arguments bzw.\ des Inhalts der Umgebung. -% Diese Längen können in den ersten Argument von \Macro\adjustbox, \Macro\trimbox und \Macro\clipbox verwendet werden um relative Änderungen vorzunehmen. +% Diese \LaTeX{} L^^c3^^a4ngen enthalten die Weite, H^^c3^^b6he, Tiefe bzw.\ die totale H^^c3^^b6he (H^^c3^^b6he + Tiefe) des \meta{\TEXT} Arguments bzw.\ des Inhalts der Umgebung. +% Diese L^^c3^^a4ngen k^^c3^^b6nnen in den ersten Argument von \Macro\adjustbox, \Macro\trimbox und \Macro\clipbox verwendet werden um relative ^^c3^^84nderungen vorzunehmen. % \fi % % If\marginpar{Default unit} no unit is provided for of the bounding box coordinates (\llx, \lly, \urx, \ury) 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 stored in Encapsulated PostScript (EPS) files. The more modern PDF files also use bp instead of pt. -% Because the \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion to bp got disabled for them to +% Because the \pkg{adjustbox} package macros target \LATeX{} material and users will mostly use pt values this internal conversion to bp got disabled for them to % avoid unnecessary rounding errors. Since v0.5 the default unit can be changed using the |defaultunit|\MacroArgs'='<unit>\relax % key (which is also usable as global package option). % @@ -594,10 +611,10 @@ % The flexible \Macro\adjustbox can also be used as an alternative to existing macros from the \pkg{graphics} package as shown by Table~\ref{tab:alternatives}. % Because it is longer then the originals this is only of benefit if combinations are to be replaced or verbatim text must be supported. % \else -% \subsection{Alternativen für existierende Makros}\label{sec:alternatives} -% Das flexible \Macro\adjustbox Makro kann auch als Alternative für die vorhandenen Makros des \pkg{graphics} Paketes verwenden werden. +% \subsection{Alternativen f^^c3^^bcr existierende Makros}\label{sec:alternatives} +% Das flexible \Macro\adjustbox Makro kann auch als Alternative f^^c3^^bcr die vorhandenen Makros des \pkg{graphics} Paketes verwenden werden. % Dies ist in Tabelle~\ref{tab:alternatives} dargestellt. -% Die dies allerdings mehr Schreibarbeit darstellt ist es nur dann von Vorteil, falls mehrere Operationen verknüpft werden sollen +% Die dies allerdings mehr Schreibarbeit darstellt ist es nur dann von Vorteil, falls mehrere Operationen verkn^^c3^^bcpft werden sollen % oder wenn der entsprechende Text im \emph{verbatim} Modus eingelesen werden soll. % \fi % @@ -611,7 +628,7 @@ % \ifenglish % \caption{Alternatives for existing Macros} % \else -% \caption{Alternativen für existierende Makros} +% \caption{Alternativen f^^c3^^bcr existierende Makros} % \fi % \label{tab:alternatives} % \hbox to \linewidth{\hss @@ -620,7 +637,7 @@ % \ifenglish % Original Macro (w/o content argument) & Alternative \Macro\adjustbox keys \\ % \else -% Originales Makro (ohne Textargument) & Alternative \Macro\adjustbox Schlüssel \\ +% Originales Makro (ohne Textargument) & Alternative \Macro\adjustbox Schl^^c3^^bcssel \\ % \fi % \midrule % \Macro\rotatebox{<\Angle>} & \MacroArgs'angle='<\Angle> \\ @@ -686,8 +703,8 @@ % This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is smaller % than the given \meta{width} or \meta{height}. % If only one value should be set the other one can be replaced by "!". -% If required the content is scaled up so that the width and height is equal or larger than the given values, but does not change -% the aspect ratio. +% If required the content is scaled up so that the width and height is equal or larger than the given values, but does not change +% the aspect ratio. % The star variant uses the total height instead of only the height. % This macro is used internally for the \Key{min width}, \Key{min height}, \Key{min totalheight} and \Key{min totalsize} options. % @@ -716,7 +733,7 @@ % This macro is like \Macro\resizebox of the \pkg{graphics/x} package, but only resizes the content if its natural size is larger % than the given \meta{width} or \meta{height}. % If only one value should be set the other one can be replaced by "!". -% If required the content is scaled down so that the width and height is equal or smaller than the given values, but does not change +% If required the content is scaled down so that the width and height is equal or smaller than the given values, but does not change % the aspect ratio. % The star variant uses the total height instead of only the height. % This macro is used internally for the \Key{max width}, \Key{max height}, \Key{max totalheight} and \Key{max totalsize} options. @@ -748,7 +765,7 @@ % It is also possible to use lap amount which absolute values are larger than the original width. In this case the resulting % official width will be zero by default and the content will padded with the required white space. % Note that the lap amount always states the distance between the right side of the official box and the right side of the actual -% content for positive amounts or the distance between the left side of the official box and the left side of the actual content +% content for positive amounts or the distance between the left side of the official box and the left side of the actual content % for negative values. % % \begin{examples} @@ -809,6 +826,49 @@ % This section lists provided keys usable as \Macro\adjustbox options and, if the \opt{export} package option was used, also as \Macro\includegraphics options. % If the package is loaded with the \opt{minimal} option this code is skipped. % +% \subsubsection{Setting keys globally} +% +% \DescribeMacro\adjustboxset{<global keys to be executed \emph{before} local keys>} +% \DescribeMacro\adjustboxset*{<global keys to be executed \emph{after} local keys>} +% Using these two macros all keys can be set globally, i.e.\ for all future \Macro\adjustbox macros and \env{adjustbox} environments. +% Note that these settings are actually \emph{local} to the current \TeX\ group and only really global if used in the preamble or outside any group. +% The normal macro will place all given keys before the keys used in first argument of \Macro\adjustbox\ / \env{adjustbox}, +% while the starred version will place them afterwards. +% +% If these macros are used several times there keys are accumulated. This happens in the given order for the normal version and in reversed order for the starred version, +% i.e.\ the keys of further \Macro\adjustboxset or \Macro\adjustboxset* are always added so they face inwards. +% If used without any keys but an empty argument, all keys previously set with the same macro are removed (from the current \TeX\ scope). +% This means \Macro\adjustboxset{} clears all keys set be previously usages of \Macro\adjustboxset{<keys>} and \Macro\adjustboxset*{} clears all set by \Macro\adjustboxset*{<keys>}. +% Such resets are again local to the current \TeX\ group. +% +% +% \begin{examples} +% The macros: +% \begin{macroquote} +% \adjustboxset{keya=1} \\ +% \adjustboxset*{keyc=3}\\ +% \adjustbox{keyb=2}{content} +% \end{macroquote} +% are effectively the same as: +% \begin{macroquote} +% \adjustbox{keya=1,keyb=2,keyc=3}{content} +% \end{macroquote} +% \par\medskip\noindent +% The macros: +% \begin{macroquote} +% \adjustboxset{keya=1,keyb=2} \\ +% \adjustboxset{keyc=3,keyd=4} \\ +% \adjustboxset*{keyg=7,keyh=8}\\ +% \adjustboxset*{keyi=9,keyj=10}\\ +% \adjustbox{keye=5,keyf=6}{content} +% \end{macroquote} +% are effectively the same as: +% \begin{codequote} +% \AlsoMacro\adjustbox'{keya=1,keyb=2,keyc=3,keyd=4,keye=5,keyf=6,'\\ +% !\hskip0pt!' keyi=9,keyj=10,keyg=7,keyh=8}'{content} +% \end{codequote} +% \end{examples} +% % \subsubsection{Trimming and Clipping} % % \DescribeKey{Trim}'='<all sites> @@ -819,7 +879,7 @@ % as described earlier are applied on the original content before any resizing % or other effects. 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). -% If the \Key{trim} and \Key{viewport} keys are used multiple times the last values will be used for the trimming, i.e. the content is only +% If the \Key{trim} and \Key{viewport} keys are used multiple times the last values will be used for the trimming, i.e. the content is only % trimmed once. The upper case variants \Key{trim} and \Key{viewport} will wrap the content internally in a \Macro\trimbox or \Macro\trimbox*\relax % macro which can be applied multiple times, e.g.\ before and after the content is rotated. % These two keys awaits the same format as the original keys. However, the \Key{clip} key has no effect on them. @@ -830,7 +890,7 @@ % \DescribeKey{Clip*}'='<llx>~<lly>~<urx>~<ury> % As stated above the \Key{clip} boolean key % which will make the default \Key{trim} and \Key{viewport} keys clip the trimmed content, has no effect -% on the \Key{trim} and \Key{viewport} keys. Instead \Key{Clip} and \Key{Clip*} are provided which wrap the content internally in a \Macro\clipbox or +% on the \Key{trim} and \Key{viewport} keys. Instead \Key{Clip} and \Key{Clip*} are provided which wrap the content internally in a \Macro\clipbox or % \Macro\clipbox*\relax macro. They can be used several times. % % @@ -909,7 +969,7 @@ % \DescribeKey{raise}'='<amount> % \DescribeKey{raise}'='{<amount>}{<height>} % \DescribeKey{raise}'='{<amount>}{<height>}{<depth>} -% This key uses +% This key uses % \Macro\raisebox{<amount>}{\ldots} to raise the content upwards for the given \meta{amount} (length). % A negative length moves the content down. % The two optional arguments of \Macro\raisebox{<amount>}[<height>][<depth>]{\ldots}\relax are also available @@ -923,11 +983,11 @@ % \end{examplecode} % \begin{examplecode} % Is \adjustbox{raise={1ex}{\height}}{higher} -% than the normal text but sill has +% than the normal text but sill has % its original official height % \end{examplecode} % \begin{examplecode} -% Is \adjustbox{raise={1ex}{1ex}{0pt}}{higher and +% Is \adjustbox{raise={1ex}{1ex}{0pt}}{higher and % \rotatebox{-90}{depth}} but with limited official % height and no depth. % \end{examplecode} @@ -948,7 +1008,7 @@ % \Macro\adjboxvcenter\relax (by default \texttt{1ex}). % % The following table shows the different alignments for three different sized blocks: -% +% % \bigskip % \begingroup % \def\vr{% @@ -1046,7 +1106,7 @@ % % \DescribeKey{center} % \DescribeKey{center}'='<width> -% This key places +% This key places % the content in a horizontal box which is by default \Macro\linewidth wide (i.e.\ as wide as a normal text paragraph) % and centers it in it. The effect is very similar to \Macro\centerline. The original content is unchanged, but simply identical % white space is added as a left and right margin. This is useful if the content is a figure or table and can be used as a replacement @@ -1101,13 +1161,13 @@ % % \DescribeKey{inner} % \DescribeKey{inner}'='<width> -% Like \Key{center}, \Key{left} and \Key{right} this key +% Like \Key{center}, \Key{left} and \Key{right} this key % places the content in a box with the given width (by default \Macro\linewidth) but aligns it towards the inner margin. % If the content is wider than the available width it will stick into the outer margin without causing an overfull hbox warning. % In |twoside| mode this key is equal to \Key{left} for odd pages and equal to \Key{right} for even pages. % For |oneside| mode it is always equal to \Key{center}, because there is no inner or outer margin. % Note that the page-is-odd test might not always lead to correct results for some material close to a page boundary, because \TeX\ -% might not have decided on which page it will be placed. This can be improved by loading the \pkg{changepage} package with the +% might not have decided on which page it will be placed. This can be improved by loading the \pkg{changepage} package with the % \opt{strict} option, which uses a reference to determine the correct page number (and requires the usual additional compiler run). % % \DescribeKey{outer} @@ -1123,11 +1183,16 @@ % For |pdflatex| the length unit |px| can be used to specify pixels. However, the equivalent dimension (length) of one pixel must be % set using the \Macro\pdfpxdimen length register. To set a specific DPI value this length must be set using % \Macro\setlength\AlsoMacro\pdfpxdimen{'1in/'<dots>}, which is done by the \Key{dpi}'='<dots> key. +% Note that the key won't affect the setting for the content but only for the further used keys. +% However, it is possible to use \Macro\setkeys{adjbox}{'dpi='<number>} inside the content or anywhere else in the document to +% set \Macro\pdfpxdimen using this interface. % % \begin{example} % \begin{examplecode} -% \adjustbox{dpi=72,trim=10px,frame} -% {\textcolor{green}{\rule{50px}{50px}}} +% \adjustbox{dpi=72,trim=10px,frame}{% +% \setkeys{adjbox}{dpi=72}% +% \textcolor{green}{\rule{50px}{50px}}% +% } % \end{examplecode} % \end{example} % @@ -1139,11 +1204,11 @@ % \begin{example} % \begin{examplecode} % \adjustbox{pxdim=2pt,trim=2px,frame} -% {\textcolor{green}{\rule{10px}{10px}}} +% {\textcolor{green}{\rule{20pt}{20pt}}} % \end{examplecode} % \end{example} % -% \subsection{Minipage or other inner Environment} +% \subsection{Minipage or other inner environments which change the processing of the content} % 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. @@ -1159,11 +1224,12 @@ % The \meta{position} argument must be "t" for top baseline, "b" for bottom baseline and "c" for center alignment relative to other % text, i.e.\ defines the resulting baseline. If a \meta{height} is defined the \meta{inner position} defaults to \meta{position} but % can also be "s" to stretch the content over the whole height. This requires the content to include some vertical stretchable material. +% Note that all length arguments can include arithmetic expressions like for other keys. % % \begin{examples} % \begin{examplecode} % \adjustbox{minipage=5cm,angle=-10}{% -% Some example code which will +% Some example code which will % be automatically broken or can include \\ % line breaks\footnote{AND footnotes!!}\\ % or verbatim \verb+@%^&}_+!% @@ -1182,14 +1248,16 @@ % \end{examplecode} % \end{examples} % +% % \DescribeKey{tabular}'='[<position>]{<column specification>} % \DescribeKey{tabular*}'='[<position>]{<width>}{<column specification>} % \DescribeKey{array}'='[<position>]{<column specification>} % Places the content in a \env{tabular}, \env{tabular*} or \env{array} environment, respectively. % These keys require different implementations for macro (\Macro\adjustbox) and environment mode (\env{adjustbox} environment) in order to insert -% the end code correctly. Note that the environment mode is more efficient and fully stable, while the macro mode requires the last row to end with +% the end code correctly. Note that the environment mode is more efficient and fully stable, while the macro mode requires the last row to end with % an explicit |\\| (which can be followed by \Macro\hline or any other macro which uses \Macro\noalign internally). In macro mode the |\\| is internally redefined % to check for the closing brace. While this was successful tested for normal usages it might still cause issues with unusual or complicated cases. +% Note that these environments are taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported. % % \begin{examples} % \begin{examplecode} @@ -1213,6 +1281,7 @@ % Wraps the inner content in the given \meta{environment} before it is stored as horizontal box. % It should be kept in mind that there is some internal code between the begin of the environment and the content. For this reason % a \env{tabular}, \env{innerenv} or similar environment will not work here, because that code will be taken as part of the first cell. +% Note that such a environment is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported. % % \begin{example} % \begin{examplecode} @@ -1224,6 +1293,7 @@ % % \DescribeKey{innercode}'='{<begin code>}{<end code>} % Places the given code before and after the inner content before it is stored as horizontal box. +% Note that such code is taken as part of the content and so the usage of arithmetic expressions for length arguments is not supported. % % \begin{example} % \begin{examplecode} @@ -1240,7 +1310,7 @@ % At this stage the content is already boxed and format macros won't have any effect on any included text. For this the \Key{innerenv} key needs to be used instead. % % \DescribeKey{addcode}'='{<code before>}{<code afters>} -% Adds some \meta{code before} and some \meta{code after} the content and the +% 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. % @@ -1252,13 +1322,31 @@ % 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. % +% \subsection{Split content} +% The following features are experimental and can be used to split a boxed content. +% +% \DescribeMacro\splitbox{<split width>}{<split height>}{<content>} +% This macro boxes the given content and splits it in multiple fragments of the given width and height. +% This is done row by row starting from the upper left corner. The last column and row can have a smaller size than requested. +% Every fragment is placed using \Macro\splitboxcmd{<fragment box>} which is empty by default but can be redefined to e.g.\ draw +% a frame around each fragment. After every row except the last the macro \Macro\splitboxnewline is inserted which defaults to |\\|, +% but can also be redefined freely. After the last row the macro \Macro\splitboxlastnewline is inserted which defaults to \Macro\splitboxnewline. +% +% The \Macro\splitbox content is stored using \Macro\storebox from the \pkg{storebox} package and therefore the whole content should only +% be stored once in the output file if the format is supported by that package (currently only PDF). +% +% \DescribeEnv[<content>]{splitbox}{<split width>}{<split height>} +% Environment version of \Macro\splitbox. +% +% \DescribeKey{splitbox}'='{<split width>}{<split height>} +% The \Key{splitbox} key can be used with \Macro\adjustbox and uses \Macro\splitbox internally. % % \StopEventually{} % \clearpage % \section{Implementation} % \setcounter{lstnumber}{1} % \ifenglish\else -% Die Dokumentation des Quellcodes ist nur auf Englisch verfügbar. +% Die Dokumentation des Quellcodes ist nur auf Englisch verf^^c3^^bcgbar. % \fi % % \iffalse @@ -1272,18 +1360,25 @@ % \fi % % \iffalse -%<*adjustbox> +%<*adjustbox.sty> % \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Package header, options and dependencies} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{macrocode} -\ProvidesPackage{adjustbox}[2011/09/04 v0.6 Adjusting TeX boxes (trim, clip, ...)] +%<!COPYRIGHT> +\ProvidesPackage{adjustbox}[% +%<!DATE> +%<!VERSION> +%<*DRIVER> + 2099/01/01 develop +%</DRIVER> + Adjusting TeX boxes (trim, clip, ...)] % \end{macrocode} % % \begin{macrocode} \RequirePackage{xkeyval} - +% \def\adjbox@defaultunit{bp} \DeclareOptionX<adjbox>{defaultunit}{% \def\adjbox@defaultunit{#1}% @@ -1294,17 +1389,17 @@ \def\adjbox@default{\adjsetlength}% \fi } - +% \def\adjbox@fam{adjbox} \DeclareOptionX<adjbox>{export}{\def\adjbox@fam{Gin}} \DeclareOptionX<adjbox>{patch}{\AtEndOfPackage{\RequirePackage{adjgrfx}}} \DeclareOptionX<adjbox>{minimal}{\let\adjbox@maybeend\endinput} - +% \def\adjbox@driver{adj\Gin@driver} \DeclareOptionX<adjbox>{pgf}{\def\adjbox@driver{adjpgf.def}} \DeclareOptionX<adjbox>{PGF}{\def\adjbox@driver{adjpgf.def}\adjcalc@pgfmath} \DeclareOptionX<adjbox>*{\PassOptionsToPackage\CurrentOption{graphicx}} - +% \let\adjbox@maybeend\relax \input{adjcalc.sty} \disable@keys{adjbox}{patch,export,PGF,minimal} @@ -1319,27 +1414,84 @@ % \subsection{Basic commands} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \begin{macro}{\adjbox@viewport} +% +% \begin{macro}{\adjustboxset} % \begin{macrocode} -\define@key{adjbox}{viewport}{% - \let\Gin@viewport@code\adjbox@@viewport - \let\adjustbox@@@\adjustbox@@@trimclip - \adjbox@parse@v{#1}% +\newcommand*\adjustboxset{% + \@ifstar + {\adjbox@addkeysafter}% + {\adjbox@addkeysbefore}% } % \end{macrocode} % \end{macro} % +% \begin{macro}{\adjbox@addkeysbefore} +% \begin{macrocode} +\def\adjbox@addkeysbefore#1{% + \ifx\@nnil#1\@nnil + \let\adjbox@keysbefore\@empty + \else + \expandafter\def\expandafter\adjbox@keysbefore\expandafter{\adjbox@keysbefore,#1}% + \let\adjbox@setkeys\adjbox@setkeys@ba + \fi +} +\let\adjbox@keysbefore\@empty +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\adjbox@trim} +% \begin{macro}{\adjbox@addkeysafter} % \begin{macrocode} -\define@key{adjbox}{trim}{% - \let\Gin@viewport@code\adjbox@@trim - \let\adjustbox@@@\adjustbox@@@trimclip - \adjbox@parse@v{#1}% +\def\adjbox@addkeysafter#1{% + \begingroup + \def\@tempa{#1}% + \ifx\@tempa\@empty + \endgroup + \let\adjbox@keysafter\@empty + \else + \expandafter\expandafter + \expandafter\endgroup + \expandafter\expandafter + \expandafter\def + \expandafter\expandafter + \expandafter\adjbox@keysafter + \expandafter\expandafter + \expandafter{\expandafter\@tempa\expandafter,\adjbox@keysafter}% + \let\adjbox@setkeys\adjbox@setkeys@ba + \fi } +\let\adjbox@keysafter\@empty % \end{macrocode} % \end{macro} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Basic commands} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \begin{key}{adjbox}{viewport} +% \begin{macrocode} +\define@key{adjbox}{viewport}{% + \def\adjustbox@@@{% + \adjbox@parse@v{#1}% + \adjbox@@viewport + \adjustbox@@@trimclip + }% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{key}{adjbox}{trim} +% \begin{macrocode} +\define@key{adjbox}{trim}{% + \def\adjustbox@@@{% + \adjbox@parse@v{#1}% + \adjustbox@@@trimclip + }% +} +% \end{macrocode} +% \end{key} +% % % \begin{macro}{\adjustbox@@@trimclip} % \begin{macrocode} @@ -1397,13 +1549,6 @@ % % % -% \begin{macro}{\adjbox@@trim} -% \begin{macrocode} -\let\adjbox@@trim\relax -% \end{macrocode} -% \end{macro} -% -% % \begin{macro}{\adjbox@@viewport} % \begin{macrocode} \def\adjbox@@viewport{% @@ -1496,6 +1641,33 @@ \newcommand\adjustbox[1]{% \collectboxcheckenv{adjustbox}% \begingroup + \adjbox@setkeys{#1}% + \expandafter\expandafter\expandafter + \endgroup + \expandafter + \adjbox@collectbox\expandafter{\expandafter\adjustbox@\expandafter{\XKV@rm}}% +} +\let\adjbox@collectbox\@collectbox +\def\adjbox@setkeys@ba{% + \expandafter\expandafter + \expandafter\adjbox@@setkeys@ba + \expandafter\expandafter + \expandafter{\expandafter\adjbox@keysbefore\expandafter}% + \expandafter{\adjbox@keysafter}% +} +\def\adjbox@@setkeys@ba#1#2#3{% + \setkeys*{ADJBOX}{#1,#3,#2}% +} +\def\adjbox@setkeys{% + \setkeys*{ADJBOX}% +} +% \end{macrocode} +% \end{environment} +% +% +% \begin{macro}{\adjustbox@} +% \begin{macrocode} +\def\adjustbox@#1{% \adjustbox@dimcmds \let\Gin@esetsize\adjbox@esetsize \@tempswatrue @@ -1503,9 +1675,8 @@ \def\setlength{\adjsetlength}% \setkeys{adjbox,Gin}{#1}% \adjbox@esetsize - \adjbox@collectbox{\the\toks@\endgroup}% + \the\toks@ } -\let\adjbox@collectbox\@collectbox % \end{macrocode} % \end{macro} % @@ -1520,7 +1691,7 @@ % \begin{macro}{\adjbox@esetsize} % Replacement of \Macro\Gin@esetsize. % Now always called in external mode. Checks if any size is set and, as an optimation, does nothing otherwise. -% +% % OLD: % When called in \emph{external} mode (switch is true) then the content is wrapped in % the internal form of \Macro\resizebox. In \emph{internal} mode, i.e.\ resizing is done by the graphic driver, @@ -1566,6 +1737,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\adjustimage} +% Simple wrapper to use \Macro\adjustbox for images. +% \begin{macrocode} +\newcommand*\adjustimage[2]{% + \adjustbox{#1}{\includegraphics{#2}}% +} +% \end{macrocode} +% \end{macro} +% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsubsection{Low-level trim and clip boxes} @@ -2620,23 +2800,37 @@ % \subsubsection{Minibox and other Environments Keys} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \begin{key}{adjbox}{minipage} +% \begin{key}{ADJBOX}{minipage} % \begin{macrocode} -\define@key{adjbox}{minipage}{% +\define@key{ADJBOX}{minipage}{% \@ifnextchar[{% - \adjbox@innerenv{minipage}% + \adjbox@minipage% }{% - \adjbox@innerenv{minipage}{{#1}}\@nnil% + \adjbox@minipage{{#1}}\@nnil% \remove@to@nnil }#1\@nnil } % \end{macrocode} % \end{key} % +% \begin{macro}{\adjbox@minipage} +% \begin{macrocode} +\def\adjbox@minipage#1\@nnil{% + \def\adjbox@collectbox##1{\collectbox@{\adjbox@set\begin{minipage}#1\adjbox@reset}{##1}{\end{minipage}}}% +} +\def\adjbox@set{% + \let\adjbox@origsetlength\setlength + \def\setlength{\adjsetlength}% +} +\def\adjbox@reset{% + \let\setlength\adjbox@origsetlength +} +% \end{macrocode} +% \end{macro} % -% \begin{key}{adjbox}{tabular} +% \begin{key}{ADJBOX}{tabular} % \begin{macrocode} -\define@key{adjbox}{tabular}{% +\define@key{ADJBOX}{tabular}{% \@ifnextchar[{% \adjbox@tabular{tabular}% }{% @@ -2661,18 +2855,18 @@ % \end{macro} % % -% \begin{key}{adjbox}{tabular*} +% \begin{key}{ADJBOX}{tabular*} % \begin{macrocode} -\define@key{adjbox}{tabular*}{% +\define@key{ADJBOX}{tabular*}{% \adjbox@tabular{tabular*}#1\@nnil } % \end{macrocode} % \end{key} % % -% \begin{key}{adjbox}{array} +% \begin{key}{ADJBOX}{array} % \begin{macrocode} -\define@key{adjbox}{array}{% +\define@key{ADJBOX}{array}{% \@ifnextchar[{% \adjbox@array% }{% @@ -2697,9 +2891,9 @@ % \end{macro} % % -% \begin{key}{adjbox}{innerenv} +% \begin{key}{ADJBOX}{innerenv} % \begin{macrocode} -\define@key{adjbox}{innerenv}{% +\define@key{ADJBOX}{innerenv}{% \@ifnextchar\bgroup{% \adjbox@innerenv }{% @@ -2719,9 +2913,9 @@ % \end{macro} % % -% \begin{key}{adjbox}{innercode} +% \begin{key}{ADJBOX}{innercode} % \begin{macrocode} -\define@key{adjbox}{innercode}{% +\define@key{ADJBOX}{innercode}{% \adjbox@innercode#1{}{}% } % \end{macrocode} @@ -2738,9 +2932,9 @@ % % % -% \begin{key}{adjbox}{env} +% \begin{key}{ADJBOX}{env} % \begin{macrocode} -\define@key{adjbox}{env}{% +\define@key{ADJBOX}{env}{% \@ifnextchar\bgroup{% \adjbox@addenv }{% @@ -2869,14 +3063,233 @@ } % \end{macrocode} % \end{macro} - +% +% +% \begin{macrocode} +\RequirePackage{storebox} +% \end{macrocode} +% +% \begin{macro}{\splitbox} +% \begin{macrocode} +\newcommand\splitbox[2]{% + \collectboxcheckenv{splitbox}% + \@collectbox{\@splitbox{#1}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{key}{adjbox}{split} +% \begin{macrocode} +\define@key\adjbox@fam{split}{% + \adjbox@Gin@Add{\@collectbox{\@splitbox#1}}% +} +% \end{macrocode} +% \end{key} +% +% +% \begin{macro}{\@splitbox} +% \begin{macrocode} +\def\@splitbox#1#2{% + \ifstorebox + \storebox\splittedbox{\BOXCONTENT}% + \setbox\collectedbox\hbox{\usestorebox\splittedbox}% + \fi + \xdef\@tempa{#1}% + \xdef\@tempb{#2}% + \ifx\@tempa\Gin@exclamation + \@tempdima\maxdimen + \else + \adjsetlength\@tempdima\@tempa + \fi + \ifx\@tempb\Gin@exclamation + \Gin@nat@height\maxdimen + \else + \adjsetlength\Gin@nat@height\@tempb + \fi + \ifdim\@tempdima>\width + \@tempdima\width + \fi + \ifdim\Gin@nat@height>\totalheight + \Gin@nat@height\totalheight + \fi + \adjbox@tllx\z@ + \adjbox@tlly\totalheight + \adjbox@turx\width + \adjbox@tury\z@ + \advance\adjbox@tlly-\Gin@nat@height + \@@splitbox +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@splitbox} +% \begin{macrocode} +\def\@@splitbox{% + \advance\adjbox@turx-\@tempdima + \@@@splitbox + \ifdim\adjbox@turx>\z@ + \advance\adjbox@tllx+\@tempdima + \expandafter\@@splitbox + \else + \ifdim\adjbox@tlly<\splitbox@epsilon + \splitboxlastnewline + \else + \splitboxnewline + \adjbox@tllx\z@ + \adjbox@turx\width + \advance\adjbox@tlly-\Gin@nat@height + \advance\adjbox@tury+\Gin@nat@height + \expandafter\expandafter + \expandafter\@@splitbox + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@@splitbox} +% \begin{macrocode} +\def\@@@splitbox{% + \begingroup + \setbox\collectedbox=\copy\collectedbox + \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox + \splitboxcmd{\usebox\collectedbox}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@@splitbox} +% \begin{macrocode} +\def\@@@splitbox{% + \begingroup + \setbox\collectedbox=\copy\collectedbox + \@clipbox\adjbox@tllx\adjbox@tlly\adjbox@turx\adjbox@tury\collectedbox + \splitboxcmd{\usebox\collectedbox}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\splitboxcmd} +% \begin{macrocode} +\let\splitboxcmd\empty +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\splitboxnewline} +% \begin{macrocode} +\newcommand\splitboxnewline{\\} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\splitboxlastnewline} +% \begin{macrocode} +\newcommand\splitboxlastnewline{\splitboxnewline} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\splitbox@epsilon} +% \begin{macrocode} +\def\splitbox@epsilon{100sp} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pagebreakbox} +% \begin{macrocode} +\newcommand\pagebreakbox{% + \par\noindent + \collectboxcheckenv{pagebreakbox}% + \@collectbox{\@pagebreakbox}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{key}{adjbox}{split} +% \begin{macrocode} +\define@key\adjbox@fam{pagebreak}[]{% + \adjbox@Gin@Add{\@collectbox{\@pagebreakbox}}% +} +% \end{macrocode} +% \end{key} +% +% +% +% \begin{macro}{\@pagebreakbox} +% Used internal macros: +% +% \begin{tabular}{ll} +% \Macro\@tempa & Caption code \\ +% \Macro\@tempboxa & Caption box \\ +% \Macro\adjbox@tlly & Lower clip amount \\ +% \Macro\adjbox@tury & Lower clip amount \\ +% \end{tabular} +% \begin{macrocode} +\def\@pagebreakbox{% + \sbox\collectedbox{\raise\dp\collectedbox\hbox{\BOXCONTENT}}% + \ifstorebox + \storebox\splittedbox{\BOXCONTENT}% + \setbox\collectedbox\hbox{\usestorebox\splittedbox}% + \fi + \adjsetlength\adjbox@tlly + {\totalheight-\pagegoal+\pagetotal+\pagebreakboxoffset}% + \ifdim\adjbox@tlly>\z@ + \begingroup + \setbox\collectedbox=\copy\collectedbox + \@clipbox\z@\adjbox@tlly\z@\z@\collectedbox + \BOXCONTENT + \endgroup + \par\noindent + \adjsetlength\adjbox@tury{\totalheight-\adjbox@tlly}% + \ifdim\adjbox@tlly>\textheight + \loop + \advance\adjbox@tlly-\textheight + \begingroup + \setbox\collectedbox=\copy\collectedbox + \@clipbox\z@\adjbox@tlly\z@\adjbox@tury\collectedbox + \BOXCONTENT + \endgroup + \advance\adjbox@tury\textheight + \par\noindent + \ifdim\adjbox@tlly>\textheight + \repeat + \@clipbox\z@\z@\z@\adjbox@tury\collectedbox + \BOXCONTENT + \else + \@clipbox\z@\z@\z@\adjbox@tury\collectedbox + \par\noindent + \BOXCONTENT + \fi + \else + \BOXCONTENT% + \fi + \par +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pagebreakboxoffset} +% \begin{macrocode} +\newcommand*\pagebreakboxoffset{\ht\strutbox} +% \end{macrocode} +% \end{macro} +% % \iffalse -%</adjustbox> +%</adjustbox.sty> % \fi % % % \iffalse -%<*adjgrfx> +%<*adjgrfx.sty> % \fi % \begin{macrocode} \ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox] @@ -2887,7 +3300,7 @@ %%^^A \width, \height, \totalheight, \depth = size current at option execution (changes after every option) (initial: natural size) %%^^A \Width, \Height, \Totalheight, \Depth = requested size of image (height/totalheight and width) (initial: natural size) %%^^A \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH = natural size of image -%% +%% %% % % \begin{macro}{\Gin@adj@adddim} @@ -3062,12 +3475,12 @@ % \end{macro} % % \iffalse -%</adjgrfx> +%</adjgrfx.sty> % \fi % % % \iffalse -%<*adjcalc> +%<*adjcalc.sty> % \fi % Test if this package was loaded as package or as file (as part of 'adjustbox'): % \begin{macrocode} @@ -3197,7 +3610,7 @@ % \end{macro} % % \iffalse -%</adjcalc> +%</adjcalc.sty> % \fi % % |