diff options
author | Karl Berry <karl@freefriends.org> | 2011-01-28 01:52:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-01-28 01:52:55 +0000 |
commit | cf1e963f1e2ee58dbc35f6e48064e9553eb07971 (patch) | |
tree | d76ee9c443a7ce98f9f03bc0b0487800b7e0062a /Master/texmf-dist | |
parent | 6268e0974f70b379890285a94cbb6d539cf00119 (diff) |
adjustbox 0.2 (28jan11)
git-svn-id: svn://tug.org/texlive/trunk@21199 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf | bin | 0 -> 249908 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/Makefile | 86 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/README | 47 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx | 484 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/adjustbox/adjustbox.ins | 49 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty | 134 |
6 files changed, 800 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf Binary files differnew file mode 100644 index 00000000000..9dba5c438ba --- /dev/null +++ b/Master/texmf-dist/doc/latex/adjustbox/adjustbox.pdf diff --git a/Master/texmf-dist/source/latex/adjustbox/Makefile b/Master/texmf-dist/source/latex/adjustbox/Makefile new file mode 100644 index 00000000000..2bb55c3d056 --- /dev/null +++ b/Master/texmf-dist/source/latex/adjustbox/Makefile @@ -0,0 +1,86 @@ +TEXMF=${HOME}/texmf +INSTALLDIR=${TEXMF}/tex/latex/adjustbox +DOCINSTALLDIR=${TEXMF}/doc/latex/adjustbox +CP=cp +RMDIR=rm -rf +PDFLATEX=pdflatex -interaction=batchmode +LATEXMK=latexmk -pdf -silent + +PACKEDFILES=adjustbox.sty +DOCFILES=adjustbox.pdf +SRCFILES=adjustbox.dtx adjustbox.ins README Makefile + +all: unpack doc + +package: unpack +class: unpack + +${PACKEDFILES}: adjustbox.dtx adjustbox.ins + yes | pdflatex adjustbox.ins + +unpack: ${PACKEDFILES} + +# 'doc' and 'adjustbox.pdf' call itself until everything is stable +doc: adjustbox.pdf + @${MAKE} --no-print-directory adjustbox.pdf + +pdfopt: doc + @-pdfopt adjustbox.pdf .temp.pdf && mv .temp.pdf adjustbox.pdf + +adjustbox.pdf: adjustbox.dtx adjustbox.gls adjustbox.ind + ${LATEXMK} adjustbox.dtx + +adjustbox.idx adjustbox.glo: adjustbox.dtx + ${LATEXMK} adjustbox.dtx + +adjustbox.ind: adjustbox.idx + -makeindex -s gind.ist -o "$@" "$<" + +adjustbox.gls: adjustbox.glo + -makeindex -s gglo.ist -o "$@" "$<" + +.PHONY: test + +test: unpack + for T in test*.tex; do echo "$$T"; pdflatex -interaction=batchmode $$T && echo "OK" || echo "Failure"; done + +clean: + -latexmk -C adjustbox.dtx + ${RM} ${PACKEDFILES} *.zip *.log *.aux *.toc *.vrb *.nav *.pdf *.snm *.out *.fdb_latexmk *.glo *.gls *.hd *.sta *.stp *.cod + ${RMDIR} tds + +install: unpack doc ${INSTALLDIR} ${DOCINSTALLDIR} + ${CP} ${PACKEDFILES} ${INSTALLDIR} + ${CP} ${DOCFILES} ${DOCINSTALLDIR} + texhash ${TEXMF} + +${INSTALLDIR}: + mkdir -p $@ + +${DOCINSTALLDIR}: + mkdir -p $@ + +ctanify: ${SRCFILES} ${DOCFILES} adjustbox.tds.zip + ${RM} adjustbox.zip + zip adjustbox.zip $^ + unzip -t adjustbox.zip + unzip -t adjustbox.tds.zip + +zip: adjustbox.zip + +tdszip: adjustbox.tds.zip + +adjustbox.zip: ${SRCFILES} ${DOCFILES} | pdfopt + ${RM} $@ + zip $@ $^ + +adjustbox.tds.zip: ${SRCFILES} ${PACKEDFILES} ${DOCFILES} | pdfopt + ${RMDIR} tds + mkdir -p tds/tex/latex/adjustbox + mkdir -p tds/doc/latex/adjustbox + mkdir -p tds/source/latex/adjustbox + ${CP} ${DOCFILES} tds/doc/latex/adjustbox + ${CP} ${PACKEDFILES} tds/tex/latex/adjustbox + ${CP} ${SRCFILES} tds/source/latex/adjustbox + cd tds; zip -r ../$@ . + diff --git a/Master/texmf-dist/source/latex/adjustbox/README b/Master/texmf-dist/source/latex/adjustbox/README new file mode 100644 index 00000000000..a5557713eb6 --- /dev/null +++ b/Master/texmf-dist/source/latex/adjustbox/README @@ -0,0 +1,47 @@ +LaTeX package 'adjustbox' +~~~~~~~~~~~~~~~~~~~~~~~~~ +Copyright (c) 2011 by Martin Scharrer <martin@scharrer-online.de> +WWW: http://latex.scharrer-online.de/ + +Provides the macros \trimbox, \clipbox and \adjustbox as an addition +to the macros \resizebox, \scalebox and \rotatebox from the 'graphics' package. +It reuses the key=value interface of the 'graphicx' package. +The 'pgf' package is used to implement the trimming and clipping operations +as well as to parse the numeric values. +Environment versions of the macros are also provided. +Both macros and environments support verbatim content. + +Usage: +\trimbox{<llx> <lly> <urx> <ury>}{<text>} Trims given amount +\trimbox*{<llx> <lly> <urx> <ury>}{<text>} Trims to given viewport + +\clipbox{<llx> <lly> <urx> <ury>}{<text>} Clips given amount +\clipbox*{<llx> <lly> <urx> <ury>}{<text>} Clips to given viewport + +\adjustbox{<includegraphics options>}{<text>} Like graphicx's \includegraphics, but for text +Supported options: width, height, totalheight, keepaspectratio, scale, angle, trim, viewport, clip +The options is mandatory but can be empty for the trivial case (=\mbox). + + +Environments: + +\begin{trimbox}{<llx> <lly> <urx> <ury>} + <text> +\end{trimbox} + +\begin{trimbox*}{<llx> <lly> <urx> <ury>} + <text> +\end{trimbox*} + +\begin{clipbox}{<llx> <lly> <urx> <ury>} + <text> +\end{clipbox} + +\begin{clipbox*}{<llx> <lly> <urx> <ury>} + <text> +\end{clipbox*} + +\begin{adjustbox}{<includegraphics options>} + <text> +\end{adjustbox} + diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx new file mode 100644 index 00000000000..bf347158177 --- /dev/null +++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.dtx @@ -0,0 +1,484 @@ +% \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: adjustbox.dtx 2085 2011-01-27 01:29:39Z martin $ +% \fi +% +% \iffalse +%<package>\ProvidesPackage{adjustbox} +%<*driver> +\ProvidesFile{adjustbox.dtx} +%</driver> + [2011/01/27 v0.2 Adjusting TeX boxes (trim, clip, ...)] +%<*driver> +\documentclass{ydoc}[2011/01/26] +\GetFileInfo{\jobname.dtx} +\usepackage{adjustbox}[\filedate] +\usepackage{array} +\usepackage{amsmath} +\usepackage{xcolor} +\usepackage{booktabs} + +%\EnableCrossrefs +%\CodelineIndex +%\RecordChanges +%\OnlyDescription +\renewcommand{\bottomfraction}{0.5} +\begin{document} + \DocInput{\jobname.dtx} + \PrintChanges + %\newpage\PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{185} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v0.1}{2011/01/24}{First internal version} +% \changes{v0.2}{2011/01/27}{First released version} +% +% \GetFileInfo{\jobname.dtx} +% +% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\gdef,\let} +% +% \ifpdf +% \hypersetup{% +% pdfauthor = {Martin Scharrer <martin@scharrer-online.de>}, +% pdftitle = {The adjustbox package}, +% pdfsubject = {Documentation of LaTeX package adjustbox}, +% pdfkeywords = {adjustbox, LaTeX, TeX} +% }% +% \fi +% \clearpage +% \null +% \vspace*{-2em} +% \begin{center} +% {\huge The \textsf{adjustbox} Package\\[\medskipamount]} +% {\large Martin Scharrer \\[\medskipamount]\normalsize +% \url{martin@scharrer-online.de}\\[.8ex] +% \url{http://www.ctan.org/pkg/adjustbox/}\\[\bigskipamount]} +% {\large Version \fileversion\ -- \filedate}\\ +% \end{center} +% \vspace{1.2em}% +% \def\optstar{\textcolor{optional}{*}} +% +% \makeatletter +% \def\LATeX{(L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\hbox {\check@mathfonts +% \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em)\TeX} +% \makeatother +% +% \begin{abstract} +% This package provides macros missing in \pkg{graphics/x} to trim, clip and generally adjust boxed \LaTeX{} material. +% The macros allow for verbatim content. Equivalent environments are also provided. The trim and clip operation +% are implemented using the \pkg{pgf} package, which supports both DVI/PS and PDF output. +% \\ +% \textcolor{red}{This package is new and the implementation might change in upcoming releases!} +% \end{abstract} +% +% \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 +% 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. +% +% This package provides the missing macros \Macro\clipbox and \Macro\trimbox +% as well as the general \Macro\adjustbox macro. The clipping and trimming operations are implemented using +% a \env{pgfpicture} environment from the \pkg{pgf} package which supports both PS and PDF output. +% +% +% \section{Usage} +% This section describes the usage of the provided macros, which are outlined in section~\ref{sec:boxmacros}. +% Possible advanced values for the macro arguments are mentioned in section~\ref{sec:argval}. The existing verbatim support +% is explained in section~\ref{sec:verbatim}. Finally section~\ref{sec:alternatives} compares the existing macros with the +% corresponding options of \Macro\adjustbox. +% It is recommended to also read the \emph{Graphics Guide} (|grfguide|, i.e.~the manual of the |graphics|/|x| packages), +% to understand the existing options for \Macro\includegraphics. See the example section for examples of this macros. +% +% \subsection{Box Modification Macros}\label{sec:boxmacros} +% +% \subsubsection*{Trim Box Content} +% +% \vskip-\lastskip +% \DescribeMacro\trimbox*{<llx>~<lly>~<urx>~<ury>}{<text>} +% The macro \Macro\trimbox trims the given amount 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. +% Trimming means that the official size of the box is reduced, but no material +% is actual removed. The material in the trimmed areas simply swaps over the official border. +% +% If the starred version is used the four coordinates are taken as the |viewport| instead, i.e. the box +% is trimmed to the rectangle described by the coordinates. +% +% +% +% \DescribeEnv[<text>]{trimbox}*{<llx>~<lly>~<urx>~<ury>} +% \vspace{-\baselineskip} +% \DescribeEnv[<text>]{trimbox*}{<llx>~<lly>~<urx>~<ury>} +% The \env{trimbox} and \env{trimbox*} environments do the same as the corresponding macros. +% 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 in macro mode. +% +% +% \subsubsection*{Clip Box Content} +% \vskip-\lastskip +% \DescribeMacro\clipbox*{<llx>~<lly>~<urx>~<ury>}{<text>} +% The \Macro\clipbox macro works like the \Macro\trimbox and trims the given amounts from the \meta{text}. +% However, in addition the trimmed material is also clipped, i.e. it is not shown in the final document. +% 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 |viewport|. +% +% \DescribeEnv[<text>]{clipbox}*{<llx>~<lly>~<urx>~<ury>} +% \vspace{-\baselineskip} +% \DescribeEnv[<text>]{clipbox*}{<llx>~<lly>~<urx>~<ury>} +% The environment versions of \Macro\clipbox and \Macro\clipbox*. +% +% +% \subsubsection*{Adjust Box Content} +% \vskip-\lastskip +% \DescribeMacro\adjustbox{<includegraphics options>}{<text>} +% 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. +% 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 Table~\ref{tab:alternatives} for a comparison of \Macro\adjustbox +% with the other macros. +% +% \DescribeEnv[<text>]{adjustbox}{<includegraphics options>} +% The environment version of \Macro\adjustbox. +% +% +% \subsection{Argument Values}\label{sec:argval} +% +% The\marginpar{Parsing} argument values are parsed by versatile \Macro\pgfmathparse of the already used |pgf| package. See the |pgfmanual| for detailed information. +% This allows very complex arithmetic expressions as any of the trim/clip coordinates or other numeric options. +% Note\marginpar{Space=Separator} that the four values for \Macro\trimbox and \Macro\clipbox as well as for the |trim| and |viewport| option of \Macro\adjustbox +% 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 `|{ }|'. +% +% \DescribeMacros +% \hbox{\Macro\width~~~\Macro\height~~~\Macro\depth~~~\Macro\totalheight}% +% \endDescribeMacros +% This \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. +% +% 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 |trim| and |viewport| ptions 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 |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. +% +% +% \subsubsection*{Examples for Argument Values} +% \hbox to \linewidth{\hss\Macro\trimbox{'{.5\width} 10 {log10(10)/sin(45) + 1} 10pt'}{<content>}\hss} +% will trim half the original amount from the left, 10\,bp from the bottom and +% 2.42328\,bp from the right (bp, because no unit was used in the formula; change e.g. `|+ 1|' to `|+ 1pt|' to get 2.42328\,pt), +% as well as 10\,pt from the top. +% +% \subsection{Verbatim Support}\label{sec:verbatim} +% The macros read the \meta{text} as \TeX{} \Macro\hbox and not as an macro argument in order to support verbatim content. +% This means that the braces around the content can also be written as \Macro\bgroup and \Macro\egroup:\\[\smallskipamount] +% \hspace*{2\parindent}\Macro\trimbox{1 2 3 4}\AlsoMacro\bgroup~<content>\AlsoMacro\egroup\\[\smallskipamount] +% Special care is taken to allow the \meta{text} to be a single macro (except \Macro\bgroup) without any braces:\\[\smallskipamount] +% \hspace*{2\parindent}\Macro\clipbox{1 2 3 4}\AlsoMacro\somemacro\\[\smallskipamount] +% This is to support the questionable habit of some \LaTeX{} users to drop the braces for single token arguments. +% All environments support verbatim content. +% +% \subsection{Alternatives for existing Macros}\label{sec:alternatives} +% 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. +% +% \begin{table}[b] +% \belowcaptionskip\abovecaptionskip +% \colorlet{optional}{black} +% \caption{Alternatives for existing Macros}\label{tab:alternatives} +% \hbox to \linewidth{\hss +% \begin{tabular}{ll} +% \toprule +% Original Macro (w/o text argument) & Alternative (w/o text argument) \\ +% \midrule +% \Macro\rotatebox{<angle>} & \Macro\adjustbox{'angle='<angle>} \\ +% \Macro\scalebox{<factor>} & \Macro\adjustbox{'scale='<factor>} \\ +% \Macro\scalebox{<x-factor>}[<y-factor>] & \Macro\adjustbox{'width='<x-factor>\AlsoMacro\width',height='<y-factor>\AlsoMacro\height} \\ +% \Macro\reflectbox & \Macro\adjustbox{'width=-'\AlsoMacro\width',height='\AlsoMacro\height} \\ +% \Macro\resizebox{<width>}{<height>} & \Macro\adjustbox{'width='<width>',height='<height>} \\ +% \Macro\resizebox*{<width>}{<totalheight>} & \Macro\adjustbox{'width='<width>',totalheight='<totalheight>} \\ +% \Macro\trimbox{<llx>~<lly>~<urx>~<ury>} & \Macro\adjustbox{'trim='<llx>~<lly>~<urx>~<ury>} \\ +% \Macro\trimbox*{<llx>~<lly>~<urx>~<ury>} & \Macro\adjustbox{'viewport='<llx>~<lly>~<urx>~<ury>} \\ +% \Macro\clipbox{<llx>~<lly>~<urx>~<ury>} & \Macro\adjustbox{'trim='<llx>~<lly>~<urx>~<ury>,clip} \\ +% \Macro\clipbox*{<llx>~<lly>~<urx>~<ury>} & \Macro\adjustbox{'viewport='<llx>~<lly>~<urx>~<ury>,clip} \\ +% \bottomrule +% \end{tabular}% +% \hss}% +% \end{table} +% +% \clearpage +% \section{Examples} +% +% \def\examplecontent{\begin{tabular}{@{}|c|c|@{}} +% \hline +% A & B \\ +% \hline +% C & D \\ +% \hline +% \end{tabular}} +% The following examples show the application of the package macros on an example text. +% The result is placed in a tight, colored frame box to show the resulting dimensions. +% \begingroup +% \fboxsep=0pt% +% \def\Fbox{\fcolorbox{red}{white}}% +% \def\X{\vspace*{20pt}}% +% \par\bigskip\noindent +% \begin{tabular}{@{}lc} +% \X\Macro\example & \Fbox{\examplecontent} \\ +% \X\Macro\trimbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\trimbox{10 5 10 5}{\examplecontent}} \\ +% \X\Macro\clipbox{10 5 10 5}{\AlsoMacro\example} & \Fbox{\clipbox{10 5 10 5}{\examplecontent}} \\ +% \X\Macro\trimbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\trimbox*{15 5 25 30}{\examplecontent}} \\ +% \X\Macro\clipbox*{15 5 25 30}{\AlsoMacro\example} & \Fbox{\clipbox*{15 5 25 30}{\examplecontent}} \\ +% \X\Macro\adjustbox{trim=10 5 10 5,angle=45}{\AlsoMacro\example} & \Fbox{\adjustbox{trim=10 5 10 5,angle=45}{\examplecontent}} \\ +% \X\Macro\adjustbox{scale=1.5}{\AlsoMacro\example} & \Fbox{\adjustbox{scale=1.5}{\examplecontent}} \\ +% \X\Macro\adjustbox{width=180pt,height=20pt}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt}{\examplecontent}} \\ +% \X\Macro\adjustbox{width=180pt,height=20pt,keepaspectratio}{\AlsoMacro\example} & \Fbox{\adjustbox{width=40pt,height=10pt,keepaspectratio}{\examplecontent}} \\ +% \end{tabular} +% +% \subsubsection*{Environment example:} +% \noindent +% \Macro\begin{adjustbox}{angle=2}:\\ +% \begin{adjustbox}{angle=2} +% | verbatim inside \begin{adjustbox}{angle=2} ... \end{adjustbox} | +% \end{adjustbox} +% \endgroup +% +% \StopEventually{} +% \clearpage +% \iffalse +%<*package> +% \fi +% \section{Implementation} +% +% \begin{macrocode} +\RequirePackage{graphicx}[1999/02/16] +\RequirePackage{pgf} +% \end{macrocode} +% +% \begin{environment}{clipbox} +% \begin{macro}{\clipbox} +% \begin{macrocode} +\newcommand\clipbox{% + \begingroup + \def\adjustbox@name{clipbox}% + \@ifstar + {\adjustbox@{clip,viewport=}}% + {\adjustbox@{clip,trim=}}% +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\endclipbox{% + \endadjustbox +} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{clipbox*} +% \begin{macrocode} +\newenvironment{clipbox*} + {\begin{clipbox}*} + {\end{clipbox}} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{trimbox} +% \begin{macro}{\trimbox} +% \begin{macrocode} +\newcommand\trimbox{% + \begingroup + \def\adjustbox@name{trimbox}% + \@ifstar + {\adjustbox@{viewport=}}% + {\adjustbox@{trim=}}% +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\endtrimbox{% + \endadjustbox +} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{trimbox*} +% \begin{macrocode} +\newenvironment{trimbox*} + {\begin{trimbox}*} + {\end{trimbox}} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{adjustbox} +% \begin{macro}{\adjustbox} +% \begin{macrocode} +\newcommand\adjustbox{% + \begingroup + \tracinggroups=1% + \def\adjustbox@name{adjustbox}% + \adjustbox@{}% +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\endadjustbox{% + \unskip + \egroup + \color@endgroup + \egroup + \adjustbox@@ +} +% \end{macrocode} +% \end{environment} +% +% +% \begin{macro}{\adjustbox@} +% \begin{macrocode} +\def\adjustbox@#1#2{% + \def\adjustbox@setkeys{\setkeys{Gin}{#1#2}}% + \ifx\@currenvir\adjustbox@name + \expandafter\def\expandafter\@currenvir\expandafter{\@currenvir\empty}% + \def\next{% + \setbox\@tempboxa\hbox\bgroup + \color@setgroup\bgroup + \ignorespaces + }% + \else + \def\next{% + \setbox\@tempboxa\hbox\bgroup%0 + \color@setgroup\bgroup% + \aftergroup\color@endgroup + \aftergroup\egroup% + \aftergroup\adjustbox@@ + \@ifnextchar\bgroup + {\let\@let@token=}% + {\adjust@box}% + }% + \fi + \next +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\adjust@box} +% \begin{macrocode} +\def\adjust@box#1{% + #1\egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\adjustbox@@} +% \begin{macrocode} +\def\adjustbox@@{% +% \end{macrocode} +% Set the box dimension macros. +% \begin{macrocode} + \def\width{\wd\@tempboxa}% + \def\height{\ht\@tempboxa}% + \def\depth{\dp\@tempboxa}% + \@tempdimc=\ht\@tempboxa + \advance\@tempdimc by \dp\@tempboxa\relax + \def\totalheight{\@tempdimc}% +% \end{macrocode} +% Locally redefine \Macro\Gin@defaultbp to use \Macro\pgfmathsetmacro +% with |bp| as the default unit. +% This should yield the same results (apart of smaller rounding errors) if values +% are given without unit but avoids the internal conversion to |bp| of values with +% units. +% \begin{macrocode} + \def\pgfmathresultunitscale{1bp}% + \let\pgfmathpostparse\pgfmathscaleresult + \let\Gin@defaultbp\pgfmathsetmacro + \let\setlength\pgfmathsetlength +% \end{macrocode} +% The rest of the code was adapted from the \Macro\Gin@ii macro from the |graphicx| package. +% The \emph{temp switch a} is set to |true| to indicate to |graphicx| that the +% scaling should be done internal, so this package doesn't have to do it. +% The content including macro \Macro\adjustbox@@@ is but into place, +% the saved options are activated and the final size is set. +% The typesetting of the content is finally done by executing the token register. +% \begin{macrocode} + \@tempswatrue + \toks@{{\adjustbox@@@}}% + \adjustbox@setkeys + \Gin@esetsize + \the\toks@ + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\adjustbox@@@} +% \begin{macrocode} +\def\adjustbox@@@{% + \def\Gin@llx{0}% + \Gin@defaultbp\Gin@lly{+-\dp\@tempboxa}% + \Gin@defaultbp\Gin@urx{+\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{+\ht\@tempboxa}% + \Gin@viewport@code + \begin{pgfpicture}% + \pgfpathmoveto{\pgfqpoint{\Gin@llx pt}{\Gin@lly pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@lly pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@ury pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@llx pt}{\Gin@ury pt}}% + \pgfpathclose + \expandafter\pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi\relax + \pgfset{inner sep=\z@,outer sep=\z@}% + \pgfnode{rectangle}{base west}{\box\@tempboxa}{}{}% + \end{pgfpicture}% +} +% \end{macrocode} +% \end{macro} +% +% \Finale +% \iffalse +%</package> +% \fi diff --git a/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins b/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins new file mode 100644 index 00000000000..c0dd5b90750 --- /dev/null +++ b/Master/texmf-dist/source/latex/adjustbox/adjustbox.ins @@ -0,0 +1,49 @@ +%% $Id: adjustbox.ins 2062 2011-01-25 02:03:20Z martin $ +\input docstrip.tex +\preamble + +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. + +\endpreamble +\keepsilent + +\generate{% + \file{adjustbox.sty}{\from{adjustbox.dtx}{package}}% +} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* adjustbox.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file adjustbox.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile + +%% vim: ft=tex + diff --git a/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty new file mode 100644 index 00000000000..247bd6368d0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/adjustbox/adjustbox.sty @@ -0,0 +1,134 @@ +%% +%% This is file `adjustbox.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% adjustbox.dtx (with options: `package') +%% +%% 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. +%% +\ProvidesPackage{adjustbox} + [2011/01/27 v0.2 Adjusting TeX boxes (trim, clip, ...)] +\RequirePackage{graphicx}[1999/02/16] +\RequirePackage{pgf} +\newcommand\clipbox{% + \begingroup + \def\adjustbox@name{clipbox}% + \@ifstar + {\adjustbox@{clip,viewport=}}% + {\adjustbox@{clip,trim=}}% +} +\def\endclipbox{% + \endadjustbox +} +\newenvironment{clipbox*} + {\begin{clipbox}*} + {\end{clipbox}} +\newcommand\trimbox{% + \begingroup + \def\adjustbox@name{trimbox}% + \@ifstar + {\adjustbox@{viewport=}}% + {\adjustbox@{trim=}}% +} +\def\endtrimbox{% + \endadjustbox +} +\newenvironment{trimbox*} + {\begin{trimbox}*} + {\end{trimbox}} +\newcommand\adjustbox{% + \begingroup + \tracinggroups=1% + \def\adjustbox@name{adjustbox}% + \adjustbox@{}% +} +\def\endadjustbox{% + \unskip + \egroup + \color@endgroup + \egroup + \adjustbox@@ +} +\def\adjustbox@#1#2{% + \def\adjustbox@setkeys{\setkeys{Gin}{#1#2}}% + \ifx\@currenvir\adjustbox@name + \expandafter\def\expandafter\@currenvir\expandafter{\@currenvir\empty}% + \def\next{% + \setbox\@tempboxa\hbox\bgroup + \color@setgroup\bgroup + \ignorespaces + }% + \else + \def\next{% + \setbox\@tempboxa\hbox\bgroup%0 + \color@setgroup\bgroup% + \aftergroup\color@endgroup + \aftergroup\egroup% + \aftergroup\adjustbox@@ + \@ifnextchar\bgroup + {\let\@let@token=}% + {\adjust@box}% + }% + \fi + \next +} +\def\adjust@box#1{% + #1\egroup +} +\def\adjustbox@@{% + \def\width{\wd\@tempboxa}% + \def\height{\ht\@tempboxa}% + \def\depth{\dp\@tempboxa}% + \@tempdimc=\ht\@tempboxa + \advance\@tempdimc by \dp\@tempboxa\relax + \def\totalheight{\@tempdimc}% + \def\pgfmathresultunitscale{1bp}% + \let\pgfmathpostparse\pgfmathscaleresult + \let\Gin@defaultbp\pgfmathsetmacro + \let\setlength\pgfmathsetlength + \@tempswatrue + \toks@{{\adjustbox@@@}}% + \adjustbox@setkeys + \Gin@esetsize + \the\toks@ + \endgroup +} +\def\adjustbox@@@{% + \def\Gin@llx{0}% + \Gin@defaultbp\Gin@lly{+-\dp\@tempboxa}% + \Gin@defaultbp\Gin@urx{+\wd\@tempboxa}% + \Gin@defaultbp\Gin@ury{+\ht\@tempboxa}% + \Gin@viewport@code + \begin{pgfpicture}% + \pgfpathmoveto{\pgfqpoint{\Gin@llx pt}{\Gin@lly pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@lly pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@urx pt}{\Gin@ury pt}}% + \pgfpathlineto{\pgfqpoint{\Gin@llx pt}{\Gin@ury pt}}% + \pgfpathclose + \expandafter\pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi\relax + \pgfset{inner sep=\z@,outer sep=\z@}% + \pgfnode{rectangle}{base west}{\box\@tempboxa}{}{}% + \end{pgfpicture}% +} +\endinput +%% +%% End of file `adjustbox.sty'. |