summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/pict2e/p2e-drivers.dtx
blob: 13b716b4a2cb71743d48d6824d8068da19cb127f (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
% \iffalse meta-comment
%
% p2e-drivers.dtx
% Time-stamp: "p2e-drivers.dtx 2004-06-25 08:23:34 CEST Friday hubertjg"
%
%
% Copyright (C) 2003, 2004
% Rolf Niepraschk, Rolf.Niepraschk@ptb.de
% Hubert Gaesslein, HubertJG@open.mind.de
%
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%
% This work consists of all files listed in manifest.txt.
%
%
% This file is part of the New Implementation of the Standard LaTeX
% picture commands (package pict2e). It complements the file
% drivers.dtx from the Standard LaTeX `Graphics Bundle'.
%
%
%<template, >\ProvidesFile{p2e-template.def}
%<dvips,    >\ProvidesFile{p2e-dvips.def}
%<xdvi,     >\ProvidesFile{p2e-xdvi.def}
%<pdftex,   >\ProvidesFile{p2e-pdftex.def}
%<vtex,     >\ProvidesFile{p2e-vtex.def}
%<dvipdfm,  >\ProvidesFile{p2e-dvipdfm.def}
%<textures, >\ProvidesFile{p2e-textures.def}
%<pctexps,  >\ProvidesFile{p2e-pctexps.def}
%<pctex32,  >\ProvidesFile{p2e-pctex32.def}
%
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{p2e-drivers.dtx}
%</driver>
%
%<cfg>\ProvidesFile{pict2e.cfg}%
        [2004/06/25 v0.1r
%<*!cfg>
                          Driver-dependant file (RN,HjG)]
%</!cfg>
%<cfg>                          pict2e configuration for teTeX/TeXLive]
%
%<*driver>
\documentclass{ltxdoc}
  \GetFileInfo{p2e-drivers.dtx}
  \def\docdate{2004/06/25}
\begin{document}
  \title{Graphics drivers for \textsf{pict2e}\thanks
    {This document corresponds to \textsf{\filename} \fileversion,
     dated \filedate, documentation dated \docdate.}}
  \author{Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@ptb.de}}
     \,and Hubert G\"a{\ss}lein\thanks{\texttt{HubertJG@open.mind.de}}}
  \date{\filedate}
 % \maketitle
  \DocInput{p2e-drivers.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{101}
%
% \changes{v0.1g}{2003/11/07}{Translated documentation to English (HjG)}
% \changes{v0.1g}{2003/11/07}{Added driver \texttt{dvipdfm} (RN)}
% \changes{v0.1h}{2003/11/12}{Move check for \texttt{ver@\backslash Gin@driver}
%   to package pict2e (RN,HjG)}
% \changes{v0.1h}{2003/11/12}{General cleaning (RN,HjG)}
% \changes{v0.1h}{2003/11/12}{More general cleaning (HjG)}
% \changes{v0.1i}{2003/11/22}{M-x delete-trailing-whitespace (HjG)}
% \changes{v0.1j}{2003/12/13}{Resurrect reference to latexbugs address (HjG)}
% \changes{v0.1j}{2003/12/13}{Try new driver for \textsf{xdvi}---to no avail (HjG)}
% \changes{v0.1k}{2003/12/18}{Polish up documentation (HjG)}
% \changes{v0.1l}{2003/12/19}{Some tentative entries for new drivers (HjG)}
% \changes{v0.1l}{2003/12/19}{Polish up documentation (HjG)}
% \changes{v0.1m}{2003/12/21}{Polish up documentation (HjG)}
% \changes{v0.1o}{2004/02/19}{Fix some typos (HjG)}
% \changes{v0.1p}{2004/03/26}{Minor changes to documentation (HjG)}
% \changes{v0.1q}{2004/04/22}{Added lppl (RN/HjG)}
% \changes{v0.1r}{2004/06/25}{Small fixes in documentation (HjG)}
%
% \newcommand*\PS{PostScript}
% \newcommand*\PDF{PDF}
% \newcommand*\teTeX{te\kern-.11em\TeX}
% \newcommand*\TeXlive{\TeX live}
%
% \makeatletter
% \@ifundefined{ifdeveloping}{\newif\ifdeveloping}{} ^^A false by default
% \makeatother
%
% \ifdeveloping
%   \makeatletter
%
%   \newcommand*\isodattim{}
%   \begingroup
%     \count@\time
%     \divide\count@ 60
%     \count2=-\count@
%     \multiply\count2 60
%     \advance\count2 \time
%     \xdef\isodattim{^^A
%       \the\year-\two@digits{\the\month}-\two@digits{\the\day}^^A
%       ~\two@digits{\the\count@}:\two@digits{\the\count2}}
%   \endgroup
%
%   \newcommand*\ps@myfootings{^^A cf. \ps@plain
%     \let\@mkboth\@gobbletwo
%     \let\@oddhead\@empty
%     \let\@evenhead\@empty
%     \def\@oddfoot{\reset@font
%       \rlap{\textsf{\filename}~\fileversion~\filedate}^^A
%       \hfil\thepage\hfil
%       \llap{\TeX ed \texttt{\isodattim}}}^^A
%     \def\@evenfoot{\reset@font
%       \rlap{\TeX ed \texttt{\isodattim}}^^A
%       \hfil\thepage\hfil
%       \llap{\filedate~\fileversion~\textsf{\filename}}}^^A
%   }
%   \pagestyle{myfootings}
%   \let\pagestyle\@gobble
%   \let\thispagestyle\@gobble
%
%   \makeatother
% \else
%   \makeatletter
% ^^A   \ifdim\overfullrule>\z@\else\let\ps@myfootings\ps@plain\fi
%   \makeatother
% \fi
%
%
% \maketitle
%
%
% \section{Driver files}
%
% This file implements some of the currently supported drivers for
% the new version of the \textsf{pict2e} package.
% If the driver you use is not in this list then a `\texttt{.def}'
% file may be distributed with the pict2e package,
% or may be distributed with the standard \LaTeX\ graphics bundle,
% or may be distributed with your driver.
%
% If not, send us some details of the driver's |\special| syntax, and
% we will try to produce a suitable file.
%
% Note that some of these files are for graphics drivers to which we
% have no access, so they are untested.
% Please send any corrections to the latexbugs address or directly to
% the authors.
%
% \StopEventually{}
%
% \subsection{Template}
%
% A template for a \textsf{pict2e} driver file.
%
% \begin{macro}{\pIIe@mode}
% This macro serves as an indicator to the \textsf{pict2e} package
% which mode the driver supports:
%
% \smallskip
% \begin{tabular}{rl}
% $-1$ & inapt\slash incapable (default,
%        already set in \textsf{pict2e}) \\
% $0$  & standard \LaTeX\ only           \\
% $1$  & \PS                             \\
% $2$  & \PDF                            \\
%      & (other values are reserved for future use)
% \end{tabular}
% \smallskip
%
% \noindent
% Incapable drivers should not alter the default value given by the
% \textsf{pict2e} package, or set it explicitly to $-1$.
% ^^A (Or set it to $0$ to request standard \LaTeX\ mode.)
%    \begin{macrocode}
%<*template>
\def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% The \textsf{pict2e} package expects the driver file to define the
% \cmd{\pIIe@code} command in a suitable way.
%
% This command should locally establish the standard \PS\slash\PDF\
% coordinate system
% (i.e., a cartesian coordinate system
% with positive x-axis pointing right
% and positive y-axis pointing up,
% and with unit $1\,\mathrm{bp} = 1/72\,\mathrm{in}$),
% albeit with the origin at \TeX's current point instead of the lower
% left corner of the page.
%
% Furthermore, it should save and restore the graphics state
% (|gsave|\slash|grestore| in \PS, |q|\slash|Q| in \PDF.)
% This may be achieved by using appropriate \cmd{\special} (or
% \cmd{\pdfliteral}, respectively) commands.
%
% Moreover, this command should preserve (i.e., it should not change)
% the current colour as defined by the user via the commands of the
% \textsf{color} package from the graphics bundle.
%
% Thus, the \cmd{\Gin@PS@restored} command that various
% \meta{driver}|.def| files from the graphics bundle provide should
% usually come close to what is expected here.
%    \begin{macrocode}
\def\pIIe@code#1{}
%</template>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{dvips}
%
% A \textsf{pict2e} driver file for the \textsf{dvips} driver.
%
% \begin{macro}{\pIIe@mode}
% We are about to generate \PS\ code.
%    \begin{macrocode}
%<*dvips>
\def\pIIe@mode{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% In this case the code inserted by the driver on behalf of the
% \cmd{\Gin@PS@restored} command performs a ``|0| |setgray|''
% operation, thus resetting any colour the user might have set by
% means of the \textsf{color} package.
% \ (See also \LaTeX\ problem report graphics/3569.) \ ^^A
% We therefore have to resort to the following kludge:
% As long as we output only simple picture objects, our operations are
% ``atomic.''
% Hence, we won't need to set colours or gray shades within the \PS\
% code generated by \textsf{pict2e};
% thus the offending |setgray| operator may as well be a no-op.
% To keep this redefinition local, we enclose the call to
% \cmd{\Gin@PS@restored} by a |save|\slash|restore| pair.
% \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored}
%    (prevent resetting current color to black). (HjG,RN)}
%    \begin{macrocode}
\def\pIIe@code#1{%
  \Gin@PS@raw{save /setgray { pop } def}%
  \Gin@PS@restored{#1}%
  \Gin@PS@raw{restore}%
}
%</dvips>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{pdftex}
%
% A \textsf{pict2e} driver file for the \textsf{pdftex} driver.
%
% \begin{macro}{\pIIe@mode}
% We are about to generate \PDF\ code.
% (Only, if pdf\TeX\ is actually generating \PDF;
% otherwise nothing will be output.)
%    \begin{macrocode}
%<*pdftex>
\begingroup
  \@ifundefined{pdfoutput}{}{%
    \ifnum\pdfoutput>0\relax
      \gdef\pIIe@mode{2}
    \fi
  }
