0
|
1 \NeedsTeXFormat{LaTeX2e}
|
|
2 \ProvidesPackage{mediabb}[2006/10/26 v1.9 iNOUE Koich! <inoue@ma.ns.musashi-tech.ac.jp>]
|
|
3 \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfm]{graphicx}}
|
|
4 \define@key{Gin}{usebb}[true]{\expandafter\let\expandafter\if@usebb\csname if#1\endcsname}
|
|
5 \let\if@usebb\iffalse
|
|
6 \define@key{Gin}{mediaboxonly}[/MediaBox]{\@ifundefined{Gread@find@#1}%
|
|
7 {\def\Gread@rect@box{/MediaBox}\expandafter\let\expandafter\if@Gread@find@only\csname if#1\endcsname}%
|
|
8 {\def\Gread@rect@box{#1}\let\if@Gread@find@only\iftrue}}
|
|
9 \let\if@Gread@find@only\iffalse
|
|
10 \def\Gread@rect@box{/MediaBox}
|
|
11 \define@key{Gin}{autoebb}[always]{\csname Gread@ebb@#1\endcsname}
|
|
12 \def\Gread@ebb@always{\let\if@Gread@ebb@always\iftrue}
|
|
13 \let\if@Gread@ebb@always\iffalse
|
|
14 \let\Gread@ebb@true\Gread@ebb@always
|
|
15 \def\Gread@ebb@never{\let\if@Gread@ebb@never\iftrue}
|
|
16 \let\Gread@ebb@false\Gread@ebb@never
|
|
17 \let\if@Gread@ebb@never\iffalse
|
|
18 \let\Ginclude@pdf\Ginclude@eps
|
|
19 \def\Gread@pdf#1{%
|
|
20 \begingroup
|
|
21 \if@usebb\else
|
|
22 \@tempcnta\z@
|
|
23 \loop
|
|
24 \ifnum\@tempcnta<\@xxxii
|
|
25 \catcode\@tempcnta14
|
|
26 \advance\@tempcnta\@ne
|
|
27 \repeat
|
|
28 \@tempcnta127
|
|
29 \loop
|
|
30 \ifnum\@tempcnta<\@cclvi
|
|
31 \catcode\@tempcnta14
|
|
32 \advance\@tempcnta\@ne
|
|
33 \repeat
|
|
34 \let\do\@makeother\dospecials\catcode`\ 10
|
|
35 \catcode\endlinechar10
|
|
36 \immediate\openin\@inputcheck#1
|
|
37 \ifeof\@inputcheck
|
|
38 \@latex@error{File `#1' not found}\@ehc
|
|
39 \else
|
|
40 \Gread@true
|
|
41 \let\@tempa\@empty
|
|
42 \let\@tempb\@empty
|
|
43 \loop
|
|
44 \read\@inputcheck to\@tempc
|
|
45 \ifeof\@inputcheck
|
|
46 \Gread@false
|
|
47 \else
|
|
48 \edef\@tempa{\@tempb\@tempc}\let\@tempb\@tempc
|
|
49 \edef\@tempc{\@tempa\Gread@rect@box}%
|
|
50 \csname Gread@find@\Gread@rect@box\expandafter\endcsname\@tempc[\@nnil]\\%
|
|
51 \fi
|
|
52 \ifGread@
|
|
53 \repeat
|
|
54 \immediate\closein\@inputcheck
|
|
55 \fi
|
|
56 \fi
|
|
57 \ifGin@bbox
|
|
58 \else
|
|
59 \Gread@bmp{\Gin@base.bb}%
|
|
60 \fi
|
|
61 \endgroup
|
|
62 \expandafter\Gread@parse@bb\@gtempa\\}
|
|
63 \def\def@Gread@find#1#2{\ifx\@nnil#2\expandafter\@gobble\else
|
|
64 \@namedef{Gread@find@#1}##1#1##2[##3##4]##5\\{%
|
|
65 \ifx\@nnil##3\else
|
|
66 \gdef\@gtempa{##3##4 }%
|
|
67 \if@Gread@find@only
|
|
68 \Gread@false
|
|
69 \else
|
|
70 \def\Gread@rect@box{#1}%
|
|
71 \fi
|
|
72 \Gin@bboxtrue
|
|
73 \fi
|
|
74 \if@Gread@find@only\else
|
|
75 \csname Gread@find@#2\expandafter\endcsname\@tempa#2[\@nnil]\\%
|
|
76 \fi}%
|
|
77 \expandafter\def@Gread@find\fi{#2}}
|
|
78 \def@Gread@find{/MediaBox}{/CropBox}{/BleedBox}{/TrimBox}{/ArtBox}\@nnil
|
|
79 \@namedef{Gread@find@/ArtBox}#1/ArtBox#2[#3#4]#5\\{%
|
|
80 \ifx\@nnil#3\else
|
|
81 \gdef\@gtempa{#3#4 }%
|
|
82 \Gread@false
|
|
83 \Gin@bboxtrue
|
|
84 \fi}
|
|
85 \def\Gread@bmp#1{%
|
|
86 \if@Gread@ebb@never\else
|
|
87 \if@Gread@ebb@always\else
|
|
88 \immediate\openin\@inputcheck#1 %
|
|
89 \ifeof\@inputcheck
|
|
90 \Gread@ebb@always
|
|
91 \else
|
|
92 \immediate\closein\@inputcheck
|
|
93 \fi
|
|
94 \fi
|
|
95 \immediate\write18{\if@Gread@ebb@always\else[ '\Gin@base\Gin@ext' -nt '\Gin@base.bb' ] && \fi
|
|
96 \ifx\@nnil\filename@area\@nnil\else cd '\filename@area' && \fi ebb '\filename@base\Gin@ext'}%
|
|
97 \fi
|
|
98 \Gread@eps{#1}}
|
|
99 \DeclareGraphicsRule{.pdf}{pdf}{*}{}
|