summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gincltex/gincltex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/gincltex/gincltex.sty')
-rw-r--r--Master/texmf-dist/tex/latex/gincltex/gincltex.sty75
1 files changed, 25 insertions, 50 deletions
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