\endgroup
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% The save\slash restore operators are necessary here to prevent the
% change of the CTM (scaling and rotation operations) that
% \textsf{pict2e} inserts from propagating.
%    \begin{macrocode}
\ifcase\pIIe@mode\relax \or\or
  \def\pIIe@code#1{\pdfliteral{ q #1 Q }}
\fi
%</pdftex>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{vtex}
%
% A \textsf{pict2e} driver file for the \textsf{vtex} driver.
%
% \begin{macro}{\pIIe@mode}
% With \textsf{V\TeX}, we should use \PS\ code also for \PDF\ mode
% (Email from Michael Vulis, MicroPress).
%    \begin{macrocode}
%<*vtex>
\begingroup
  \@ifundefined{VTeXversion}{}{%
    \ifnum\OpMode>0\relax
      \ifnum\OpMode<3\relax
        \gdef\pIIe@mode{1}%
      \fi
    \fi
  }
\endgroup
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% Here |\Gin@PS@restored| suffices as provided by the graphics driver
% file |vtex.def|.
%    \begin{macrocode}
\ifcase\pIIe@mode\relax \or
  \let\pIIe@code\Gin@PS@restored
\fi
%</vtex>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{dvipdfm}
%
% A \textsf{pict2e} driver file for the \textsf{dvipdfm} driver.
%
% \begin{macro}{\pIIe@mode}
% We are about to generate \PDF\ code.
%    \begin{macrocode}
%<*dvipdfm>
\def\pIIe@mode{2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% This seems to be sufficient.
%    \begin{macrocode}
\def\pIIe@code#1{\special{pdf: content #1}}
%</dvipdfm>
%    \end{macrocode}
% \end{macro}
%
%
%\iffalse
% \subsection{xdvi}
%
% A \textsf{pict2e} driver file for the \textsf{xdvi} driver.
%
% \begin{macro}{\pIIe@mode}
% We are about to generate \PS\ code.
%    \begin{macrocode}
%<*xdvi>
\def\pIIe@mode{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% As long as our operations are ``atomic,'' we won't need to set
% colours or gray shades within our code, hence the offending
% \verb+setgray+ operator may as well be a no-op.
% See also \LaTeX\ problem report graphics/3569.
% \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored}
% (prevent resetting current color to black). (HjG,RN)}
%    \begin{macrocode}
\def\pIIe@code#1{%
 % \Gin@PS@raw{save /setgray { pop } def}%
  \Gin@PS@restored{#1}%
 % \Gin@PS@raw{restore}%
}
%</xdvi>
%    \end{macrocode}
% \end{macro}
%\fi
%
%
% \subsection{dvipdf}
%
% A \textsf{pict2e} driver file for the \textsf{dvipdf} driver
% (not yet implemented).
%
% \begin{macro}{\pIIe@mode}
%    \begin{macrocode}
%<*dvipdf>
 %\def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
