%%
%% This is file `gincltex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gincltex.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 gincltex.dtx, gincltex.ins
%% and the derived file gincltex.sty.
%% 
\RequirePackage{svn-prov}
\ProvidesPackage{gincltex}
  [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{adjustbox}
\DeclareGraphicsRule{.tex}{tex}{.tex}{}
\newsavebox\gincltex@box
\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
        \gincltex@boxfile{#1}%
    \fi
    \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\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
    \immediate\write\gincltex@bbout{\@percentchar
        \@percentchar HiResBoundingBox: #2 #3 #4 #5}%
    \immediate\closeout\gincltex@bbout
    \endgroup
}
\else
\def\Gread@tex@setbb#1#2#3#4{%
    \def\Gin@llx{#1}%
    \def\Gin@lly{#2}%
    \def\Gin@urx{#3}%
    \def\Gin@ury{#4}%
}
\def\Gread@tex#1{%
    \ifcase0\ifGin@draft\@ifundefined{gincltex@bb@#1}{0}{1}\fi\relax
        \gincltex@boxfile{#1}%
        \def\Gin@llx{0}%
        \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
            {{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}%
    \else
        \expandafter\expandafter\expandafter\Gread@tex@setbb
            \csname gincltex@bb@#1\endcsname
        \setbox\gincltex@box=\box\voidb@x
    \fi
    \if@filesw
        \immediate\write\@auxout{\string\gincltex@bb{#1}%
            \csname gincltex@bb@#1\endcsname}%
    \fi
}
\def\gincltex@bb#1#2#3#4#5{%
    \global\@namedef{gincltex@bb@#1}{{#2}{#3}{#4}{#5}}%
}
\fi
\endinput
%%
%% End of file `gincltex.sty'.
