Debian Codegraph @

texmf-dist/source/latex/pict2e/p2e-drivers.dtx

raw
1 % \iffalse meta-comment
2 %
3 % p2e-drivers.dtx
4 %
5 %
6 % Copyright (C) 2003-2016
7 % Rolf Niepraschk, [email protected]
8 % Hubert Gaesslein, [email protected]
9 % Josef Tkadlec, [email protected]
10 %
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either version 1.3
14 % of this license or (at your option) any later version.
15 % The latest version of this license is in
16 % http://www.latex-project.org/lppl.txt
17 % and version 1.3 or later is part of all distributions of LaTeX
18 % version 2003/12/01 or later.
19 %
20 % This work has the LPPL maintenance status "author-maintained".
21 %
22 % This work consists of all files listed in manifest.txt.
23 %
24 %
25 % This file is part of the New Implementation of the Standard LaTeX
26 % picture commands (package pict2e). It complements the file
27 % drivers.dtx from the Standard LaTeX `Graphics Bundle'.
28 %
29 %
30 %<template, >\ProvidesFile{p2e-template.def}
31 %<dvips, >\ProvidesFile{p2e-dvips.def}
32 %<xdvi, >\ProvidesFile{p2e-xdvi.def}
33 %<pdftex, >\ProvidesFile{p2e-pdftex.def}
34 %<luatex, >\ProvidesFile{p2e-luatex.def}
35 %<vtex, >\ProvidesFile{p2e-vtex.def}
36 %<dvipdfm, >\ProvidesFile{p2e-dvipdfm.def}
37 %<dvipdfmx, >\ProvidesFile{p2e-dvipdfmx.def}
38 %<xetex, >\ProvidesFile{p2e-xetex.def}
39 %<textures, >\ProvidesFile{p2e-textures.def}
40 %<pctexps, >\ProvidesFile{p2e-pctexps.def}
41 %<pctex32, >\ProvidesFile{p2e-pctex32.def}
42 %
43 %<*driver>
44 \NeedsTeXFormat{LaTeX2e}
45 \ProvidesFile{p2e-drivers.dtx}
46 %</driver>
47 %
48 %<cfg>\ProvidesFile{pict2e.cfg}%
49 [2016/02/05 v0.1u
50 %<*!cfg>
51 Driver-dependant file (RN,HjG,JT)]
52 %</!cfg>
53 %<cfg> pict2e configuration for teTeX/TeXLive]
54 %
55 %<*driver>
56 \documentclass{ltxdoc}
57 \GetFileInfo{p2e-drivers.dtx}
58 \def\docdate{2016/02/05}
59 \begin{document}
60 \title{Graphics drivers for \textsf{pict2e}\thanks
61 {This document corresponds to \textsf{\filename} \fileversion,
62 dated \filedate, documentation dated \docdate.}}
63 \author{Rolf Niepraschk\thanks{\texttt{[email protected]}},
64 Hubert G\"a{\ss}lein,%\thanks{\texttt{[email protected]}}
65 \,and Josef Tkadlec\thanks{\texttt{[email protected]}}}
66 \date{\filedate}
67 % \maketitle
68 \DocInput{p2e-drivers.dtx}
69 \end{document}
70 %</driver>
71 % \fi
72 %
73 % \CheckSum{166}
74 %
75 % \changes{v0.1g}{2003/11/07}{Translated documentation to English (HjG)}
76 % \changes{v0.1g}{2003/11/07}{Added driver \texttt{dvipdfm} (RN)}
77 % \changes{v0.1h}{2003/11/12}{Move check for \texttt{ver@\backslash Gin@driver}
78 % to package pict2e (RN,HjG)}
79 % \changes{v0.1h}{2003/11/12}{General cleaning (RN,HjG)}
80 % \changes{v0.1h}{2003/11/12}{More general cleaning (HjG)}
81 % \changes{v0.1i}{2003/11/22}{M-x delete-trailing-whitespace (HjG)}
82 % \changes{v0.1j}{2003/12/13}{Resurrect reference to latexbugs address (HjG)}
83 % \changes{v0.1j}{2003/12/13}{Try new driver for \textsf{xdvi}---to no avail (HjG)}
84 % \changes{v0.1k}{2003/12/18}{Polish up documentation (HjG)}
85 % \changes{v0.1l}{2003/12/19}{Some tentative entries for new drivers (HjG)}
86 % \changes{v0.1l}{2003/12/19}{Polish up documentation (HjG)}
87 % \changes{v0.1m}{2003/12/21}{Polish up documentation (HjG)}
88 % \changes{v0.1o}{2004/02/19}{Fix some typos (HjG)}
89 % \changes{v0.1p}{2004/03/26}{Minor changes to documentation (HjG)}
90 % \changes{v0.1q}{2004/04/22}{Added lppl (RN/HjG)}
91 % \changes{v0.1r}{2004/06/25}{Small fixes in documentation (HjG)}
92 % \changes{v0.1s}{2009/08/05}{Support for xetex added (JT)}
93 % \changes{v0.1t}{2011/04/05}{Support for dvipdfmx added (JT)}
94 % \changes{v0.1u}{2016/02/05}{Support for luatex >0.85
95 % (suggested by David Carlisle) added (RN)}
96 %
97 % \newcommand*\PS{PostScript}
98 % \newcommand*\PDF{PDF}
99 % \newcommand*\teTeX{te\kern-.11em\TeX}
100 % \newcommand*\TeXlive{\TeX live}
101 %
102 % \makeatletter
103 % \@ifundefined{ifdeveloping}{\newif\ifdeveloping}{} ^^A false by default
104 % \makeatother
105 %
106 % \ifdeveloping
107 % \makeatletter
108 %
109 % \newcommand*\isodattim{}
110 % \begingroup
111 % \count@\time
112 % \divide\count@ 60
113 % \count2=-\count@
114 % \multiply\count2 60
115 % \advance\count2 \time
116 % \xdef\isodattim{^^A
117 % \the\year-\two@digits{\the\month}-\two@digits{\the\day}^^A
118 % ~\two@digits{\the\count@}:\two@digits{\the\count2}}
119 % \endgroup
120 %
121 % \newcommand*\ps@myfootings{^^A cf. \ps@plain
122 % \let\@mkboth\@gobbletwo
123 % \let\@oddhead\@empty
124 % \let\@evenhead\@empty
125 % \def\@oddfoot{\reset@font
126 % \rlap{\textsf{\filename}~\fileversion~\filedate}^^A
127 % \hfil\thepage\hfil
128 % \llap{\TeX ed \texttt{\isodattim}}}^^A
129 % \def\@evenfoot{\reset@font
130 % \rlap{\TeX ed \texttt{\isodattim}}^^A
131 % \hfil\thepage\hfil
132 % \llap{\filedate~\fileversion~\textsf{\filename}}}^^A
133 % }
134 % \pagestyle{myfootings}
135 % \let\pagestyle\@gobble
136 % \let\thispagestyle\@gobble
137 %
138 % \makeatother
139 % \else
140 % \makeatletter
141 % ^^A \ifdim\overfullrule>\z@\else\let\ps@myfootings\ps@plain\fi
142 % \makeatother
143 % \fi
144 %
145 %
146 % \maketitle
147 %
148 %
149 % \section{Driver files}
150 %
151 % This file implements some of the currently supported drivers for
152 % the new version of the \textsf{pict2e} package.
153 % If the driver you use is not in this list then a `\texttt{.def}'
154 % file may be distributed with the pict2e package,
155 % or may be distributed with the standard \LaTeX\ graphics bundle,
156 % or may be distributed with your driver.
157 %
158 % If not, send us some details of the driver's |\special| syntax, and
159 % we will try to produce a suitable file.
160 %
161 % Note that some of these files are for graphics drivers to which we
162 % have no access, so they are untested.
163 % Please send any corrections to the latexbugs address or directly to
164 % the authors.
165 %
166 % \StopEventually{}
167 %
168 % \subsection{Template}
169 %
170 % A template for a \textsf{pict2e} driver file.
171 %
172 % \begin{macro}{\pIIe@mode}
173 % This macro serves as an indicator to the \textsf{pict2e} package
174 % which mode the driver supports:
175 %
176 % \smallskip
177 % \begin{tabular}{rl}
178 % $-1$ & inapt\slash incapable (default,
179 % already set in \textsf{pict2e}) \\
180 % $0$ & standard \LaTeX\ only \\
181 % $1$ & \PS \\
182 % $2$ & \PDF \\
183 % & (other values are reserved for future use)
184 % \end{tabular}
185 % \smallskip
186 %
187 % \noindent
188 % Incapable drivers should not alter the default value given by the
189 % \textsf{pict2e} package, or set it explicitly to $-1$.
190 % ^^A (Or set it to $0$ to request standard \LaTeX\ mode.)
191 % \begin{macrocode}
192 %<*template>
193 \def\pIIe@mode{-1}
194 % \end{macrocode}
195 % \end{macro}
196 %
197 % \begin{macro}{\pIIe@code}
198 % The \textsf{pict2e} package expects the driver file to define the
199 % \cmd{\pIIe@code} command in a suitable way.
200 %
201 % This command should locally establish the standard \PS\slash\PDF\
202 % coordinate system
203 % (i.e., a cartesian coordinate system
204 % with positive x-axis pointing right
205 % and positive y-axis pointing up,
206 % and with unit $1\,\mathrm{bp} = 1/72\,\mathrm{in}$),
207 % albeit with the origin at \TeX's current point instead of the lower
208 % left corner of the page.
209 %
210 % Furthermore, it should save and restore the graphics state
211 % (|gsave|\slash|grestore| in \PS, |q|\slash|Q| in \PDF.)
212 % This may be achieved by using appropriate \cmd{\special} (or
213 % \cmd{\pdfliteral}, respectively) commands.
214 %
215 % Moreover, this command should preserve (i.e., it should not change)
216 % the current colour as defined by the user via the commands of the
217 % \textsf{color} package from the graphics bundle.
218 %
219 % Thus, the \cmd{\Gin@PS@restored} command that various
220 % \meta{driver}|.def| files from the graphics bundle provide should
221 % usually come close to what is expected here.
222 % \begin{macrocode}
223 \def\pIIe@code#1{}
224 %</template>
225 % \end{macrocode}
226 % \end{macro}
227 %
228 %
229 % \subsection{dvips}
230 %
231 % A \textsf{pict2e} driver file for the \textsf{dvips} driver.
232 %
233 % \begin{macro}{\pIIe@mode}
234 % We are about to generate \PS\ code.
235 % \begin{macrocode}
236 %<*dvips>
237 \def\pIIe@mode{1}
238 % \end{macrocode}
239 % \end{macro}
240 %
241 % \begin{macro}{\pIIe@code}
242 % In this case the code inserted by the driver on behalf of the
243 % \cmd{\Gin@PS@restored} command performs a ``|0| |setgray|''
244 % operation, thus resetting any colour the user might have set by
245 % means of the \textsf{color} package.
246 % \ (See also \LaTeX\ problem report graphics/3569.) \ ^^A
247 % We therefore have to resort to the following kludge:
248 % As long as we output only simple picture objects, our operations are
249 % ``atomic.''
250 % Hence, we won't need to set colours or gray shades within the \PS\
251 % code generated by \textsf{pict2e};
252 % thus the offending |setgray| operator may as well be a no-op.
253 % To keep this redefinition local, we enclose the call to
254 % \cmd{\Gin@PS@restored} by a |save|\slash|restore| pair.
255 % \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored}
256 % (prevent resetting current color to black). (HjG,RN)}
257 % \begin{macrocode}
258 \def\pIIe@code#1{%
259 \Gin@PS@raw{save /setgray { pop } def}%
260 \Gin@PS@restored{#1}%
261 \Gin@PS@raw{restore}%
262 }
263 %</dvips>
264 % \end{macrocode}
265 % \end{macro}
266 %
267 %
268 % \subsection{pdfTeX}
269 %
270 % A \textsf{pict2e} driver file for the \textsf{pdftex} driver.
271 %
272 % \begin{macro}{\pIIe@mode}
273 % We are about to generate \PDF\ code.
274 % (Only, if pdf\TeX\ is actually generating \PDF;
275 % otherwise nothing will be output.)
276 % \begin{macrocode}
277 %<*pdftex>
278 \begingroup
279 \@ifundefined{pdfoutput}{}{%
280 \ifnum\pdfoutput>0\relax
281 \gdef\pIIe@mode{2}
282 \fi
283 }
284 \endgroup
285 % \end{macrocode}
286 % \end{macro}
287 %
288 % \begin{macro}{\pIIe@code}
289 % The save\slash restore operators are necessary here to prevent the
290 % change of the CTM (scaling and rotation operations) that
291 % \textsf{pict2e} inserts from propagating.
292 % \begin{macrocode}
293 \ifcase\pIIe@mode\relax \or\or
294 \def\pIIe@code#1{\pdfliteral{ q #1 Q }}
295 \fi
296 %</pdftex>
297 % \end{macrocode}
298 % \end{macro}
299 %
300 %
301 % \subsection{Lua\TeX}
302 %
303 % A \textsf{pict2e} driver file for the \textsf{luatex} driver.
304 %
305 % \begin{macro}{\pIIe@mode}
306 % We are about to generate \PDF\ code.
307 % (Only, if Lua\TeX\ is actually generating \PDF;
308 % otherwise nothing will be output.)
309 % \begin{macrocode}
310 %<*luatex>
311 \begingroup
312 \ifnum\outputmode>0\relax
313 \gdef\pIIe@mode{2}
314 \fi
315 \endgroup
316 % \end{macrocode}
317 % \end{macro}
318 %
319 % \begin{macro}{\pIIe@code}
320 % The save\slash restore operators are necessary here to prevent the
321 % change of the CTM (scaling and rotation operations) that
322 % \textsf{pict2e} inserts from propagating.
323 % \begin{macrocode}
324 \ifcase\pIIe@mode\relax \or\or
325 \def\pIIe@code#1{\pdfextension literal{ q #1 Q }}
326 \protected\edef\pIIe@pdfliteral{\pdfextension literal}
327 \fi
328 %</luatex>
329 % \end{macrocode}
330 % \end{macro}
331 %
332 %
333 % \subsection{V\TeX}
334 %
335 % A \textsf{pict2e} driver file for the \textsf{vtex} driver.
336 %
337 % \begin{macro}{\pIIe@mode}
338 % With \textsf{V\TeX}, we should use \PS\ code also for \PDF\ mode
339 % (Email from Michael Vulis, MicroPress).
340 % \begin{macrocode}
341 %<*vtex>
342 \begingroup
343 \@ifundefined{VTeXversion}{}{%
344 \ifnum\OpMode>0\relax
345 \ifnum\OpMode<3\relax
346 \gdef\pIIe@mode{1}%
347 \fi
348 \fi
349 }
350 \endgroup
351 % \end{macrocode}
352 % \end{macro}
353 %
354 % \begin{macro}{\pIIe@code}
355 % Here |\Gin@PS@restored| suffices as provided by the graphics driver
356 % file |vtex.def|.
357 % \begin{macrocode}
358 \ifcase\pIIe@mode\relax \or
359 \let\pIIe@code\Gin@PS@restored
360 \fi
361 %</vtex>
362 % \end{macrocode}
363 % \end{macro}
364 %
365 %
366 % \subsection{dvipdfm}
367 %
368 % A \textsf{pict2e} driver file for the \textsf{dvipdfm} driver.
369 %
370 % \begin{macro}{\pIIe@mode}
371 % We are about to generate \PDF\ code.
372 % \begin{macrocode}
373 %<*dvipdfm>
374 \def\pIIe@mode{2}
375 % \end{macrocode}
376 % \end{macro}
377 %
378 % \begin{macro}{\pIIe@code}
379 % This seems to be sufficient.
380 % \begin{macrocode}
381 \def\pIIe@code#1{\special{pdf: content #1}}
382 %</dvipdfm>
383 % \end{macrocode}
384 % \end{macro}
385 %
386 %
387 % \subsection{dvipdfmx}
388 %
389 % A \textsf{pict2e} driver file for the \textsf{dvipdfmx} driver.
390 %
391 % \begin{macro}{\pIIe@mode}
392 % We are about to generate \PDF\ code.
393 % \begin{macrocode}
394 %<*dvipdfmx>
395 \def\pIIe@mode{2}
396 % \end{macrocode}
397 % \end{macro}
398 %
399 % \begin{macro}{\pIIe@code}
400 % \begin{macrocode}
401 \def\pIIe@code#1{\special{pdf: content #1}}
402 % \end{macrocode}
403 % \end{macro}
404 %
405 % \begin{macro}{\pIIe@pdfliteral}
406 % \begin{macrocode}
407 \def\pIIe@pdfliteral#1{\special{pdf: literal #1}}
408 %</dvipdfmx>
409 % \end{macrocode}
410 % \end{macro}
411 %
412 %\iffalse
413 % \subsection{xdvi}
414 %
415 % A \textsf{pict2e} driver file for the \textsf{xdvi} driver.
416 %
417 % \begin{macro}{\pIIe@mode}
418 % We are about to generate \PS\ code.
419 % \begin{macrocode}
420 %<*xdvi>
421 \def\pIIe@mode{1}
422 % \end{macrocode}
423 % \end{macro}
424 %
425 % \begin{macro}{\pIIe@code}
426 % As long as our operations are ``atomic,'' we won't need to set
427 % colours or gray shades within our code, hence the offending
428 % \verb+setgray+ operator may as well be a no-op.
429 % See also \LaTeX\ problem report graphics/3569.
430 % \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored}
431 % (prevent resetting current color to black). (HjG,RN)}
432 % \begin{macrocode}
433 \def\pIIe@code#1{%
434 % \Gin@PS@raw{save /setgray { pop } def}%
435 \Gin@PS@restored{#1}%
436 % \Gin@PS@raw{restore}%
437 }
438 %</xdvi>
439 % \end{macrocode}
440 % \end{macro}
441 %\fi
442 %
443 %
444 % \subsection{xetex}
445 %
446 % A \textsf{pict2e} driver file for the \textsf{xetex} driver.
447 % \begin{macro}{\pIIe@mode}
448 % We are about to generate \PDF\ code.
449 % \begin{macrocode}
450 %<*xetex>
451 \def\pIIe@mode{2}
452 % \end{macrocode}
453 % \end{macro}
454 %
455 % \begin{macro}{\pIIe@code}
456 % \begin{macrocode}
457 \def\pIIe@code#1{\special{pdf: literal q #1 Q}}
458 % \end{macrocode}
459 % \end{macro}
460 %
461 % \begin{macro}{\pIIe@pdfliteral}
462 % \begin{macrocode}
463 \def\pIIe@pdfliteral#1{\special{pdf: literal #1}}
464 %</xetex>
465 % \end{macrocode}
466 % \end{macro}
467 %
468 % \subsection{dvipdf}
469 %
470 % A \textsf{pict2e} driver file for the \textsf{dvipdf} driver
471 % (not yet implemented).
472 %
473 % \begin{macro}{\pIIe@mode}
474 % \begin{macrocode}
475 %<*dvipdf>
476 %\def\pIIe@mode{-1}
477 % \end{macrocode}
478 % \end{macro}
479 %
480 % \begin{macro}{\pIIe@code}
481 % This is the same as the definition for |\Gin@PS@restored|
482 % in |dvipdf.def| as defined in |drivers.dtx|!
483 % Better use the higher-level macro instead of the |\special|?
484 % \begin{macrocode}
485 %\def\pIIe@code#1{\special{" #1}} % \Gin@PS@restored{#1}
486 %</dvipdf>
487 % \end{macrocode}
488 % \end{macro}
489 %
490 %
491 % \subsection{textures}
492 %
493 % A \textsf{pict2e} driver file for the \textsf{textures} driver
494 % (not yet implemented).
495 %
496 % \begin{macro}{\pIIe@mode}
497 % \begin{macrocode}
498 %<*textures>
499 % \def\pIIe@mode{-1}
500 % \end{macrocode}
501 % \end{macro}
502 %
503 % \begin{macro}{\pIIe@code}
504 % \begin{macrocode}
505 % \def\pIIe@code#1{}
506 %</textures>
507 % \end{macrocode}
508 % \end{macro}
509 %
510 %
511 % \subsection{dvipsone}
512 %
513 % A \textsf{pict2e} driver file for the \textsf{dvipsone} driver
514 % (not yet implemented).
515 %
516 % \begin{macro}{\pIIe@mode}
517 % \begin{macrocode}
518 %<*dvipsone>
519 % \def\pIIe@mode{-1}
520 % \end{macrocode}
521 % \end{macro}
522 %
523 % \begin{macro}{\pIIe@code}
524 % \begin{macrocode}
525 % \def\pIIe@code#1{}
526 %</dvipsone>
527 % \end{macrocode}
528 % \end{macro}
529 %
530 %
531 % \subsection{pctexps}
532 %
533 % A \textsf{pict2e} driver file for the \textsf{pctexps} driver
534 % (not yet implemented).
535 %
536 % \begin{macro}{\pIIe@mode}
537 % \begin{macrocode}
538 %<*pctexps>
539 % \def\pIIe@mode{-1}
540 % \end{macrocode}
541 % \end{macro}
542 %
543 % \begin{macro}{\pIIe@code}
544 % \begin{macrocode}
545 % \def\pIIe@code#1{}
546 %</pctexps>
547 % \end{macrocode}
548 % \end{macro}
549 %
550 %
551 % \subsection{pctex32}
552 %
553 % A \textsf{pict2e} driver file for the \textsf{pctex32} driver
554 % (not yet implemented).
555 %
556 % \begin{macro}{\pIIe@mode}
557 % \begin{macrocode}
558 %<*pctex32>
559 % \def\pIIe@mode{-1}
560 % \end{macrocode}
561 % \end{macro}
562 %
563 % \begin{macro}{\pIIe@code}
564 % \begin{macrocode}
565 % \def\pIIe@code#1{}
566 %</pctex32>
567 % \end{macrocode}
568 % \end{macro}
569 %
570 %
571 % \section{A Sample Configuration File}
572 %
573 % ^^A Preamble?
574 %
575 % This one is taken from |color.cfg| of the
576 % \teTeX\slash\TeXlive\ distributions.
577 % \begin{macrocode}
578 %<*cfg>
579 %% Select an appropriate default driver.
580 \begingroup
581 \chardef\x=0 %
582 % check luatex
583 \ifx\luatexversion\@undefined
584 % check pdfTeX
585 \@ifundefined{pdfoutput}{}{%
586 \ifcase\pdfoutput
587 \else
588 \chardef\x=1 %
589 \fi
590 }%
591 % check VTeX
592 \@ifundefined{OpMode}{}{%
593 \chardef\x=2 %
594 }%
595 % check XeTeX
596 \@ifundefined{XeTeXrevision}{}{%
597 \chardef\x=3 %
598 }%
599 \else
600 \ifnum\luatexversion>85
601 \ifnum\outputmode>0
602 \chardef\x=4\relax
603 \fi
604 \else
605 \ifnum\pdfoutput>0
606 \chardef\x=1\relax
607 \fi
608 \fi
609 \fi
610 \expandafter\endgroup
611 \ifcase\x
612 % 0: default case
613 \ExecuteOptions{dvips}%
614 \or
615 % 1: pdfTeX is running in pdf mode
616 \ExecuteOptions{pdftex}%
617 \or
618 % 2: VTeX is running
619 \ExecuteOptions{vtex}%
620 \or
621 % 3: XeTeX is running
622 \ExecuteOptions{xetex}%
623 \or
624 % 4: LuaTeX (> 0.85) is running
625 \ExecuteOptions{luatex}%
626 \fi
627 % \end{macrocode}
628 % You can also specify other options to the \textsf{pict2e} package in
629 % the configuration file.
630 % For example, if you prefer PSTricks-like arrows, just uncomment the
631 % line below.
632 % \begin{macrocode}
633 %% \ExecuteOptions{pstarrows}
634 %</cfg>
635 % \end{macrocode}
636 %
637 % \Finale
638 \endinput