Debian Codegraph @

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

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