Debian Codegraph @

texmf-dist/tex/latex/graphics-def/pdftex.def

raw
1 %% pdftex.def
2 %% Copyright (C) 2000-2015 David Carlisle, Sebastian Rahtz,
3 %% Hans Hagen, Heiko Oberdiek and
4 %% Martin Schr\"oder
5 %% Copyright (C) 2016-2018 LaTeX3 project and Heiko Oberdiek
6 %% Copyright (C) 2018-2025 LaTeX3 project
7 %%
8 %% This work may be distributed and/or modified under the
9 %% conditions of the LaTeX Project Public License, either version 1.3c
10 %% of this license or (at your option) any later version.
11 %% The latest version of this license is in
12 %% http://www.latex-project.org/lppl.txt
13 %% and version 1.3c or later is part of all distributions of LaTeX
14 %% version 2005/12/01 or later.
15 %%
16 %% This work has the LPPL maintenance status `maintained'.
17 %%
18 %% The Current Maintainer of this work is the LaTeX3 Project.
19 %%
20 %% https://github.com/latex3/graphics-def/issues
21 %%
22 \ProvidesFile{pdftex.def}
23 [2025/09/29 v1.2d Graphics/color driver for pdftex]
24 \def\GPT@space{ }
25 \def\c@lor@arg#1{%
26 \dimen@#1\p@
27 \ifdim\dimen@<\z@\dimen@\maxdimen\fi
28 \ifdim\dimen@>\p@
29 \PackageError{color}{Argument `#1' not in range [0,1]}\@ehd
30 \fi}
31 \def\color@gray#1#2{%
32 \c@lor@arg{#2}%
33 \edef#1{#2 g #2 G}%
34 }
35 \def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1}
36 \def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
37 \c@lor@arg{#4}%
38 \c@lor@arg{#1}%
39 \c@lor@arg{#2}%
40 \c@lor@arg{#3}%
41 \edef#5{#1 #2 #3 #4 k #1 #2 #3 #4 K}%
42 }
43 \def\color@rgb#1#2{\c@lor@@rgb#2\@@#1}
44 \def\c@lor@@rgb#1,#2,#3\@@#4{%
45 \c@lor@arg{#1}%
46 \c@lor@arg{#2}%
47 \c@lor@arg{#3}%
48 \edef#4{#1 #2 #3 rg #1 #2 #3 RG}%
49 }
50 \def\color@RGB#1#2{\c@lor@@RGB#2\@@#1}
51 \def\c@lor@@RGB#1,#2,#3\@@#4{%
52 \c@lor@RGB@rgb{#1}\@tempa
53 \c@lor@RGB@rgb{#2}\@tempb
54 \c@lor@RGB@rgb{#3}\@tempc
55 \c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4%
56 }
57 \def\c@lor@RGB@rgb#1#2{%
58 \dimen@#1\p@
59 \divide\dimen@\@cclv
60 \edef#2{\strip@pt\dimen@}}
61 \def\color@named#1#2{\c@lor@@named#2,,\@@#1}
62 \def\c@lor@@named#1,#2,#3\@@#4{%
63 \@ifundefined{col@#1}%
64 {\PackageError{color}{Undefined color `#1'}\@ehd}%
65 {\edef#4{\csname col@#1\endcsname}}%
66 }
67 \chardef\main@pdfcolorstack=0 %
68 \@ifundefined{@pdfcolorstack}
69 {\def\@pdfcolorstack{\main@pdfcolorstack}}{}
70 \def\current@color{0 g 0 G}
71 \def\set@color{%
72 \pdfcolorstack\@pdfcolorstack push{\current@color}%
73 \aftergroup\reset@color}
74 \def\reset@color{\pdfcolorstack\@pdfcolorstack pop\relax}
75 \newif\ifGPT@pagecolor
76 \begingroup\expandafter\expandafter\expandafter\endgroup
77 \expandafter\ifx\csname currentgrouplevel\endcsname\relax
78 \catcode`X=9 % ignore
79 \catcode`E=14 % comment
80 \else
81 \catcode`X=14 % comment
82 \catcode`E=9 % ignore
83 \fi
84 \def\set@page@color{%
85 \global\GPT@pagecolortrue
86 \global\let\current@page@color\current@color
87 \@ifundefined{GPT@outputbox}{%
88 % \newbox is outer in plain
89 \csname newbox\endcsname\GPT@outputbox
90 }{}%
91 \@ifundefined{GPTorg@shipout}{%
92 \global\let\GPTorg@shipout\shipout
93 \gdef\shipout{%
94 X % ensure \GPT@outputbox is really void
95 X \begingroup
96 X \setbox\GPT@outputbox=\box\GPT@outputbox
97 X \endgroup
98 E \edef\GPT@saved@grouplevel{\number\currentgrouplevel}%
99 \afterassignment\GPT@shipout
100 \global\setbox\GPT@outputbox=%
101 }%
102 \gdef\GPT@shipout{%
103 X \ifvoid\GPT@outputbox\relax
104 E \ifnum\GPT@saved@grouplevel=\currentgrouplevel
105 E \else
106 \expandafter\aftergroup
107 \fi
108 \GPT@@shipout
109 }%
110 \gdef\GPT@@shipout{%
111 \ifvoid\GPT@outputbox\relax
112 \PackageInfo{pdftex.def}{Ignoring void output box}%
113 \else
114 \setbox\GPT@outputbox=\vbox{%
115 \GPT@pageliteral
116 \box\GPT@outputbox
117 }%
118 \GPTorg@shipout\box\GPT@outputbox\relax
119 \fi
120 }%
121 \gdef\GPT@pageliteral{%
122 \ifGPT@pagecolor
123 \pdfliteral page{%
124 q % gsave
125 \current@page@color\GPT@space
126 n % newpath
127 0 0 \strip@pt\pdfpagewidth\GPT@space
128 \strip@pt\pdfpageheight\GPT@space re % rectangle
129 % there is no need to convert to bp
130 f % fill
131 Q% grestore
132 }%
133 \fi
134 }%
135 }{}%
136 }
137 \catcode`\X=11 %
138 \catcode`\E=11 %
139 \def\define@color@named#1#2{%
140 \expandafter\edef\csname col@#1\endcsname{#2}}
141 \def\no@page@color{%
142 \global\GPT@pagecolorfalse
143 }
144
145 \def\@tempa{LaTeX2e}%
146 \ifx\fmtname\@tempa
147 \expandafter\@firstofone
148 \else
149 \expandafter\@gobble
150 \fi
151 {%
152 \@ifl@t@r\fmtversion{2020/10/01}
153 {%
154 \def\set@page@color{%
155 \global\GPT@pagecolortrue
156 \global\let\current@page@color\current@color
157 \IfHookEmptyTF{shipout/background}{\AddToHook{shipout/background}{\relax}}{}%
158 }%
159 \g@addto@macro\@kernel@before@shipout@background
160 {%
161 \ifGPT@pagecolor
162 \put(-\hoffset,-\pdfpageheight+\voffset)%
163 {%
164 \pdfcolorstack\@pdfcolorstack push{\current@page@color}%
165 \aftergroup\reset@color
166 \rule{\pdfpagewidth}{\pdfpageheight}%
167 }%
168 \fi
169 }%
170 }{}%
171 }
172 \AtBeginDocument{%
173 \def\KV@Gin@bbllx{%
174 \PackageError{pdftex.def}{%
175 Options `bblly', `bblly', `bburx', `bbury',\MessageBreak
176 `natheight' and `natwidth' are not\MessageBreak
177 supported by pdftex driver:\MessageBreak
178 use `viewport' instead%
179 }\@ehc
180 }%
181 \let\KV@Gin@bblly\KV@Gin@bbllx
182 \let\KV@Gin@bburx\KV@Gin@bbllx
183 \let\KV@Gin@bbury\KV@Gin@bbllx
184 \let\KV@Gin@natwidth\KV@Gin@bbllx
185 \let\KV@Gin@natheight\KV@Gin@bbllx
186 \def\KV@Gin@bb{%
187 \PackageInfo{pdftex.def}%
188 {Option `bb' equivalent to `viewport' with the pdftex driver}%
189 \KV@Gin@viewport
190 }%
191 \let\Gin@iii\Gin@iii@vp
192 }
193
194 %%% this definition will be added to graphics.sty
195 \def\Gin@iii@vp[#1,#2][#3,#4]#5{%
196 \begingroup
197 \let\Gin@viewport@code\Gin@viewport
198 \Gin@defaultbp\Gin@vllx{#1}%
199 \Gin@defaultbp\Gin@vlly{#2}%
200 \Gin@defaultbp\Gin@vurx{#3}%
201 \Gin@defaultbp\Gin@vury{#4}%
202 \Ginclude@graphics{#5}%
203 \endgroup}
204
205
206 %%% this definition needs moving from graphicx.sty to graphics.sty
207 \def\Gin@viewport{%
208 \let\Gin@ollx\Gin@llx
209 \let\Gin@olly\Gin@lly
210 \let\Gin@ourx\Gin@urx
211 \let\Gin@oury\Gin@ury
212 \dimen@\Gin@llx\p@\advance\dimen@ \Gin@vurx\p@
213 \edef\Gin@urx{\strip@pt\dimen@}%
214 \dimen@\Gin@lly\p@\advance\dimen@ \Gin@vury\p@
215 \edef\Gin@ury{\strip@pt\dimen@}%
216 \dimen@\Gin@llx\p@\advance\dimen@ \Gin@vllx\p@
217 \edef\Gin@llx{\strip@pt\dimen@}%
218 \dimen@\Gin@lly\p@\advance\dimen@ \Gin@vlly\p@
219 \edef\Gin@lly{\strip@pt\dimen@}}
220 %%% end of temp addition
221
222
223 \def\Gread@pdftex#1{%
224 \expandafter\ifx\expandafter\relax\pdffilesize{#1}\relax
225 \expandafter\@secondoftwo
226 \else
227 \expandafter\@firstoftwo
228 \fi
229 {\Gread@@pdftex{#1}}%
230 {%
231 \def\Gin@llx{0}%
232 \let\Gin@lly\Gin@llx
233 \def\Gin@urx{72}%
234 \let\Gin@ury\Gin@urx
235 \ifGin@draft
236 \else
237 \PackageError{pdftex.def}{File `#1' not found: using draft setting}%
238 \@ehc
239 \Gin@drafttrue
240 \fi
241 }%
242 }
243 \let\Gin@attr@hash\@empty
244 \@ifundefined{Gin@decode}
245 {\let\Gin@decode\@empty}
246 {}
247 \@ifundefined{Gin@log}
248 {\let\Gin@log\wlog}
249 {}
250 \@ifundefined{Gin@page}
251 {\let\Gin@page\@empty}
252 {}
253 \def\GPT@page{\Gin@page}
254 \@ifundefined{Gin@pagebox}
255 {\def\Gin@pagebox{cropbox}}
256 {}
257 \def\GPT@cropbox{cropbox}
258 \@ifundefined{Gin@interpolate}
259 {\csname newif\endcsname\ifGin@interpolate}
260 {}
261 \newif\ifGread@transgroup
262 \def\Gread@@pdftex#1{%
263 \edef\Gin@attr@hash{%
264 \ifx\Gin@pagebox\@empty
265 \else
266 :\Gin@pagebox
267 \fi
268 \ifx\Gin@page\@empty
269 \else
270 :P\Gin@page
271 \fi
272 \ifx\Gin@decode\@empty\else
273 :D[\Gin@decode]%
274 \fi
275 \ifGin@interpolate
276 :I%
277 \fi
278 }%
279 \@ifundefined{#1 image\Gin@attr@hash}%
280 {%
281 \pdfximage
282 \ifnum0%
283 \ifx\Gin@decode\@empty\else 1\fi
284 \ifGin@interpolate 1\fi
285 \ifGread@transgroup 1\fi
286 >0 %
287 attr{%
288 \ifx\Gin@decode\@empty\else/Decode[\Gin@decode]\fi
289 \ifGread@transgroup/Group<</S/Transparency/K false/I false>>\fi
290 \ifGin@interpolate/Interpolate true\fi
291 }%
292 \fi
293 \ifx\Gin@page\@empty\else page \Gin@page\fi
294 \Gin@pagebox
295 {#1}%
296 \setbox\@tempboxa=\hbox{\pdfrefximage\pdflastximage}%
297 \def\Gin@llx{0}\let\Gin@lly\Gin@llx
298 \Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
299 \Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
300 \expandafter\xdef\csname #1 image\Gin@attr@hash\endcsname
301 {\pdfrefximage\the\pdflastximage}%
302 \expandafter\xdef\csname #1 height\Gin@attr@hash\endcsname
303 {\the\ht\@tempboxa}%
304 \expandafter\xdef\csname #1 width\Gin@attr@hash\endcsname
305 {\the\wd\@tempboxa}%
306 \Gin@log{%
307 <#1, %
308 id=\the\pdflastximage, %
309 \ifx\Gin@page\@empty\else page=\Gin@page , \fi
310 \ifx\Gin@pagebox\@empty\else\ifx\Gin@pagebox\GPT@cropbox\else
311 pagebox=\Gin@pagebox , \fi\fi
312 \ifx\Gin@decode\@empty\else decode=[\Gin@decode], \fi
313 \ifGin@interpolate interpolate=true, \fi
314 \the\wd\@tempboxa\GPT@space x \the\ht\@tempboxa
315 >%
316 }%
317 }{%
318 \def\Gin@llx{0}\let\Gin@lly\Gin@llx
319 \Gin@defaultbp\Gin@urx{\csname #1 width\Gin@attr@hash\endcsname}%
320 \Gin@defaultbp\Gin@ury{\csname #1 height\Gin@attr@hash\endcsname}%
321 }%
322 }
323 \def\Gread@png#1{%
324 \let\Gin@page\@empty
325 \let\Gin@pagebox\@empty
326 \Gread@transgroupfalse
327 \Gread@pdftex{#1}%
328 }
329 \let\Gread@jpg\Gread@png
330 \expandafter\let\csname Gread@jbig2\endcsname\Gread@png
331 \def\Gread@pdf#1{%
332 \let\Gin@decode\@empty
333 \Gin@interpolatefalse
334 \Gread@transgrouptrue
335 \Gread@pdftex{#1}%
336 }
337 \let\Gread@mps\Gread@eps
338 \def\GPT@setup@scale{%
339 \def\@tempa{!}%
340 \ifx\Gin@scaley\@tempa
341 \let\Gin@scaley\Gin@scalex
342 \else
343 \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
344 \fi
345 }
346 \def\Ginclude@pdftex#1{%
347 \GPT@setup@scale
348 \Gin@log{%
349 <use #1%
350 \ifx\Gin@page\@empty\else, page \Gin@page\fi
351 >%
352 }%
353 \PackageInfo{pdftex.def}{%
354 #1 \ifx\Gin@page\@empty\else, page\Gin@page\fi
355 \GPT@space used\on@line.\MessageBreak
356 Requested size: %
357 \the\Gin@req@width\GPT@space x \the\Gin@req@height
358 \ifx\documentclass\@undefined\else\expandafter\@gobble\fi
359 }%
360 \Ginclude@@pdftex{\@nameuse{#1 image\Gin@attr@hash}}%
361 }
362 \def\Ginclude@mps#1{%
363 \GPT@setup@scale
364 \Ginclude@@pdftex{\convertMPtoPDF{#1}{1}{1}}%
365 }
366 \def\Ginclude@@pdftex#1{%
367 \hbox{%
368 \Gscale@box{\Gin@scalex}[\Gin@scaley]{%
369 \@ifundefined{Gin@vllx}{%
370 \GPT@viewportfalse
371 % without viewport/trim clipping does not make sense
372 % for pdfTeX
373 \Gin@clipfalse
374 }{}%
375 \ifGin@clip
376 \if!\Gin@vllx\Gin@vlly\Gin@vurx\Gin@vury!%
377 \else
378 \let\GPT@clipend\GPT@DoClipEnd
379 \setbox\@tempboxa\hbox\bgroup
380 \fi
381 \fi
382 \ifGPT@viewport
383 \ifdim\Gin@vlly\p@=\z@
384 \else
385 \lower\Gin@vlly bp\hbox\bgroup
386 \fi
387 \ifdim\Gin@vllx\p@=\z@
388 \else
389 \hskip-\Gin@vllx bp\relax
390 \fi
391 \fi
392 #1%
393 \ifGPT@viewport
394 \ifdim\Gin@vlly\p@=\z@
395 \else
396 \egroup
397 \fi
398 \GPT@clipend
399 \fi
400 }%
401 }%
402 }
403 \newif\ifGPT@viewport
404 \GPT@viewporttrue
405 \let\GPT@clipend\relax
406 \def\GPT@DoClipEnd{%
407 \egroup
408 \dp\@tempboxa\z@
409 % \Gin@urx and \Gin@ury already contain the correct values,
410 % so both cases viewport and trim can be handled together:
411 \dimen@\Gin@urx\p@
412 \advance\dimen@ -\Gin@llx\p@
413 \wd\@tempboxa\strip@pt\dimen@ bp\relax
414 \dimen@\Gin@ury\p@
415 \advance\dimen@ -\Gin@lly\p@
416 \ht\@tempboxa\strip@pt\dimen@ bp\relax
417 \pdfxform\@tempboxa
418 \pdfrefxform\pdflastxform
419 }
420 \let\Ginclude@png\Ginclude@pdftex
421 \let\Ginclude@jpg\Ginclude@pdftex
422 \let\Ginclude@pdf\Ginclude@pdftex
423 \expandafter\let\csname Ginclude@jbig2\endcsname\Ginclude@pdftex
424 \def\GPT@MatrixIdentity{1 0 0 1}
425 \def\GPT@Zero{0}
426 \def\GPT@Minus{-}
427 \def\GPT@NormalizeNumber#1{%
428 \edef#1{#1}%
429 \edef#1{\expandafter\zap@space#1 \@empty}%
430 \edef#1{\expandafter\GPT@ZapPlus#1+\@nil}%
431 \edef#1{\expandafter\GPT@ZapMinusMinus#1--\@nil}%
432 \expandafter\GPT@Split#1..\@nil
433 \ifx\GPT@frac\@empty
434 \else
435 \edef\GPT@frac{%
436 \expandafter\GPT@Reverse\expandafter{\expandafter}\GPT@frac\@nil
437 }%
438 \edef\GPT@frac{%
439 \expandafter\GPT@ZapLeadingZeros\GPT@frac\@empty
440 }%
441 \ifx\GPT@frac\@empty
442 \else
443 \edef\GPT@frac{%
444 \expandafter\GPT@Reverse\expandafter{\expandafter}\GPT@frac\@nil
445 }%
446 \fi
447 \fi
448 \edef\GPT@sign{\expandafter\@car\GPT@int\@empty\@nil}%
449 \ifx\GPT@sign\GPT@Minus
450 \edef\GPT@int{\expandafter\@cdr\GPT@int\@nil}%
451 \else
452 \def\GPT@sign{}%
453 \fi
454 \edef\GPT@int{%
455 \expandafter\GPT@ZapLeadingZeros\GPT@int\@empty
456 }%
457 \edef\GPT@temp{\GPT@int\GPT@frac}%
458 \ifx\GPT@temp\@empty
459 \def#1{0}%
460 \else
461 \edef#1{%
462 \GPT@sign
463 \GPT@int
464 \ifx\GPT@frac\@empty
465 \else
466 .\GPT@frac
467 \fi
468 }%
469 \fi
470 }
471 \def\GPT@ZapPlus#1+#2\@nil{%
472 #1%
473 \ifx\@empty#2\@empty
474 \expandafter\@gobble
475 \else
476 \expandafter\@firstofone
477 \fi
478 {%
479 \GPT@ZapPlus#2\@nil
480 }%
481 }
482 \def\GPT@ZapMinusMinus#1--#2\@nil{%
483 #1%
484 \ifx\@empty#2\@empty
485 \expandafter\@gobble
486 \else
487 \expandafter\@firstofone
488 \fi
489 {%
490 \GPT@ZapMinusMinus#2\@nil
491 }%
492 }
493 \def\GPT@Split#1.#2.#3\@nil{%
494 \def\GPT@int{#1}%
495 \ifx\@empty#2\@empty
496 \let\GPT@frac\@empty
497 \else
498 \def\GPT@frac{#2}%
499 \fi
500 }
501 \def\GPT@Reverse#1#2#3\@nil{%
502 \ifx\@empty#3\@empty
503 #2#1%
504 \expandafter\@gobble
505 \else
506 \expandafter\@firstofone
507 \fi
508 {%
509 \GPT@Reverse{#2#1}#3\@nil
510 }%
511 }
512 \def\GPT@ZapLeadingZeros#1{%
513 \ifx0#1%
514 \expandafter\GPT@ZapLeadingZeros
515 \else
516 #1%
517 \fi
518 }
519 \def\Grot@start{%
520 \GPT@NormalizeNumber\Grot@sin
521 \GPT@NormalizeNumber\Grot@cos
522 \edef\GPT@temp{%
523 \Grot@cos\GPT@space\Grot@sin\GPT@space
524 \if-\Grot@sin
525 \else
526 \ifx\Grot@sin\GPT@Zero
527 \GPT@Zero
528 \else
529 -\Grot@sin
530 \fi
531 \fi
532 \GPT@space\Grot@cos
533 }%
534 \ifx\GPT@temp\GPT@MatrixIdentity
535 \def\Grot@end{}%
536 \else
537 \pdfsave
538 \pdfsetmatrix{\GPT@temp}%
539 % Slightly hacky, but set width of box 0 to 0pt otherwise
540 % the CTM gets restored in the wrong place
541 \wd\z@\z@
542 \fi
543 }
544 \def\Grot@end{\pdfrestore}
545 \def\Gscale@start{%
546 \GPT@NormalizeNumber\Gscale@x
547 \GPT@NormalizeNumber\Gscale@y
548 \edef\GPT@temp{%
549 \Gscale@x\GPT@space0 0 \Gscale@y
550 }%
551 \ifx\GPT@temp\GPT@MatrixIdentity
552 \def\Gscale@end{}%
553 \else
554 \pdfsave
555 \pdfsetmatrix{\GPT@temp}%
556 \fi
557 }
558 \def\Gscale@end{\pdfrestore}
559 \@ifundefined{ifGin@setpagesize}
560 {\expandafter\let\csname ifGin@setpagesize\expandafter\endcsname
561 \csname iftrue\endcsname}
562 {}
563 \@ifundefined{stockwidth}{\newdimen\stockwidth}{}
564 \@ifundefined{stockheight}{\newdimen\stockheight}{}
565 \ifGin@setpagesize
566 \ifx\paperwidth\@undefined\else
567 \AtBeginDocument{%
568 % If a package has changed \mag, assume it knows what it is doing
569 % and leave page size alone
570 \ifnum\mag=\@m
571 \ifdim\stockwidth>0pt\relax
572 \ifdim\stockheight>0pt\relax
573 \setlength{\pdfpagewidth}{\stockwidth}%
574 \setlength{\pdfpageheight}{\stockheight}%
575 \else
576 \ifdim\paperwidth>0pt\relax
577 \ifdim\paperheight>0pt\relax
578 \setlength{\pdfpagewidth}{\paperwidth}%
579 \setlength{\pdfpageheight}{\paperheight}%
580 \fi
581 \fi
582 \fi
583 \else
584 \ifdim\stockwidth=0pt\relax
585 \ifdim\paperwidth>0pt\relax
586 \ifdim\paperheight>0pt\relax
587 \setlength{\pdfpagewidth}{\paperwidth}%
588 \setlength{\pdfpageheight}{\paperheight}%
589 \fi
590 \fi
591 \fi
592 \fi
593 \fi
594 }
595 \fi
596 \fi
597 \def\Gin@extensions{%
598 .pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,%
599 .PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2%
600 }
601 \@namedef{Gin@[email protected]}#1{{jpg}{.jpg}{#1}}
602 \@namedef{Gin@[email protected]}#1{{jpg}{.jpeg}{#1}}
603 \@namedef{Gin@[email protected]}#1{{jpg}{.JPG}{#1}}
604 \@namedef{Gin@[email protected]}#1{{jpg}{.JPEG}{#1}}
605 \@namedef{Gin@[email protected]}#1{{jbig2}{.jb2}{#1}}%
606 \@namedef{Gin@[email protected]}#1{{jbig2}{.jbig2}{#1}}%
607 \@namedef{Gin@[email protected]}#1{{png}{.png}{#1}}
608 \@namedef{Gin@[email protected]}#1{{png}{.PNG}{#1}}
609 \@namedef{Gin@[email protected]}#1{{mps}{.mps}{#1}}
610 \@namedef{Gin@[email protected]}#1{{pdf}{.pdf}{#1}}
611 \@namedef{Gin@[email protected]}#1{{pdf}{.PDF}{#1}}
612 \@namedef{Gin@[email protected]}#1{{eps}{.eps}{#1}}
613 % MPS conversion
614 \def\GPT@LoadSuppPdf{%
615 \@ifundefined{convertMPtoPDF}{%
616 \edef\@tempa{%
617 \catcode`\noexpand\<\the\catcode`\<\relax
618 \catcode`\noexpand\>\the\catcode`\>\relax
619 \catcode`\noexpand\=\the\catcode`\=\relax
620 }%
621 \@makeother\<\@makeother\>\@makeother\=%
622 % supp-pdf.mkii tests against \undefined:
623 % just in case someone has defined it ...
624 \let\GPT@orig@undefined\undefined
625 \let\undefined\@undefined
626 \InputIfFileExists{supp-pdf.mkii}{}{}%
627 \let\undefined\GPT@orig@undefined
628 \@tempa
629 }{%
630 % supp-pdf is probably already loaded.
631 }%
632 % If supp-pdf is not available, \convertMPtoPDF generates
633 % an error message. \providecommand inside the third argument
634 % of \InputIfFileExists will not work:
635 % * \InputIfFileExists has problems with parameters (#1).
636 % * Implementation of \providecommand is insufficient in miniltx.tex
637 \@ifundefined{convertMPtoPDF}{%
638 % 2016/05/21 v0.01c use \newcommand here not \newcommand* graphics/4472
639 \newcommand{\convertMPtoPDF}[3]{%
640 \PackageError{pdftex.def}{%
641 Cannot convert ##1 from MPS to PDF.
642 The support file `supp-pdf.mkii' (supp-pdf.tex) is missing%
643 }{%
644 The graphics driver for pdfTeX needs `supp-pdf.mkii'
645 (or `supp-pdf.tex' and/or `supp-mis.tex')
646 to convert MetaPost output files to PDF.
647 These files are part of ConTeXt and can also be found here:%
648 \GPT@space\GPT@space CTAN:macros/pdftex/graphics/.
649 You'll get more errors if you'll continue now.%
650 }%
651 }%
652 }{}%
653 \let\GPT@LoadSuppPdf\relax
654 }
655 \AtBeginDocument{%
656 \GPT@LoadSuppPdf
657 }
658 % Load package epstopdf if
659 % a) LaTeX is running (plain TeX users are on their own),
660 % b) and \DoNotLoadEpstopdf either does not exist or is not \relax,
661 % c) and neither pst-pdf nor pdftricks is loaded (by \begin{document}).
662 %
663 % In other words, by default .eps files will be automatically
664 % converted to .pdf files when outputting pdf. This can be wrong!
665 % If the .pdf is the source, rather than the .eps, you should put
666 % \newcommand{\DoNotLoadEpstopdf}{}
667 % before even the \documentclass line of your document.
668 %
669 % Earlier versions did not load epstopdf if shell escape was disabled.
670 % Now load, for better error reporting and to allow inclusion of pre-existing
671 % converted files: see gh/38
672 %
673 % More information about the epstopdf run will be in the .log file;
674 % see http://ctan.org/pkg/epstopdf-pkg for more info about the
675 % epstopdf package itself. In turn, it calls the epstopdf script
676 % (http://ctan.org/pkg/epstopdf).
677 %
678 % For the first discussion and background on this, see the thread on latex-l:
679 % http://thread.gmane.org/gmane.comp.tex.latex.latex3/1465
680 %
681 \begingroup\expandafter\expandafter\expandafter\endgroup
682 \expandafter\ifx\csname DoNotLoadEpstopdf\endcsname\relax
683 \begingroup\expandafter\expandafter\expandafter\endgroup
684 \expandafter\ifx\csname AtEndOfPackage\endcsname\relax
685 \else
686 \AtEndOfPackage{%
687 \AtBeginDocument{%
688 \ifx\includegraphics\@undefined\else
689 \@ifpackageloaded{pst-pdf}{}{%
690 \@ifpackageloaded{pdftricks}{}{%
691 \@ifpackageloaded{graphics}{%
692 \edef\Gin@extensions{\Gin@extensions,.eps}%
693 \RequirePackage{epstopdf-base}[2009/07/12]%
694 }{}
695 }% pdftricks not loaded
696 }% pst-pdf not loaded
697 \fi
698 }% AtBeginDocument block
699 }% AtEndofPackage block
700 \fi % AtEndofPackage not defined
701 \fi % DoNotLoadEpstopdf not defined
702 \endinput