% This is the same as the definition for |\Gin@PS@restored|
% in |dvipdf.def| as defined in |drivers.dtx|!
% Better use the higher-level macro instead of the |\special|?
%    \begin{macrocode}
 %\def\pIIe@code#1{\special{" #1}} % \Gin@PS@restored{#1}
%</dvipdf>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{textures}
%
% A \textsf{pict2e} driver file for the \textsf{textures} driver
% (not yet implemented).
%
% \begin{macro}{\pIIe@mode}
%    \begin{macrocode}
%<*textures>
 % \def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
%    \begin{macrocode}
 % \def\pIIe@code#1{}
%</textures>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{dvipsone}
%
% A \textsf{pict2e} driver file for the \textsf{dvipsone} driver
% (not yet implemented).
%
% \begin{macro}{\pIIe@mode}
%    \begin{macrocode}
%<*dvipsone>
 % \def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
%    \begin{macrocode}
 % \def\pIIe@code#1{}
%</dvipsone>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{pctexps}
%
% A \textsf{pict2e} driver file for the \textsf{pctexps} driver
% (not yet implemented).
%
% \begin{macro}{\pIIe@mode}
%    \begin{macrocode}
%<*pctexps>
 % \def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
%    \begin{macrocode}
 % \def\pIIe@code#1{}
