summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/gincltex/README (renamed from Master/texmf-dist/source/latex/gincltex/README)7
-rw-r--r--Master/texmf-dist/doc/latex/gincltex/gincltex.pdfbin175896 -> 168041 bytes
-rw-r--r--Master/texmf-dist/source/latex/gincltex/Makefile77
-rw-r--r--Master/texmf-dist/source/latex/gincltex/gincltex.dtx200
-rw-r--r--Master/texmf-dist/source/latex/gincltex/gincltex.ins4
-rw-r--r--Master/texmf-dist/tex/latex/gincltex/gincltex.sty75
6 files changed, 102 insertions, 261 deletions
diff --git a/Master/texmf-dist/source/latex/gincltex/README b/Master/texmf-dist/doc/latex/gincltex/README
index d773575771c..c9d521d6ad9 100644
--- a/Master/texmf-dist/source/latex/gincltex/README
+++ b/Master/texmf-dist/doc/latex/gincltex/README
@@ -1,8 +1,6 @@
The gincltex Package
Copyright (C) 2011 -- Martin Scharrer <martin@scharrer-online.de>
-Version v0.1 -- 2011/03/06
-
This small package builds on the standard LaTeX packages graphic
and/or graphicx and allows external LaTeX source files to be included like
graphic files, i.e. adds support for the `.tex' extension.
@@ -10,7 +8,6 @@ graphic files, i.e. adds support for the `.tex' extension.
\includegraphics[<options>]{somefile.tex}
Some of the lower level operations like clipping and trimming are implemented
-using the pgf package which supports both DVI/PS and PDF output. This package
-uses a very similar technique than the author's other package adjustbox, but
-provides a different interface.
+using the authors other package 'adjustbox' which supports native pdflatex support
+and itself uses the 'pgf' package for other output formats.
diff --git a/Master/texmf-dist/doc/latex/gincltex/gincltex.pdf b/Master/texmf-dist/doc/latex/gincltex/gincltex.pdf
index 6aec3e4436e..21080552958 100644
--- a/Master/texmf-dist/doc/latex/gincltex/gincltex.pdf
+++ b/Master/texmf-dist/doc/latex/gincltex/gincltex.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/gincltex/Makefile b/Master/texmf-dist/source/latex/gincltex/Makefile
deleted file mode 100644
index ea45bae4ef4..00000000000
--- a/Master/texmf-dist/source/latex/gincltex/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-TEXMF=${HOME}/texmf
-INSTALLDIR=${TEXMF}/tex/latex/gincltex
-DOCINSTALLDIR=${TEXMF}/doc/latex/gincltex
-CP=cp
-RMDIR=rm -rf
-PDFLATEX=pdflatex -interaction=batchmode
-LATEXMK=latexmk -pdf -silent
-
-PACKEDFILES=gincltex.sty
-DOCFILES=gincltex.pdf
-SRCFILES=gincltex.dtx gincltex.ins README Makefile
-
-all: unpack doc
-
-package: unpack
-class: unpack
-
-${PACKEDFILES}: gincltex.dtx gincltex.ins
- yes | pdflatex gincltex.ins
-
-unpack: ${PACKEDFILES}
-
-# 'doc' and 'gincltex.pdf' call itself until everything is stable
-doc: gincltex.pdf
- @${MAKE} --no-print-directory gincltex.pdf
-
-pdfopt: doc
- @-pdfopt gincltex.pdf .temp.pdf && mv .temp.pdf gincltex.pdf
-
-%.pdf: %.dtx
- ${PDFLATEX} $<
- -makeindex -s gind.ist -o "$@" "$<"
- -makeindex -s gglo.ist -o "$@" "$<"
- ${PDFLATEX} $<
- ${PDFLATEX} $<
-
-
-clean:
- -latexmk -C gincltex.dtx
- ${RM} ${PACKEDFILES} *.zip *.log *.aux *.toc *.vrb *.nav *.pdf *.snm *.out *.fdb_latexmk *.glo *.gls *.hd *.sta *.stp
- ${RMDIR} tds
-
-install: unpack doc ${INSTALLDIR} ${DOCINSTALLDIR}
- ${CP} ${PACKEDFILES} ${INSTALLDIR}
- ${CP} ${DOCFILES} ${DOCINSTALLDIR}
- texhash ${TEXMF}
-
-${INSTALLDIR}:
- mkdir -p $@
-
-${DOCINSTALLDIR}:
- mkdir -p $@
-
-ctanify: ${SRCFILES} ${DOCFILES} gincltex.tds.zip
- ${RM} gincltex.zip
- zip gincltex.zip $^
- unzip -t gincltex.zip
- unzip -t gincltex.tds.zip
-
-zip: gincltex.zip
-
-tdszip: gincltex.tds.zip
-
-gincltex.zip: ${SRCFILES} ${DOCFILES} | pdfopt
- ${RM} $@
- zip $@ $^
-
-gincltex.tds.zip: ${SRCFILES} ${PACKEDFILES} ${DOCFILES} | pdfopt
- ${RMDIR} tds
- mkdir -p tds/tex/latex/gincltex
- mkdir -p tds/doc/latex/gincltex
- mkdir -p tds/source/latex/gincltex
- ${CP} ${DOCFILES} tds/doc/latex/gincltex
- ${CP} ${PACKEDFILES} tds/tex/latex/gincltex
- ${CP} ${SRCFILES} tds/source/latex/gincltex
- cd tds; zip -r ../$@ .
-
diff --git a/Master/texmf-dist/source/latex/gincltex/gincltex.dtx b/Master/texmf-dist/source/latex/gincltex/gincltex.dtx
index 151d8101e9a..68b864e4a08 100644
--- a/Master/texmf-dist/source/latex/gincltex/gincltex.dtx
+++ b/Master/texmf-dist/source/latex/gincltex/gincltex.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2009 by Martin Scharrer <martin@scharrer-online.de>
+% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de>
% -----------------------------------------------------------------
%
% This work may be distributed and/or modified under the
@@ -29,12 +29,10 @@
%<*driver>
\ProvidesFile{gincltex.dtx}
%</driver>
- [2011/03/06 v0.1 Include external LaTeX files like graphics]
+ [2011/09/04 v0.3 Include external LaTeX files like graphics]
%<*driver>
-\documentclass{ltxdoc}
+\documentclass{ydoc}[2011/03/17]
\usepackage{gincltex}
-\usepackage{hyperref}
-\let\pkg\texttt
\EnableCrossrefs
%\CodelineIndex
\RecordChanges
@@ -47,7 +45,7 @@
%</driver>
% \fi
%
-% \CheckSum{233}
+% \CheckSum{161}
%
% \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
@@ -68,34 +66,20 @@
%
% \changes{v0.1}{2011/01/23}{Packaged code}
% \changes{v0.1}{2011/03/06}{First release}
+% \changes{v0.2}{2011/03/18}{Added explicit 'draft' and 'final' options.}
+% \changes{v0.3}{2011/09/04}{Clipping and trimming are now done using the \pkg{adjustbox} package.}
%
% \GetFileInfo{\jobname.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\let}
%
-% \ifpdf
-% \hypersetup{%
-% pdfauthor = {Martin Scharrer <martin@scharrer-online.de>},
-% pdftitle = {The gincltex package},
-% pdfsubject = {Documentation of LaTeX package gincltex},
-% pdfkeywords = {gincltex, include, graphic, source code, LaTeX, TeX}
-% }%
-% \fi
-% \clearpage
-% \null
-% \vspace*{-2em}
-% \begin{center}
-% {\LARGE\sffamily The \emph{gincltex} Package\\[\medskipamount]}
-% {\large Martin Scharrer \\[\medskipamount]\normalsize
-% \url{martin@scharrer-online.de}\\[.8ex]
-% \url{http://www.ctan.org/pkg/gincltex/}\\[\bigskipamount]}
-% {\large Version \fileversion\ -- \filedate}\\
-% \end{center}
-% \vspace{1.2em}%
+% \author{Martin Scharrer}
+% \email{martin@scharrer-online.de}
+% \maketitle
%
% \begin{abstract}
-% This small package builds on the standard \LaTeX{} packages \pkg{graphic} and/or \pkg{graphicx}
-% and allows external \LaTeX{} source files to be included like graphic files, i.e. adds support for the `|.tex|'
+% This small package builds on the standard \LaTeX{} package \pkg{graphicx}
+% and allows external \LaTeX{} source files to be included like graphic files, i.e. adds support for the ".tex"
% extension.
% Some of the lower level operations like clipping and trimming are implemented using the \pkg{pgf} package which supports
% both DVI/PS and PDF output.
@@ -107,52 +91,56 @@
% \end{abstract}
%
% \section{Introduction}
-% This small package builds on the standard \LaTeX{} packages |graphic| and |graphicx|
+% This small package builds on the standard \LaTeX{} package \pkg{graphicx}
% and allows external \LaTeX{} source files to be included like graphic files:
-% \begin{quote}
-% |\includegraphics[<options>]{somefile.tex}|
-% \end{quote}
%
+% \begin{macroquote}
+% \includegraphics[<options>]{<\/file>'.tex'}
+% \end{macroquote}
+%
+% \noindent
% A \LaTeX{} file included this way should result in an identical display as a tightly cropped EPS or PDF image
% of the same file (apart smaller rounding differences).
% Usually such files hold a picture environment like
-% |picture|, |pspicture|, |pgfpicture| or |tikzpicture|, which may take advantage
-% from the |standalone| class.
+% \env{picture}, \env{pspicture}, \env{pgfpicture} or \env{tikzpicture}, which may take advantage
+% from the \cls{standalone} class.
% In fact \pkg{gincltex} is used in newer versions of \pkg{standalone} to seamlessly switch between source and image files.
%
-% All options of |\includegraphics| described in the manual of |graphic|/|graphicx| (the |grfguide|)
+% All options of \Macro\includegraphics described in the manual of \pkg{graphicx} (the \texttt{grfguide})
% should be supported. Therefore it is possible to resize, rotate and clip the content
% of the \LaTeX{} source file in the same way as for images.
%
%
% An alternative is the \pkg{adjustbox} package from the same author which allows the same options
-% as for |\includegraphics| for arbitrary TeX material:
-% \begin{quote}
-% |\adjustbox{<includegraphics options>}{\input{somefile}}|
-% \end{quote}
+% as for \Macro\includegraphics for arbitrary TeX material:
+% \begin{macroquote}
+% \adjustbox{<includegraphics options>}{'\input{'<\/file>'}'}
+% \end{macroquote}
%
% \section{Usage}
-% After loading the package the |.tex| extension is supported by |\includegraphics|
+% After loading the package the ".tex" extension is supported by \Macro\includegraphics
% and the macro can be used in its normal form for \LaTeX{} files.
% The content of the file is typeset first inside an |\hbox| (the primitive version of |\mbox|)
% and then modified according to the given macro options.
-% Either the \pkg{graphic} or \pkg{graphicx} package must also be loaded by the user.
-% This package doe
+% The \pkg{graphicx} package is automatically loaded.
%
% \subsection{Draft support}
-% The package supports the |draft| option of |graphics| which only displays an empty box
+% The package supports the \opt{draft} option of \pkg{graphicx} which only displays an empty box
% with the file name for all included graphics.
% In this mode the source file should not be processed to reduce compile time.
% However the size of the resulting box from the source file must be know in order
% to reserve the required space. Therefore the \emph{bounding box} information is
-% cached for future runs with active |draft| option. The location where the information
-% is cached can be controlled with the |bb| option.
+% cached for future runs with active \opt{draft} option. The location where the information
+% is cached can be controlled with the \opt{bb} option.
%
% \subsection{Package options}
+% The \opt*{draft} and \opt*{final} options are directly passed to the loaded \pkg{graphicx} package.
+% Having a different draft setting is not supported and the one used by the \pkg{graphicx} package will always take affect for \pkg{gincltex}.
+%
% The place where the bounding box information is cached can be adjusted with the
-% |bb| option. By default |bb=aux| is active which stores the bounding box information
+% \opt*{bb} option. By default |bb=aux| is active which stores the bounding box information
% in the |.aux| file. With |bb=file| this information is written in EPS format into
-% |.tex.bb| files, e.g. for each source file |name.tex| a file |name.tex.bb| is created.
+% |.tex.bb| files, e.g. for each source file "name.tex" a file "name.tex.bb" is created.
%
%
% \StopEventually{}
@@ -166,25 +154,28 @@
\newif\if@gincltex@bbfile
\DeclareOption{bb=file}{\@gincltex@bbfiletrue}
\DeclareOption{bb=aux}{\@gincltex@bbfilefalse}
+\DeclareOption{draft}{\PassOptionsToPackage{draft}{graphicx}}
+\DeclareOption{draft=true}{\PassOptionsToPackage{draft}{graphix}}
+\DeclareOption{draft=false}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final=true}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final=false}{\PassOptionsToPackage{draft}{graphicx}}
+\DeclareOption*{\PassOptionsToPackage\CurrentOption{adjustbox}}
\ProcessOptions*\relax
% \end{macrocode}
%
% \subsection{Requirements}
-% The \pkg{graphics} package is required. The \pkg{graphicx} package is also supported and can
-% be loaded beforehand or afterwards.
-%
-% The \pkg{pgf} package is required for the "graphic" manipulations.
-% It actually loads \pkg{graphicx} internally.
+% The \pkg{graphicx} package is required.
+% The \pkg{pgf} package is required for the graphic manipulations.
% \begin{macrocode}
-\RequirePackage{graphics}
-\RequirePackage{pgf}
+\RequirePackage{adjustbox}
% \end{macrocode}
%
% \subsection{Graphics Rule Macros}
% The following macro implement a \emph{graphics rule} for \LaTeX{} source code files.
%
% \begin{macro}{\Gin@rule@.tex}
-% This macro declares the graphics rule to the |graphics|/|x| package.
+% This macro declares the graphics rule to the \pkg{graphicx} package.
% \begin{macrocode}
\DeclareGraphicsRule{.tex}{tex}{.tex}{}
% \end{macrocode}
@@ -199,21 +190,32 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\gincltex@input}
-% Macro to input the \LaTeX{} source file.
-% Because |\includegraphics| can be used inside this file certain internal |graphics| macros
+% \begin{macro}{\gincltex@boxfile}
+% Macro to box the \LaTeX{} source file.
+% Because \Macro\includegraphics can be used inside this file certain internal \pkg{graphicx} macros
% must be reset to there default value.
+% The argument is expanded first because it could include |\Gin@ext|.
+% The content is stored with zero depth to achieve the same result as with included graphics.
% \begin{macrocode}
-\def\gincltex@input#1{%
- {\let\Gin@ext\relax\input{#1}}%
+\def\gincltex@boxfile#1{%
+ \sbox\gincltex@box{{%
+ \hbox{\vbox{%
+ \hbox{%
+ \edef\@tempa{{#1}}%
+ \let\Gin@ext\relax
+ \expandafter\input\@tempa
+ }%
+ \vskip\z@
+ }}%
+ }}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Ginclude@tex}
-% This driver macro is called from the standard |\includegraphics| macro to include the \LaTeX{} source file.
-% Some |\includegraphics| options like |angle| are handled by wrapping this macro in the appropriate
-% |graphics| macro like |\rotatebox|, but others must be handled here.
+% This driver macro is called from the standard \Macro\includegraphics macro to include the \LaTeX{} source file.
+% Some \Macro\includegraphics options like |angle| are handled by wrapping this macro in the appropriate
+% \pkg{graphicx} macro like \Macro\rotatebox, but others must be handled here.
% \begin{macrocode}
\def\Ginclude@tex#1{%
\begingroup
@@ -222,40 +224,15 @@
% If not it is saved here.
% \begin{macrocode}
\ifvoid\gincltex@box
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \gincltex@boxfile{#1}%
\fi
% \end{macrocode}
-% The bounding box points (lower left, upper right) are calculated. It is assumed that the `graphic' baseline starts at the
-% lower left point, so |llx=0|. The depth should be |0| as well but to be on the save side it is calculated here.
-% The upper right point is given by the box width and height.
-% \begin{macrocode}
- \def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
- \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
- \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
-% \end{macrocode}
% The |height|, |totalheight| and |width| options are already processed and the final requested height and width
-% to which the `graphic' should be scaled to are provided. The internal form of the |\resizebox| macro is used for
+% to which the `graphic' should be scaled to are provided. The internal form of the \Macro\resizebox macro is used for
% this.
% \begin{macrocode}
- \Gscale@@box\totalheight{\Gin@req@width}{\Gin@req@height}{%
-% \end{macrocode}
-% The trimming and clipping operations (|trim|, |viewport| and |clip| options) are handled using a |pgfpicture| from
-% the |pgf| package, because it supports both DVI and PDF output.
-% \begin{macrocode}
- \begin{pgfpicture}%
- \pgfkeys{/pgf/.cd,inner sep=0pt,outer sep=0pt}%
- \pgfpathmoveto{\pgfqpoint{\Gin@llx bp}{\Gin@lly bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@lly bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@ury bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@llx bp}{\Gin@ury bp}}%
- \pgfpathclose
- \expandafter
- \pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi
- \pgfnode{rectangle}{base west}{\usebox\gincltex@box}{}{}%
- \end{pgfpicture}%
-% \end{macrocode}
-% \begin{macrocode}
+ \resizebox*{\Gin@req@width}{\Gin@req@height}{%
+ \ifGin@clip\expandafter\clipbox\else\expandafter\clipbox\fi*{{\Gin@llx} {\Gin@lly} {\Gin@urx} {\Gin@ury}}{\usebox\gincltex@box}%
}%
\endgroup
}
@@ -263,7 +240,7 @@
% \end{macro}
%
% The |\Gread@tex| macro is defined in two different ways depending how the bounding box information is preserved.
-% This information is required to support the |draft| option of the |graphics| package.
+% This information is required to support the \opt{draft} option of the \pkg{graphicx} package.
% \begin{macrocode}
\if@gincltex@bbfile
% \end{macrocode}
@@ -277,31 +254,6 @@
\@ifundefined{gincltex@bbout}{\newwrite\gincltex@bbout}{}
% \end{macrocode}
%
-% \begin{macro}{\Gread@tex}
-% \begin{macrocode}
-\def\Gread@tex#1{%
- \IfFileExists{#1.bb}%
- {%
- \edef\Gread@BBox{\@percentchar\@percentchar HiResBoundingBox}%
- \Gread@eps{#1.bb}%
- }%
- {%
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
- \def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
- \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
- \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
- \expandafter\xdef\csname gincltex@bb@#1\endcsname
- {{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}%
- \if@filesw
- \immediate\write\@auxout{\string\gincltex@bb{#1}%
- \csname gincltex@bb@#1\endcsname}%
- \fi
- }%
-}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\gincltex@bb}
% Write the bounding box information to the |.tex.bb| file. The hi-resolution version is used to be more accurate.
% The code to write the normal version is disabled for now because it is unneeded and requires some non-trivial |pgfmath| calls.
@@ -314,12 +266,6 @@
\def\gincltex@@bb#1#2#3#4#5{%
\begingroup
\immediate\openout\gincltex@bbout=#1.bb\relax
- %\pgfmathtruncatemacro\llx{ceil(#2)}%
- %\pgfmathtruncatemacro\lly{ceil(#3)}%
- %\pgfmathtruncatemacro\urx{ceil(#4)}%
- %\pgfmathtruncatemacro\ury{ceil(#5)}%
- %\immediate\write\gincltex@bbout{\@percentchar
- % \@percentchar BoundingBox: \llx\space\lly\space\urx\space\ury}%
\immediate\write\gincltex@bbout{\@percentchar
\@percentchar HiResBoundingBox: #2 #3 #4 #5}%
\immediate\closeout\gincltex@bbout
@@ -348,15 +294,15 @@
% \begin{macro}{\Gread@tex}
% Read the bounding box information. The only way to do this is to actually typeset the source file into a box.
% The box is then reused in the |\Ginclude@tex| macro, so there is no overhead.
-% The bounding box information is written into the |.aux| file to avoid processing the source file in |draft| mode.
-% However if the corresponding macro is not define yet (e.g.\ |draft| run without |.aux| file) the file must be
+% The bounding box information is written into the |.aux| file to avoid processing the source file in \opt{draft} mode.
+% However if the corresponding macro is not define yet (e.g.\ \opt{draft} run without |.aux| file) the file must be
% read anyway.
% \begin{macrocode}
\def\Gread@tex#1{%
\ifcase0\ifGin@draft\@ifundefined{gincltex@bb@#1}{0}{1}\fi\relax
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \gincltex@boxfile{#1}%
\def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
+ \let\Gin@llx\Gin@lly
\Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
\Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
\expandafter\xdef\csname gincltex@bb@#1\endcsname
diff --git a/Master/texmf-dist/source/latex/gincltex/gincltex.ins b/Master/texmf-dist/source/latex/gincltex/gincltex.ins
index 52858c81cc4..22770967727 100644
--- a/Master/texmf-dist/source/latex/gincltex/gincltex.ins
+++ b/Master/texmf-dist/source/latex/gincltex/gincltex.ins
@@ -34,9 +34,9 @@ and the derived file gincltex.sty.
\Msg{* To finish the installation you have to move the following *}
\Msg{* file into a directory searched by TeX: *}
\Msg{* *}
-\Msg{* gincltex.sty *}
+\Msg{* gincltex.sty *}
\Msg{* *}
-\Msg{* To produce the documentation run the file gincltex.dtx *}
+\Msg{* To produce the documentation run the file gincltex.dtx *}
\Msg{* through LaTeX. *}
\Msg{* *}
\Msg{* Happy TeXing! *}
diff --git a/Master/texmf-dist/tex/latex/gincltex/gincltex.sty b/Master/texmf-dist/tex/latex/gincltex/gincltex.sty
index b31d169fb0e..e11a1d4feee 100644
--- a/Master/texmf-dist/tex/latex/gincltex/gincltex.sty
+++ b/Master/texmf-dist/tex/latex/gincltex/gincltex.sty
@@ -27,75 +27,50 @@
%%
\RequirePackage{svn-prov}
\ProvidesPackage{gincltex}
- [2011/03/06 v0.1 Include external LaTeX files like graphics]
+ [2011/09/04 v0.3 Include external LaTeX files like graphics]
\newif\if@gincltex@bbfile
\DeclareOption{bb=file}{\@gincltex@bbfiletrue}
\DeclareOption{bb=aux}{\@gincltex@bbfilefalse}
+\DeclareOption{draft}{\PassOptionsToPackage{draft}{graphicx}}
+\DeclareOption{draft=true}{\PassOptionsToPackage{draft}{graphix}}
+\DeclareOption{draft=false}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final=true}{\PassOptionsToPackage{final}{graphicx}}
+\DeclareOption{final=false}{\PassOptionsToPackage{draft}{graphicx}}
+\DeclareOption*{\PassOptionsToPackage\CurrentOption{adjustbox}}
\ProcessOptions*\relax
-\RequirePackage{graphics}
-\RequirePackage{pgf}
+\RequirePackage{adjustbox}
\DeclareGraphicsRule{.tex}{tex}{.tex}{}
\newsavebox\gincltex@box
-\def\gincltex@input#1{%
- {\let\Gin@ext\relax\input{#1}}%
+\def\gincltex@boxfile#1{%
+ \sbox\gincltex@box{{%
+ \hbox{\vbox{%
+ \hbox{%
+ \edef\@tempa{{#1}}%
+ \let\Gin@ext\relax
+ \expandafter\input\@tempa
+ }%
+ \vskip\z@
+ }}%
+ }}%
}
\def\Ginclude@tex#1{%
\begingroup
\ifvoid\gincltex@box
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \gincltex@boxfile{#1}%
\fi
- \def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
- \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
- \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
- \Gscale@@box\totalheight{\Gin@req@width}{\Gin@req@height}{%
- \begin{pgfpicture}%
- \pgfkeys{/pgf/.cd,inner sep=0pt,outer sep=0pt}%
- \pgfpathmoveto{\pgfqpoint{\Gin@llx bp}{\Gin@lly bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@lly bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@ury bp}}%
- \pgfpathlineto{\pgfqpoint{\Gin@llx bp}{\Gin@ury bp}}%
- \pgfpathclose
- \expandafter
- \pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi
- \pgfnode{rectangle}{base west}{\usebox\gincltex@box}{}{}%
- \end{pgfpicture}%
+ \resizebox*{\Gin@req@width}{\Gin@req@height}{%
+ \ifGin@clip\expandafter\clipbox\else\expandafter\clipbox\fi*{{\Gin@llx} {\Gin@lly} {\Gin@urx} {\Gin@ury}}{\usebox\gincltex@box}%
}%
\endgroup
}
\if@gincltex@bbfile
\@ifundefined{gincltex@bbout}{\newwrite\gincltex@bbout}{}
-\def\Gread@tex#1{%
- \IfFileExists{#1.bb}%
- {%
- \edef\Gread@BBox{\@percentchar\@percentchar HiResBoundingBox}%
- \Gread@eps{#1.bb}%
- }%
- {%
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
- \def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
- \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
- \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
- \expandafter\xdef\csname gincltex@bb@#1\endcsname
- {{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}%
- \if@filesw
- \immediate\write\@auxout{\string\gincltex@bb{#1}%
- \csname gincltex@bb@#1\endcsname}%
- \fi
- }%
-}
\def\gincltex@bb#1#2#3#4#5{}
\AtBeginDocument{\let\gincltex@bb\gincltex@@bb}
\def\gincltex@@bb#1#2#3#4#5{%
\begingroup
\immediate\openout\gincltex@bbout=#1.bb\relax
- %\pgfmathtruncatemacro\llx{ceil(#2)}%
- %\pgfmathtruncatemacro\lly{ceil(#3)}%
- %\pgfmathtruncatemacro\urx{ceil(#4)}%
- %\pgfmathtruncatemacro\ury{ceil(#5)}%
- %\immediate\write\gincltex@bbout{\@percentchar
- % \@percentchar BoundingBox: \llx\space\lly\space\urx\space\ury}%
\immediate\write\gincltex@bbout{\@percentchar
\@percentchar HiResBoundingBox: #2 #3 #4 #5}%
\immediate\closeout\gincltex@bbout
@@ -110,9 +85,9 @@
}
\def\Gread@tex#1{%
\ifcase0\ifGin@draft\@ifundefined{gincltex@bb@#1}{0}{1}\fi\relax
- \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \gincltex@boxfile{#1}%
\def\Gin@llx{0}%
- \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
+ \let\Gin@llx\Gin@lly
\Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
\Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
\expandafter\xdef\csname gincltex@bb@#1\endcsname