summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gincltex/gincltex.sty
blob: e11a1d4feee142de167167359a38890759894a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
%%
%% 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'.