%</pctexps>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{pctex32}
%
% A \textsf{pict2e} driver file for the \textsf{pctex32} driver
% (not yet implemented).
%
% \begin{macro}{\pIIe@mode}
%    \begin{macrocode}
%<*pctex32>
 % \def\pIIe@mode{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pIIe@code}
%    \begin{macrocode}
 % \def\pIIe@code#1{}
%</pctex32>
%    \end{macrocode}
% \end{macro}
%
%
% \section{A Sample Configuration File}
%
% ^^A Preamble?
%
% This one is taken from |color.cfg| of the
% \teTeX\slash\TeXlive\ distributions.
%    \begin{macrocode}
%<*cfg>
%% Select an appropriate default driver.
\begingroup
  \chardef\x=0 %
  % check pdfTeX
  \@ifundefined{pdfoutput}{}{%
    \ifcase\pdfoutput
    \else
      \chardef\x=1 %
    \fi
  }%
  % check VTeX
  \@ifundefined{OpMode}{}{%
    \chardef\x=2 %
  }%
\expandafter\endgroup
\ifcase\x
  % default case
  \ExecuteOptions{dvips}%
\or
  % pdfTeX is running in pdf mode
  \ExecuteOptions{pdftex}%
\else
  % VTeX is running
  \ExecuteOptions{vtex}%
\fi
%    \end{macrocode}
% You can also specify other options to the \textsf{pict2e} package in
% the configuration file.
% For example, if you prefer PSTricks-like arrows, just uncomment the
% line below.
%    \begin{macrocode}
%% \ExecuteOptions{pstarrows}
%</cfg>
%    \end{macrocode}
%
% \Finale
\endinput