| 1 |
\input texinfo |
| 2 |
@setfilename dvips.info |
| 3 |
@settitle Dvips: A DVI-to-PostScript translator |
| 4 |
|
| 5 |
@set version 2026.1 |
| 6 |
@set month-year January 2026 |
| 7 |
|
| 8 |
@copying |
| 9 |
This manual documents Dvips version @value{version} |
| 10 |
(@value{month-year}), a program to translate a DVI file into |
| 11 |
PostScript. You may freely use, modify and/or distribute this file. |
| 12 |
@end copying |
| 13 |
|
| 14 |
@c Define a new index for filenames and options. |
| 15 |
@defcodeindex fl |
| 16 |
@defcodeindex op |
| 17 |
|
| 18 |
@c Put everything in one index (arbitrarily chosen to be the concept index). |
| 19 |
@syncodeindex fl cp |
| 20 |
@syncodeindex fn cp |
| 21 |
@syncodeindex ky cp |
| 22 |
@syncodeindex op cp |
| 23 |
@syncodeindex pg cp |
| 24 |
@syncodeindex vr cp |
| 25 |
|
| 26 |
@dircategory TeX |
| 27 |
@direntry |
| 28 |
* DVI-to-PostScript: (dvips). Translating TeX DVI files to PostScript. |
| 29 |
* afm2tfm: (dvips)Invoking afm2tfm. Making Type 1 fonts available to TeX. |
| 30 |
* dvips: (dvips)Invoking Dvips. DVI-to-PostScript translator. |
| 31 |
@end direntry |
| 32 |
|
| 33 |
@titlepage |
| 34 |
@title Dvips: A DVI-to-PostScript Translator |
| 35 |
@subtitle for version @value{version} |
| 36 |
@subtitle @value{month-year} |
| 37 |
@author Tomas Rokicki |
| 38 |
@author @url{https://tug.org/dvips} |
| 39 |
|
| 40 |
@page |
| 41 |
@insertcopying |
| 42 |
@vskip 0pt plus 1filll |
| 43 |
@end titlepage |
| 44 |
|
| 45 |
@summarycontents |
| 46 |
@contents |
| 47 |
|
| 48 |
@ifnottex |
| 49 |
@node Top |
| 50 |
@top Dvips |
| 51 |
|
| 52 |
@insertcopying |
| 53 |
|
| 54 |
@menu |
| 55 |
* Why Dvips:: Why use Dvips? |
| 56 |
* Installation:: How to compile and install Dvips. |
| 57 |
* Invoking Dvips:: Command-line options, configuration files, etc. |
| 58 |
* Paper size and landscape:: Changing the paper dimensions. |
| 59 |
* Interaction with PostScript:: TeX meets Dvips meets PostScript. |
| 60 |
* PostScript fonts:: Installing and using PostScript fonts. |
| 61 |
* Color:: Using color with Dvips. |
| 62 |
* Index:: General index. |
| 63 |
@end menu |
| 64 |
@end ifnottex |
| 65 |
|
| 66 |
|
| 67 |
@node Why Dvips |
| 68 |
@chapter Why use Dvips? |
| 69 |
|
| 70 |
The Dvips program has a number of features that set it apart from |
| 71 |
other PostScript drivers for @TeX{}. This rather long section describes |
| 72 |
the advantages of using Dvips, and may be skipped if you are just |
| 73 |
interested in learning how to use the program. @xref{Installation}, for |
| 74 |
details of compilation and installation. |
| 75 |
|
| 76 |
The Dvips driver generates excellent, standard PostScript, that |
| 77 |
can be included in other documents as figures or printed through a |
| 78 |
variety of spoolers. The generated PostScript requires very little |
| 79 |
printer memory, so very complex documents with a lot of fonts can easily |
| 80 |
be printed even on PostScript printers without much memory, such as the |
| 81 |
original Apple LaserWriter. The PostScript output is also compact, |
| 82 |
requiring less disk space to store and making it feasible as a transfer |
| 83 |
format. |
| 84 |
|
| 85 |
Even those documents that are too complex to print in their entirety on |
| 86 |
a particular printer can be printed, since Dvips will |
| 87 |
automatically split such documents into pieces, reclaiming the printer |
| 88 |
memory between each piece. |
| 89 |
|
| 90 |
The Dvips program supports graphics in a natural way, allowing |
| 91 |
PostScript graphics to be included and automatically scaled and |
| 92 |
positioned in a variety of ways. |
| 93 |
|
| 94 |
Printers with any resolution are supported, even if they have different |
| 95 |
resolutions in the horizontal and vertical directions. High resolution |
| 96 |
output is supported for typesetters, including an option that compresses |
| 97 |
the bitmap fonts so that typesetter virtual memory is not exhausted. |
| 98 |
This option also significantly reduces the size of the PostScript file |
| 99 |
and decoding in the printer is very fast. |
| 100 |
|
| 101 |
Missing fonts can be automatically generated if Metafont exists on |
| 102 |
the system, or fonts can be converted from GF to PK format |
| 103 |
on demand. If a font cannot be generated, a scaled version of the same |
| 104 |
font at a different size can be used instead, although Dvips will |
| 105 |
complain loudly about the poor aesthetics of the resulting output. |
| 106 |
|
| 107 |
One of the most important features is the support of virtual fonts, |
| 108 |
which add an entirely new level of flexibility to @TeX{}. Dvips even |
| 109 |
comes with its own Afm2tfm program that can create the virtual fonts |
| 110 |
and @TeX{} font metric files automatically from Adobe font metric |
| 111 |
files. |
| 112 |
|
| 113 |
Source is provided and freely distributable, so adding a site-specific feature |
| 114 |
is possible. Adding such features is made easier by the highly modular |
| 115 |
structure of the program. |
| 116 |
|
| 117 |
@cindex Rokicki, Tomas |
| 118 |
Tom Rokicki wrote and maintains the original Dvips program. |
| 119 |
|
| 120 |
|
| 121 |
@node Installation |
| 122 |
@chapter Installation |
| 123 |
|
| 124 |
@cindex configuration, of Dvips |
| 125 |
@cindex compilation |
| 126 |
@cindex installation, of Dvips |
| 127 |
|
| 128 |
@c ifset version |
| 129 |
@c (A copy of this chapter is in the distribution file @file{dvipsk/INSTALL}.) |
| 130 |
@c end ifset |
| 131 |
|
| 132 |
Installing Dvips is mostly the same as installing any Kpathsea-using |
| 133 |
program. Therefore, for the basic steps involved, |
| 134 |
@pxref{Installation,,, kpathsea, Kpathsea}. |
| 135 |
|
| 136 |
For solutions to common installation problems and information on how to |
| 137 |
report a bug, see the file @file{kpathsea/BUGS} (@pxref{Bugs,,, |
| 138 |
kpathsea, Kpathsea}). For solutions to Dvips-specific problems, |
| 139 |
@pxref{Debug options}. |
| 140 |
|
| 141 |
Dvips does require some additional installation, detailed in the |
| 142 |
sections below. Also, to configure color devices, @pxref{Color device |
| 143 |
configuration}. |
| 144 |
|
| 145 |
@menu |
| 146 |
* config.ps installation:: Printer and site Dvips configuration. |
| 147 |
* PostScript font installation:: Many PostScript fonts are freely available. |
| 148 |
* Ghostscript installation:: A free PostScript interpreter. |
| 149 |
* Diagnosing problems:: Some common runtime difficulties. |
| 150 |
@end menu |
| 151 |
|
| 152 |
|
| 153 |
@node config.ps installation |
| 154 |
@section @file{config.ps} installation |
| 155 |
|
| 156 |
@flindex config.ps @r{installation} |
| 157 |
@cindex installation of @file{config.ps} |
| 158 |
@cindex printer configuration |
| 159 |
@cindex paper size, default |
| 160 |
@cindex configuration files, creating |
| 161 |
|
| 162 |
Dvips has its own configuration files: a file @file{config.ps} for |
| 163 |
sitewide defaults, and a file @file{config.@var{printer}} for each |
| 164 |
printer (output device). Since these are site-specific, @code{make |
| 165 |
install} does not create them; you must create them yourself. |
| 166 |
|
| 167 |
(These Dvips configuration files are independent of the Kpathsea |
| 168 |
configuration file @file{texmf.cnf} (@pxref{Config files,,,kpathsea, |
| 169 |
Kpathsea}). |
| 170 |
|
| 171 |
@flindex config.proto |
| 172 |
@cindex prototype printer configuration file |
| 173 |
@cindex printer configuration file, prototype |
| 174 |
@cindex configuration files, prototype |
| 175 |
Dvips configuration files contents and searching are described fully in |
| 176 |
@ref{Config files}. The simplest way to create a new configuration file |
| 177 |
is to copy and modify the file @file{dvipsk/contrib/config.proto}, |
| 178 |
seasoning with options to your taste from @ref{Config files}. Here is |
| 179 |
@file{config.proto} |
| 180 |
for your reading pleasure: |
| 181 |
@example |
| 182 |
@include contrib/config.proto |
| 183 |
@end example |
| 184 |
|
| 185 |
|
| 186 |
@node PostScript font installation |
| 187 |
@section PostScript font installation |
| 188 |
|
| 189 |
@cindex installation of PostScript fonts |
| 190 |
@cindex fonts, installation of PostScript |
| 191 |
@cindex PostScript fonts, installing |
| 192 |
|
| 193 |
To use PostScript fonts with @TeX{} and Dvips, you need both metric |
| 194 |
files (@file{.tfm} and @file{.vf}) and the outlines (@file{.pfa} or |
| 195 |
@file{.pfb}). @xref{Font concepts}. Current @TeX{} systems |
| 196 |
come with support for 35 base PostScript fonts and many more. |
| 197 |
|
| 198 |
@cindex fonts, system PostScript |
| 199 |
@cindex PostScript fonts, on your system |
| 200 |
@flindex psfonts.map |
| 201 |
If you have additional PostScript fonts, you can make them available |
| 202 |
to Dvips by (1)@tie{}giving them appropriate filenames; and |
| 203 |
(2)@tie{}running Afm2tfm (@pxref{Making a font available}) to make TFM |
| 204 |
and VF metrics for @TeX{} and Dvips to use. Also add them to |
| 205 |
@file{psfonts.map} (@pxref{psfonts.map}); this file must contain |
| 206 |
everything available in the system. The @code{updmap} program is |
| 207 |
usually used to maintain @file{psfonts.map}; run @samp{updmap --help} |
| 208 |
for lots of information about how it works. |
| 209 |
|
| 210 |
|
| 211 |
@node Ghostscript installation |
| 212 |
@section Ghostscript installation |
| 213 |
|
| 214 |
@cindex Ghostscript installation |
| 215 |
@pindex gs @r{installation} |
| 216 |
|
| 217 |
@cindex Deutsch, Peter |
| 218 |
@cindex Epson printers |
| 219 |
@cindex previewing Dvips output |
| 220 |
@cindex PostScript previewers |
| 221 |
@cindex PDF files, making |
| 222 |
@cindex Aladdin Ghostscript |
| 223 |
Ghostscript is a PostScript interpreter freely available to end-users, |
| 224 |
originally written by Peter Deutsch. It can read the PostScript |
| 225 |
produced by Dvips and render it on your monitor, or for another device |
| 226 |
(e.g., an Epson printer) that does not support PostScript, or in PDF |
| 227 |
format. The latest version is available via |
| 228 |
@url{https://ghostscript.com}. |
| 229 |
|
| 230 |
@cindex Theisen, Tim |
| 231 |
@pindex ghostview |
| 232 |
@cindex Ghostview, and no @samp{N} |
| 233 |
@cindex EPS, and Ghostview |
| 234 |
@cindex standard PostScript, required by Ghostview |
| 235 |
@findex %%Page@r{, required by Ghostview} |
| 236 |
The program Ghostview, originally written by Johannes Plass and Tim |
| 237 |
Theisen, provides typical previewing capabilities (next page/previous |
| 238 |
page, magnification, etc.). It requires Ghostscript to run, and files |
| 239 |
in structured PostScript, specifically with @samp{%%Page} comments (no |
| 240 |
@samp{N} in @file{config.ps}). The current version is known as GV, |
| 241 |
and is available from @url{https://www.gnu.org/software/gv}. |
| 242 |
|
| 243 |
|
| 244 |
@node Diagnosing problems |
| 245 |
@section Diagnosing problems |
| 246 |
|
| 247 |
@cindex problems |
| 248 |
@cindex trouble |
| 249 |
@cindex debugging |
| 250 |
|
| 251 |
You've gone through all the trouble of installing Dvips, carefully read |
| 252 |
all the instructions in this manual, and still can't get something to |
| 253 |
work. The following sections provide some helpful hints if you find |
| 254 |
yourself in such a situation. |
| 255 |
|
| 256 |
For details on effective bug reporting, common installation problems, |
| 257 |
and @code{mktexpk} problems, @pxref{Bugs,,, kpathsea, Kpathsea}. |
| 258 |
|
| 259 |
A good first debugging operation is to set the environment variable |
| 260 |
@env{DVIPSDEBUG}, which will display any configuration and map files |
| 261 |
read by Dvips. This way you can be sure it's finding the files and |
| 262 |
settings you expect. |
| 263 |
|
| 264 |
@menu |
| 265 |
* Debug options:: Getting diagnostics. |
| 266 |
* No output:: No output at all. |
| 267 |
* Small or inverted:: Output too small or inverted. |
| 268 |
* Printer errors:: The printer sends back errors. |
| 269 |
* Long documents fail:: Long documents fail to print. |
| 270 |
* Including graphics fails:: Figures don't work. |
| 271 |
@end menu |
| 272 |
|
| 273 |
|
| 274 |
@node Debug options |
| 275 |
@subsection Debug options |
| 276 |
|
| 277 |
@cindex debugging options |
| 278 |
@cindex options, debugging |
| 279 |
|
| 280 |
The @samp{-d} flag to Dvips helps in tracking down certain errors. |
| 281 |
The parameter to this flag is an integer that tells what errors are |
| 282 |
currently being tracked. To track a certain class of debug messages, |
| 283 |
specify the appropriate number given below; if you wish to track |
| 284 |
multiple classes, sum the numbers of the classes you wish to track. |
| 285 |
To track all classes, you can use @code{-1}. |
| 286 |
|
| 287 |
You can also set the environment variable @env{KPATHSEA_DEBUG} instead |
| 288 |
of using @samp{-d}. Some of these debugging options are actually |
| 289 |
provided by Kpathsea (@pxref{Debugging, , , kpathsea, Kpathsea}). |
| 290 |
|
| 291 |
The classes are: |
| 292 |
|
| 293 |
@table @asis |
| 294 |
@item 1 |
| 295 |
specials |
| 296 |
@item 2 |
| 297 |
paths |
| 298 |
@item 4 |
| 299 |
fonts |
| 300 |
@item 8 |
| 301 |
pages |
| 302 |
@item 16 |
| 303 |
headers |
| 304 |
@item 32 |
| 305 |
font compression |
| 306 |
@item 64 |
| 307 |
files |
| 308 |
@item 128 |
| 309 |
(omitted) |
| 310 |
@item 256 |
| 311 |
config files |
| 312 |
@item 512 |
| 313 |
Kpathsea @code{stat} calls |
| 314 |
@item 1024 |
| 315 |
Kpathsea hash table lookups |
| 316 |
@item 2048 |
| 317 |
Kpathsea path element expansion |
| 318 |
@item 4096 |
| 319 |
Kpathsea path searches |
| 320 |
@end table |
| 321 |
|
| 322 |
|
| 323 |
@node No output |
| 324 |
@subsection No output at all |
| 325 |
|
| 326 |
@cindex output, none |
| 327 |
@cindex no output at all |
| 328 |
@cindex failure, to print at all |
| 329 |
|
| 330 |
If you are not getting any output at all, even from the simplest |
| 331 |
one-character file (for instance, @samp{\ \bye}), then something is very |
| 332 |
wrong. Practically any file sent to a PostScript laser printer should |
| 333 |
generate some output, at the very least a page detailing what error |
| 334 |
occurred, if any. Talk to your system administrator about downloading a |
| 335 |
PostScript error handler. (Adobe distributes a good one called |
| 336 |
@samp{ehandler.ps}.) |
| 337 |
@flindex ehandler.ps |
| 338 |
|
| 339 |
@cindex PowerPage PostScript implementation |
| 340 |
@cindex Shinko CHC-S446i printer |
| 341 |
@cindex Mitsubishi Shinko CHC-S446i printer |
| 342 |
It is possible, especially if you are using non-Adobe PostScript, that |
| 343 |
your PostScript interpreter is broken. Even then it should generate an |
| 344 |
error message. Dvips tries to work around as many bugs as possible in |
| 345 |
common non-Adobe PostScript interpreters, but doubtless it misses a few. |
| 346 |
PowerPage Revision 1, Interpreter Version 20001.001, on a Mitsubishi |
| 347 |
Shinko CHC-S446i color thermal dye sublimation printer is known to be |
| 348 |
unable to print with any but builtin fonts. |
| 349 |
|
| 350 |
If Dvips gives any strange error messages, or compilation on your |
| 351 |
machine generated a lot of warnings, perhaps the Dvips program itself is |
| 352 |
broken. Try using the debug options to determine where the error |
| 353 |
occurred (@pxref{Debug options}). |
| 354 |
|
| 355 |
It is possible your spooler is broken and is misinterpreting the |
| 356 |
structured comments. Try the @samp{-N} flag to turn off structured |
| 357 |
comments and see what happens. |
| 358 |
|
| 359 |
|
| 360 |
@node Small or inverted |
| 361 |
@subsection Output too small or inverted |
| 362 |
|
| 363 |
@cindex output, too small |
| 364 |
@cindex output, inverted |
| 365 |
@cindex inverted output |
| 366 |
@cindex too-small output |
| 367 |
|
| 368 |
@cindex save/restore, and inverted output |
| 369 |
If some documents come out inverted or too small, probably your spooler |
| 370 |
is not supplying an end of job indicator at the end of each file. (This |
| 371 |
commonly happens on small machines that don't have spoolers.) You can |
| 372 |
force Dvips to do this with the @samp{-F} flag (or @samp{F} config file |
| 373 |
option), but this generates files with a terminating binary character |
| 374 |
(control-D). You can also try using the @samp{-s} flag (or @samp{s} |
| 375 |
config file option) to enclose the entire job in a save/restore pair. |
| 376 |
@xref{Command-line options}, and @ref{Config files}. |
| 377 |
|
| 378 |
|
| 379 |
@node Printer errors |
| 380 |
@subsection Error messages from printer |
| 381 |
|
| 382 |
@cindex printer errors |
| 383 |
@cindex error messages from printer |
| 384 |
@cindex failure, and printer errors |
| 385 |
|
| 386 |
@cindex @t{bop undefined} error |
| 387 |
If your printer returns error messages, the error message gives very |
| 388 |
good information on what might be going wrong. One of the most common |
| 389 |
error messages is @samp{bop undefined}. This is caused by old versions |
| 390 |
of Transcript and other spoolers that do not properly parse the setup |
| 391 |
section of the PostScript. To fix this, turn off structured comments |
| 392 |
with the @samp{-N} option, but it'd be best to get your spooling |
| 393 |
software updated. |
| 394 |
|
| 395 |
@cindex VM exhausted |
| 396 |
@cindex printer memory exhausted |
| 397 |
@cindex memory of printer exhausted |
| 398 |
Another error message is @samp{VM exhausted}. Some printers indicate |
| 399 |
this error by locking up, others quietly reset. This is caused by Dvips |
| 400 |
thinking that the printer has more memory than it actually does, and |
| 401 |
then printing a complicated document. To fix this, try lowering the |
| 402 |
@samp{m} parameter in the configuration file; use the debug option to |
| 403 |
make sure you adjust the correct file. |
| 404 |
|
| 405 |
Other errors may indicate you are trying to include graphics that don't |
| 406 |
nest properly in other PostScript documents, among other things. Try |
| 407 |
the PostScript file on a QMS PS-810 or other Adobe PostScript printer if |
| 408 |
you have one, or Ghostscript (@pxref{Ghostscript installation}); it |
| 409 |
might be a problem with the printer itself. |
| 410 |
|
| 411 |
|
| 412 |
@node Long documents fail |
| 413 |
@subsection Long documents fail to print |
| 414 |
|
| 415 |
@cindex long documents not printing |
| 416 |
@cindex failure, of long documents |
| 417 |
|
| 418 |
This is usually caused by incorrectly specifying the amount of memory |
| 419 |
the printer has in the configuration file; see the previous section. |
| 420 |
|
| 421 |
|
| 422 |
@node Including graphics fails |
| 423 |
@subsection Including graphics fails |
| 424 |
|
| 425 |
@cindex including graphics fails |
| 426 |
@cindex graphics inclusion fails |
| 427 |
@cindex failure, to include graphics |
| 428 |
|
| 429 |
The most common problem with including graphics is an incorrect bounding |
| 430 |
box (@pxref{Bounding box}). Complain to whoever wrote the software that |
| 431 |
generated the file if the bounding box is indeed incorrect. |
| 432 |
|
| 433 |
@cindex Illustrator, workaround for |
| 434 |
Another possible problem is that the figure you are trying to include |
| 435 |
does not nest properly; there are certain rules PostScript applications |
| 436 |
must follow when generating files to be included. The Dvips program |
| 437 |
includes work-arounds for such errors in Adobe Illustrator and other |
| 438 |
programs, but there are certainly applications that haven't been tested. |
| 439 |
|
| 440 |
One possible thing to try is the @samp{-K} flag which strips the comments |
| 441 |
from an included figure. This might be necessary if the PostScript |
| 442 |
spooling software does not read the structured comments correctly. Use |
| 443 |
of this flag will break graphics from some applications, though, since |
| 444 |
some applications read the PostScript file from the input stream, |
| 445 |
looking for a particular comment. |
| 446 |
|
| 447 |
@cindex binary files, not supported |
| 448 |
Any application which generates graphics output containing raw binary |
| 449 |
(not ASCII hex) will probably fail with Dvips. |
| 450 |
|
| 451 |
|
| 452 |
@node Invoking Dvips |
| 453 |
@chapter Invoking Dvips |
| 454 |
|
| 455 |
@cindex command-line options |
| 456 |
@cindex options, Dvips |
| 457 |
@cindex invoking Dvips |
| 458 |
|
| 459 |
Dvips reads a DVI file as output by (for example) @TeX{}, and converts |
| 460 |
it to PostScript, taking care of builtin or downloaded PostScript fonts, |
| 461 |
font reencoding, color, etc. These features are described in other |
| 462 |
chapters in this document. |
| 463 |
|
| 464 |
There many ways to control Dvips' behavior: configuration files, |
| 465 |
environment variables, and command-line options. |
| 466 |
|
| 467 |
@menu |
| 468 |
* Basic usage:: |
| 469 |
* Command-line options:: |
| 470 |
* Environment variables:: |
| 471 |
* Config files:: |
| 472 |
@end menu |
| 473 |
|
| 474 |
|
| 475 |
@node Basic usage |
| 476 |
@section Basic usage of Dvips |
| 477 |
|
| 478 |
@cindex usage, basic |
| 479 |
|
| 480 |
To use Dvips at its simplest, simply type |
| 481 |
|
| 482 |
@example |
| 483 |
dvips foo |
| 484 |
@end example |
| 485 |
|
| 486 |
@noindent |
| 487 |
where @file{foo.dvi} is the output of @TeX{} that you want to print. |
| 488 |
The default output is to a corresponding file @file{foo.ps}; Dvips may |
| 489 |
also have been locally configured to output directly to a printer by |
| 490 |
default. |
| 491 |
|
| 492 |
If you use fonts that have not been used on your system before, they may |
| 493 |
be automatically generated; this process can take a few minutes, so |
| 494 |
progress reports appear by default. The next time that document is |
| 495 |
printed, these fonts will have been saved in the proper directories, so |
| 496 |
printing will go much faster. (If Dvips tries to endlessly generate the |
| 497 |
same fonts over and over again, it hasn't been installed properly. |
| 498 |
@xref{Unable to generate fonts,,, kpathsea, Kpathsea}.) |
| 499 |
|
| 500 |
Many options are available (see the next section). For a brief summary |
| 501 |
of available options, run |
| 502 |
|
| 503 |
@example |
| 504 |
dvips --help |
| 505 |
@end example |
| 506 |
|
| 507 |
|
| 508 |
@node Command-line options |
| 509 |
@section Command-line options |
| 510 |
|
| 511 |
Dvips has a plethora of command line options. Reading through this |
| 512 |
section will give a good idea of the capabilities of the driver. |
| 513 |
|
| 514 |
@menu |
| 515 |
* Option summary:: Quick listing, from Dvips --help. |
| 516 |
* Option details:: More information about each option. |
| 517 |
@end menu |
| 518 |
|
| 519 |
|
| 520 |
@node Option summary |
| 521 |
@subsection Option summary |
| 522 |
|
| 523 |
@cindex options, summary |
| 524 |
Here is a handy summary of the options; it is printed out when you run |
| 525 |
Dvips with no arguments or with the standard @samp{--help} option. |
| 526 |
@opindex --help |
| 527 |
|
| 528 |
@verbatiminclude dvips.help |
| 529 |
|
| 530 |
|
| 531 |
@node Option details |
| 532 |
@subsection Option details |
| 533 |
|
| 534 |
@cindex option, details of |
| 535 |
|
| 536 |
Many of the parameterless options listed here can be turned off by |
| 537 |
suffixing the option with a zero (@samp{0}); for instance, to turn off |
| 538 |
page reversal, use @samp{-r0}. Such options are marked with a trailing |
| 539 |
@samp{*}. |
| 540 |
|
| 541 |
@table @samp |
| 542 |
@item - |
| 543 |
@opindex - |
| 544 |
@cindex options, reading from standard input |
| 545 |
@cindex standard input, reading options from |
| 546 |
Read additional options from standard input after processing the command |
| 547 |
line. |
| 548 |
|
| 549 |
@item --help |
| 550 |
@opindex --help |
| 551 |
Print a usage message and exit. |
| 552 |
|
| 553 |
@item --version |
| 554 |
@opindex --version |
| 555 |
Print the version number and exit. |
| 556 |
|
| 557 |
@item -a* |
| 558 |
@opindex -a |
| 559 |
@cindex memory, conserving |
| 560 |
Conserve memory by making three passes over the DVI file instead |
| 561 |
of two and only loading those characters actually used. Generally only |
| 562 |
useful on machines with a very limited amount of memory, like some PCs. |
| 563 |
|
| 564 |
@item -A |
| 565 |
@opindex -A |
| 566 |
@cindex odd pages only |
| 567 |
Print only the odd pages. This option uses @TeX{} |
| 568 |
page numbers, not physical page numbers. |
| 569 |
|
| 570 |
@item -b @var{num} |
| 571 |
@opindex -b @var{num} |
| 572 |
@vindex /#copies |
| 573 |
@cindex copies, duplicated page bodies |
| 574 |
@cindex color separations |
| 575 |
Generate @var{num} copies of each page, but duplicating the page body |
| 576 |
rather than using the @samp{/#copies} PostScript variable. This can |
| 577 |
be useful in conjunction with a header file setting @samp{bop-hook} to |
| 578 |
do color separations or other neat tricks. |
| 579 |
|
| 580 |
@item -B |
| 581 |
@opindex -B |
| 582 |
@cindex even pages only |
| 583 |
@cindex double-sided printing |
| 584 |
Print only the even pages. This option uses @TeX{} page numbers, not |
| 585 |
physical page numbers. |
| 586 |
|
| 587 |
@item -bitmapfontenc @var{option} |
| 588 |
@opindex -bitmapfontenc @var{option} |
| 589 |
@cindex bitmap font encoding |
| 590 |
Turns bitmap font encoding to @samp{off}, @samp{on} (no warnings |
| 591 |
for missing bitmap font encodings), or @samp{strict} (with warnings |
| 592 |
for missing bitmap font encodings). |
| 593 |
|
| 594 |
@item -c @var{num} |
| 595 |
@opindex -c @var{num} |
| 596 |
@vindex /#copies |
| 597 |
@cindex copies, uncollated |
| 598 |
@cindex uncollated copies |
| 599 |
Generate @var{num} consecutive copies of every page, i.e., the output is |
| 600 |
uncollated. This merely sets the builtin PostScript variable |
| 601 |
@samp{/#copies}. |
| 602 |
|
| 603 |
@item -C @var{num} |
| 604 |
@opindex -C @var{num} |
| 605 |
@cindex copies, collated |
| 606 |
@cindex collated copies |
| 607 |
Generate @var{num} copies, but collated (by replicating the data in the |
| 608 |
PostScript file). Slower than the @samp{-c} option, but easier on the |
| 609 |
hands, and faster than resubmitting the same PostScript file multiple |
| 610 |
times. |
| 611 |
|
| 612 |
@item -d @var{num} |
| 613 |
@opindex -d @var{num} |
| 614 |
@cindex debugging |
| 615 |
Set the debug flags, showing what Dvips (thinks it) is doing. This will |
| 616 |
work unless Dvips has been compiled without the @samp{DEBUG} option (not |
| 617 |
recommended). @xref{Debug options}, for the possible values of |
| 618 |
@var{num}. Use @samp{-d -1} as the first option for maximum output. |
| 619 |
|
| 620 |
@item -D @var{num} |
| 621 |
@opindex -D @var{num} |
| 622 |
@cindex resolution, setting |
| 623 |
Set both the horizontal and vertical resolution to @var{num}, given in |
| 624 |
dpi (dots per inch). This affects the choice of bitmap fonts that are |
| 625 |
loaded and also the positioning of letters in resident PostScript |
| 626 |
fonts. Must be between 10 and 10000. This affects both the horizontal |
| 627 |
and vertical resolution. If a high resolution (something greater than |
| 628 |
400 dpi, say) is selected, the @samp{-Z} flag should probably also be |
| 629 |
used. If you are using fonts made with Metafont, such as Computer |
| 630 |
Modern, @file{mktexpk} needs to know about the value for @var{num} |
| 631 |
that you use or Metafont will fail. See the @code{modes.mf} file |
| 632 |
(@url{https://ctan.org/pkg/modes}) for a list of resolutions and mode |
| 633 |
names for most devices. |
| 634 |
|
| 635 |
@item -e @var{num} |
| 636 |
@opindex -e @var{num} |
| 637 |
@cindex maxdrift |
| 638 |
@cindex accuracy in positioning |
| 639 |
@cindex positioning accuracy |
| 640 |
Maximum drift in pixels of each character from its `true' |
| 641 |
resolution-independent position on the page. The default value of this |
| 642 |
parameter is resolution dependent (it is the number of entries in the |
| 643 |
list [100, 200, 300, 400, 500, 600, 800, 1000, 1200, 1600, 2000, 2400, |
| 644 |
2800, 3200, @dots{}] that are less than or equal to the resolution in |
| 645 |
dots per inch). Allowing individual characters to `drift' from their |
| 646 |
correctly rounded positions by a few pixels, while regaining the true |
| 647 |
position at the beginning of each new word, improves the spacing of |
| 648 |
letters in words. |
| 649 |
|
| 650 |
@item -E* |
| 651 |
@opindex -E |
| 652 |
@cindex EPSF, generating |
| 653 |
@cindex tight bounding box, finding |
| 654 |
@cindex bounding box, finding tight |
| 655 |
Generate an EPSF file with a tight bounding box. This only looks at |
| 656 |
marks made by characters and rules, not by any included graphics. In |
| 657 |
addition, it gets the glyph metrics from the TFM file, so characters |
| 658 |
that print outside their enclosing TFM box may confuse it. In addition, |
| 659 |
the bounding box might be a bit too loose if the character glyph has |
| 660 |
significant left or right side bearings. Nonetheless, this option works |
| 661 |
well enough for creating small EPSF files for equations or tables or the |
| 662 |
like. (Of course, Dvips output, especially when using bitmap fonts, is |
| 663 |
resolution-dependent and thus does not make very good EPSF files, |
| 664 |
especially if the images are to be scaled; use these EPSF files with |
| 665 |
care.) For multiple page input files, also specify @samp{-i} to get |
| 666 |
each page as a separate EPSF file; otherwise, all the pages are overlaid |
| 667 |
in the single output file. |
| 668 |
|
| 669 |
@item -f* |
| 670 |
@opindex -f |
| 671 |
@cindex filter, running as a |
| 672 |
@cindex standard I/O |
| 673 |
@cindex pipes, not readable |
| 674 |
@vindex PRINTER@r{, avoided with @samp{-f}} |
| 675 |
Run as a filter. Read the DVI file from standard input and write the |
| 676 |
PostScript to standard output. The standard input must be seekable, so |
| 677 |
it cannot be a pipe. If your input must be a pipe, write a shell script |
| 678 |
that copies the pipe output to a temporary file and then points Dvips at |
| 679 |
this file. This option also disables the automatic reading of the |
| 680 |
@code{PRINTER} environment variable; use @samp{-P$PRINTER} after the |
| 681 |
@samp{-f} to read it anyway. It also turns off the automatic sending of |
| 682 |
control-D if it was turned on with the @samp{-F} option or in the |
| 683 |
configuration file; use @samp{-F} after the @samp{-f} to send it anyway. |
| 684 |
|
| 685 |
@item -F* |
| 686 |
@opindex -F |
| 687 |
@cindex EOF |
| 688 |
@cindex control-D |
| 689 |
@cindex printer, driving directly |
| 690 |
@cindex spooler, lacking |
| 691 |
Write control-D (ASCII code 4) as the very last character of the |
| 692 |
PostScript file. This is useful when Dvips is driving the printer |
| 693 |
directly instead of working through a spooler, as is common on personal |
| 694 |
systems. On systems shared by more than one person, this is not |
| 695 |
recommended. |
| 696 |
|
| 697 |
@item -G* |
| 698 |
@opindex -G |
| 699 |
@cindex low characters, shifting |
| 700 |
@cindex non-printing characters, shifting |
| 701 |
Shift non-printing characters (ASCII 0-32, 127) to higher-numbered positions. |
| 702 |
This was useful to work around bugs in old versions of Adobe's PDF |
| 703 |
reader. It's more likely to cause problems nowadays. |
| 704 |
|
| 705 |
@item -h @var{name} |
| 706 |
@opindex -h @var{name} |
| 707 |
@cindex header file, downloading |
| 708 |
@cindex userdict@r{, used for header files} |
| 709 |
Prepend @var{name} as an additional header file, or, if @var{name} is |
| 710 |
@samp{-}, suppress inclusion of default header files. If @code{-h} is |
| 711 |
given multiple times, the headers are included in the order given. |
| 712 |
Any definitions in the header file get added to the PostScript |
| 713 |
@samp{userdict}. |
| 714 |
|
| 715 |
@item -i* |
| 716 |
@opindex -i |
| 717 |
@cindex sections output, in separate files |
| 718 |
@cindex multiple output files |
| 719 |
@cindex output files, multiple |
| 720 |
Make each section be a separate file; a @dfn{section} is a part of the |
| 721 |
document processed independently, most often created to avoid memory |
| 722 |
overflow. The filenames are created replacing the suffix of the |
| 723 |
supplied output file name by a three-digit sequence number. This option |
| 724 |
is most often used in conjunction with the @samp{-S} option which sets |
| 725 |
the maximum section length in pages; if @samp{-i} is specified and |
| 726 |
@samp{-S} is not, each page is output as a separate file. For instance, |
| 727 |
some phototypesetters cannot print more than ten or so consecutive pages |
| 728 |
before running out of steam; these options can be used to automatically |
| 729 |
split a book into ten-page sections, each to its own file. |
| 730 |
|
| 731 |
On the other hand, if your document uses very large fonts or very |
| 732 |
large included figures, Dvips might take it upon itself to split the |
| 733 |
output into unwanted sections, to try to avoid overflowing printer |
| 734 |
memory. @xref{Headers and memory usage}, for ways to handle this. |
| 735 |
|
| 736 |
@item -j* |
| 737 |
@opindex -j @r{for partial font downloading} |
| 738 |
Download only needed characters from Type 1 fonts. This is the |
| 739 |
default in the current release. Some debugging flags trace this operation |
| 740 |
(@pxref{Debug options}). You can also control partial downloading on a |
| 741 |
per-font basis (@pxref{psfonts.map}). |
| 742 |
|
| 743 |
@item -k* |
| 744 |
@opindex -k @r{for cropmarks} |
| 745 |
@cindex cropmarks |
| 746 |
@flindex crop.pro |
| 747 |
Print crop marks. This option increases the paper size (which should be |
| 748 |
specified, either with a paper size special or with the @samp{-T} |
| 749 |
option) by a half inch in each dimension. It translates each page by a |
| 750 |
quarter inch and draws cross-style crop marks. It is mostly useful with |
| 751 |
typesetters that can set the page size automatically. This works by |
| 752 |
downloading @file{crop.pro}. |
| 753 |
|
| 754 |
@item -K* |
| 755 |
@opindex -K |
| 756 |
@cindex comments, removing included |
| 757 |
@findex %%Page@r{, removing} |
| 758 |
Remove comments in included PostScript graphics, font files, and |
| 759 |
headers; only necessary to get around bugs in spoolers or PostScript |
| 760 |
post-processing programs. Specifically, the @samp{%%Page} |
| 761 |
comments, when left in, often cause difficulties. Use of this flag can |
| 762 |
cause other graphics to fail, however, since the PostScript header |
| 763 |
macros from some software packages read portion the input stream line by |
| 764 |
line, searching for a particular comment. |
| 765 |
|
| 766 |
@item -l [=]@var{num}[.@var{pageseq}] |
| 767 |
@opindex -l [=]@var{num}[.@var{pageseq}] |
| 768 |
@cindex last page printed |
| 769 |
@cindex page, last printed |
| 770 |
@cindex page numbers, multiple repetitions of |
| 771 |
@cindex physical page number, and @samp{-l} |
| 772 |
@cindex absolute page number, and @samp{-l} |
| 773 |
The last page printed will be the first one numbered @var{num}; the |
| 774 |
default is the last page in the document. |
| 775 |
|
| 776 |
By default, @var{num} is compared to @TeX{}'s idea of the page number |
| 777 |
(more precisely, the @code{\count0} value written in the DVI file). |
| 778 |
But if @var{num} is prefixed by an equals sign, then it (and the |
| 779 |
argument to the @samp{-p} option, if specified) is treated as a |
| 780 |
physical (absolute) page number, Thus, using @samp{-l =9} will end the |
| 781 |
output with the ninth page of the document, no matter what the pages |
| 782 |
are actually numbered. |
| 783 |
|
| 784 |
On the other hand, if @var{pageseq} is specified, the @var{pageseq}th |
| 785 |
occurrence of the given @TeX{} page number is used. For example, |
| 786 |
@samp{-l 99.2} says to end with the second page numbered 99 in the |
| 787 |
document. The @samp{=} and @var{lastseq} features aren't useful |
| 788 |
together. |
| 789 |
|
| 790 |
@item -L* |
| 791 |
@opindex -L |
| 792 |
@cindex @samp{papersize} special, first vs.@: last |
| 793 |
By default or with @code{-L1}, the last @samp{papersize} special wins; |
| 794 |
with @code{-L0}, the first special wins. @xref{@samp{papersize} special}. |
| 795 |
|
| 796 |
@item -landscaperotate* |
| 797 |
@opindex -landscaperotate |
| 798 |
@cindex landscaperotate |
| 799 |
When looking for matching paper sizes, permit rotation of page content |
| 800 |
on the page to match the given size; the default, as of Dvips 2022.1, |
| 801 |
is not to do this. It should not be needed in modern systems with |
| 802 |
normal print spoolers, and can be harmful when converting to PDF |
| 803 |
(@pxref{Config file paper sizes}). This option accepts an optional |
| 804 |
suffix of 0 (to explicitly disable) or 1 (to explicitly enable); if |
| 805 |
the option is specified without a suffix, it enables the behavior. |
| 806 |
|
| 807 |
@item -m* |
| 808 |
@opindex -m |
| 809 |
@cindex manual feed |
| 810 |
Specify manual feed, if supported by the output device. |
| 811 |
|
| 812 |
@item -mode @var{mode} |
| 813 |
@opindex -mode @var{mode} |
| 814 |
@cindex mode name, specifying |
| 815 |
@cindex Metafont mode, specifying |
| 816 |
Use @var{mode} as the Metafont device name for path searching and font |
| 817 |
generation. This overrides any value from configuration files. With |
| 818 |
the default paths, explicitly specifying the mode also makes the program |
| 819 |
assume the fonts are in a subdirectory named @var{mode}. |
| 820 |
@xref{TeX directory structure,, @TeX{} directory structure, kpathsea, |
| 821 |
Kpathsea}. If Metafont does not understand the @var{mode} name, see |
| 822 |
@ref{Unable to generate fonts,,, kpathsea, Kpathsea}. |
| 823 |
|
| 824 |
@item -M* |
| 825 |
@opindex -M |
| 826 |
@cindex font generation, avoiding |
| 827 |
@pindex mktexpk@r{, avoiding} |
| 828 |
@flindex missfont.log |
| 829 |
@comment this description repeated in kpathsea.texi |
| 830 |
Turns off automatic font generation (@file{mktexpk}). If |
| 831 |
@code{mktexpk}, the invocation is appended to a file |
| 832 |
@file{missfont.log} (by default) in the current directory. You can then |
| 833 |
execute the log file to create the missing files after fixing the |
| 834 |
problem. |
| 835 |
@vindex TEXMFOUTPUT |
| 836 |
@vindex MISSFONT_LOG |
| 837 |
If the current directory is not writable and the environment variable or |
| 838 |
configuration file value @samp{TEXMFOUTPUT} is set, its value is used. |
| 839 |
Otherwise, nothing is written. The name @samp{missfont.log} is |
| 840 |
overridden by the @samp{MISSFONT_LOG} environment variable or |
| 841 |
configuration file value. |
| 842 |
|
| 843 |
@item -n @var{num} |
| 844 |
@opindex -n @var{num} |
| 845 |
@cindex maximum pages printed |
| 846 |
@cindex pages, maximum printed |
| 847 |
Print at most @var{num} pages. Default is 100000. |
| 848 |
|
| 849 |
@item -N* |
| 850 |
@opindex -N |
| 851 |
@cindex structured comments |
| 852 |
@cindex TranScript |
| 853 |
@findex %%Page@r{, not generating} |
| 854 |
Turns off generation of structured comments such as @samp{%%Page}; this |
| 855 |
may be necessary on some systems that try to interpret PostScript |
| 856 |
comments in weird ways, or on some PostScript printers. Old versions of |
| 857 |
TranScript in particular cannot handle modern Encapsulated PostScript. |
| 858 |
Beware: This also disables page movement, etc., in PostScript viewers |
| 859 |
such as Ghostview. |
| 860 |
|
| 861 |
@item -noomega |
| 862 |
@opindex -noomega |
| 863 |
@cindex Omega extensions |
| 864 |
@cindex p@TeX{} extensions |
| 865 |
Disable the use of Omega extensions when interpreting DVI |
| 866 |
files. By default, the additional opcodes @samp{129} and @samp{134} |
| 867 |
are recognized by Dvips as Omega or p@TeX{} extensions and interpreted as |
| 868 |
requests to set 2-byte characters. |
| 869 |
|
| 870 |
@item -noptex |
| 871 |
@opindex -noptex |
| 872 |
@cindex p@TeX{} extensions |
| 873 |
Disable the use of p@TeX{} extensions when interpreting DVI files. By |
| 874 |
default, the additional opcodes @samp{130} and @samp{135} are |
| 875 |
recognized by Dvips as Omega extensions and interpreted as requests to |
| 876 |
set 3-byte characters, and @samp{255} as request to change the |
| 877 |
typesetting direction. |
| 878 |
|
| 879 |
The only drawback is that the virtual font array will (at least |
| 880 |
temporarily) require 65536 or more positions instead of the default |
| 881 |
256 positions, i.e., the memory requirements of Dvips will be somewhat |
| 882 |
larger. If you find this unacceptable or encounter another problem |
| 883 |
with the Omega or p@TeX{} extensions, you can switch off the p@TeX{} |
| 884 |
extension by using @samp{-noptex}, or both by using @samp{-noomega} |
| 885 |
(but please do send a bug report if you find such problems, |
| 886 |
@pxref{Bugs,,, kpathsea, Kpathsea}). |
| 887 |
|
| 888 |
@item -o @var{name} |
| 889 |
@opindex -o @var{name} |
| 890 |
@cindex output, redirecting |
| 891 |
@cindex standard output, output to |
| 892 |
Send output to the file @var{name}. If @samp{-o} is specified without |
| 893 |
@var{name} (i.e., it is the last thing on the command line), the |
| 894 |
default is @samp{@var{file}.ps} where the input DVI file was |
| 895 |
@samp{@var{file}.dvi}. If @samp{-o} isn't given at all, the |
| 896 |
configuration file default is used. |
| 897 |
|
| 898 |
@findex popen @r{for output} |
| 899 |
@kindex - @r{as output filename} |
| 900 |
@kindex ! @r{starting output filename} |
| 901 |
@kindex | @r{starting output filename} |
| 902 |
@cindex lpr spooler, MS-DOS emulation |
| 903 |
@cindex spooling to lpr on MS-DOS |
| 904 |
If @var{name} is @samp{-}, output goes to standard output. If the first |
| 905 |
character of @var{name} is @samp{!} or @samp{|}, then the remainder will |
| 906 |
be used as an argument to @code{popen}; thus, specifying @samp{|lpr} as |
| 907 |
the output file will automatically queue the file for printing as |
| 908 |
usual. (The MS-DOS version will print to the local printer device |
| 909 |
@file{PRN} when @var{name} is @samp{|lpr} and a program by that name |
| 910 |
cannot be found.) |
| 911 |
|
| 912 |
@samp{-o} disables the automatic reading of the @code{PRINTER} |
| 913 |
environment variable, and turns off the automatic sending of control-D. |
| 914 |
See the @samp{-f} option for how to override this. |
| 915 |
|
| 916 |
@item -O @var{x-offset},@var{y-offset} |
| 917 |
@opindex -O @var{x-offset},@var{y-offset} |
| 918 |
@cindex offset pages |
| 919 |
@cindex printer offset |
| 920 |
Move the origin by @var{x-offset},@var{y-offset}, a comma-separated |
| 921 |
pair of dimensions such as @samp{.1in,-.3cm} (@pxref{@samp{papersize} |
| 922 |
special}). The origin of the page is shifted from the default position |
| 923 |
(of one inch down, one inch to the right from the upper left corner of |
| 924 |
the paper) by this amount. This is usually best specified in the |
| 925 |
printer-specific configuration file. |
| 926 |
|
| 927 |
@flindex testpage.tex |
| 928 |
This is useful for a printer that consistently offsets output pages by a |
| 929 |
certain amount. You can use the file @file{testpage.tex} to determine |
| 930 |
the correct value for your printer. Be sure to do several runs with the |
| 931 |
same @code{O} value---some printers vary widely from run to run. |
| 932 |
|
| 933 |
@findex bop-hook@r{, and offset pages} |
| 934 |
If your printer offsets every other page consistently, instead of every |
| 935 |
page, your best recourse is to use @samp{bop-hook} (@pxref{PostScript |
| 936 |
hooks}). |
| 937 |
|
| 938 |
@item -p [=]@var{num}[.@var{pageseq}] |
| 939 |
@opindex -p [=]@var{num}[.@var{pageseq}] |
| 940 |
@cindex first page printed |
| 941 |
@cindex page, first printed |
| 942 |
@cindex physical page number, and @samp{-p} |
| 943 |
@cindex absolute page number, and @samp{-p} |
| 944 |
Exactly analogous to @code{-l} (q.v.), but specifying the first page |
| 945 |
number to be printed (processed). |
| 946 |
|
| 947 |
@item -pp @var{first}-@var{last} |
| 948 |
@opindex -pp @var{first}-@var{last} |
| 949 |
@cindex page range |
| 950 |
@opindex -pp @var{range} |
| 951 |
Print pages @var{first} through @var{last}; equivalent to @samp{-p |
| 952 |
@var{first} -l @var{last}}, except that multiple @samp{-pp} options |
| 953 |
accumulate, unlike @samp{-p} and @samp{-l}. The @samp{-} separator can |
| 954 |
also be @samp{:}. |
| 955 |
|
| 956 |
@item -P @var{printer} |
| 957 |
@opindex -P @var{printer} |
| 958 |
@flindex config.ps |
| 959 |
Read the configuration file @file{config.@var{printer}} |
| 960 |
(@file{@var{printer}.cfg} on MS-DOS), which typically sets the output |
| 961 |
name (most likely @samp{o |lpr -P@var{printer}}), resolution, Metafont |
| 962 |
mode, and perhaps other printer-specific defaults. It works best to |
| 963 |
put sitewide defaults in the one master @samp{config.ps} file and only |
| 964 |
things that vary from printer to printer in the |
| 965 |
@samp{config.@var{printer}} files; @samp{config.ps} is read before |
| 966 |
@samp{config.@var{printer}}. |
| 967 |
|
| 968 |
A configuration file for eventual creation of Adobe PDF files is |
| 969 |
provided in @samp{config.pdf} and thus can be loaded with |
| 970 |
@samp{-Ppdf}. It will try to include Type 1 outline fonts into the |
| 971 |
PostScript file (@pxref{Hypertext caveats}). |
| 972 |
|
| 973 |
If no @samp{-P} or @samp{-o} is given, the environment variable |
| 974 |
@code{PRINTER} is checked. If that variable exists, and a corresponding |
| 975 |
@file{config.@var{printer}} (@file{@var{printer}.cfg} on MS-DOS) file |
| 976 |
exists, it is read. |
| 977 |
@xref{Configuration file searching}. |
| 978 |
|
| 979 |
@item -q* |
| 980 |
@opindex -q |
| 981 |
@cindex quiet operation |
| 982 |
@cindex silent operation |
| 983 |
@cindex warnings, suppressing |
| 984 |
Run quietly. Don't chatter about pages converted, etc.@:, |
| 985 |
and report no warnings (only errors) to standard error. |
| 986 |
|
| 987 |
@item -r* |
| 988 |
@opindex -r |
| 989 |
@cindex reverse pagination |
| 990 |
Output pages in reverse order. By default, page 1 is output first. |
| 991 |
|
| 992 |
@item -R |
| 993 |
@opindex -R |
| 994 |
@cindex security |
| 995 |
@cindex shell command execution, disabling |
| 996 |
@cindex absolute filenames, disabling |
| 997 |
@cindex @file{..}-relative filenames |
| 998 |
Run securely. @samp{-R2} disables both shell command execution in |
| 999 |
@code{\special} (via @samp{`}, @pxref{Dynamic creation of graphics}) |
| 1000 |
and config files (via the @samp{E} option, @pxref{Configuration file |
| 1001 |
commands}) and opening of any absolute or @file{..}-relative |
| 1002 |
filenames. @samp{-R1}, the default, forbids shell escapes but allows |
| 1003 |
absolute filenames. @samp{-R0} allows both. |
| 1004 |
|
| 1005 |
@item -s* |
| 1006 |
@opindex -s |
| 1007 |
@cindex save/restore, generating global |
| 1008 |
Enclose the output in a global save/restore pair. This causes the file |
| 1009 |
to not be truly conformant, and is thus not recommended, but is useful |
| 1010 |
if you are driving a deficient printer directly and thus don't care too |
| 1011 |
much about the portability of the output to other environments. |
| 1012 |
|
| 1013 |
@item -S @var{num} |
| 1014 |
@opindex -S @var{num} |
| 1015 |
Set the maximum number of pages in each `section'. This option is most |
| 1016 |
commonly used with the @samp{-i} option; see its description above for |
| 1017 |
more information. |
| 1018 |
|
| 1019 |
@item -t @var{papertype} |
| 1020 |
@opindex -t @var{papertype} |
| 1021 |
@cindex paper type |
| 1022 |
@cindex media |
| 1023 |
@cindex letter papertype |
| 1024 |
@cindex legal papertype |
| 1025 |
@cindex ledger papertype |
| 1026 |
@cindex a4 papertype |
| 1027 |
@cindex a3 papertype |
| 1028 |
@cindex landscape papertype |
| 1029 |
@cindex papersize special, and no @samp{-t} |
| 1030 |
Set the paper type to @var{papertype}, usually defined in one of the |
| 1031 |
configuration files, along with the appropriate PostScript code to |
| 1032 |
select it (@pxref{Config file paper sizes}). |
| 1033 |
@itemize @minus{} |
| 1034 |
@item You can also specify a @var{papertype} of @samp{landscape}, |
| 1035 |
which rotates a document by 90 degrees. |
| 1036 |
@item To rotate a document whose paper type is not the default, you |
| 1037 |
can use the @samp{-t} option twice, once for the paper type, and once |
| 1038 |
for @samp{landscape}. |
| 1039 |
@item In general, you should not use any @samp{-t} option when |
| 1040 |
using a @samp{papersize} special, which some @LaTeX{} packages (e.g., |
| 1041 |
@samp{hyperref}) insert. |
| 1042 |
@item One exception is when using a nonstandard paper size that is not |
| 1043 |
already defined in @file{config.ps}; in this case, you need to specify |
| 1044 |
@samp{-t@tie{}unknown}. |
| 1045 |
@item Another exception is when producing multi-page files for further |
| 1046 |
processing; use @samp{-t@tie{}nopaper} to omit any paper size |
| 1047 |
information in the output. (If you just have a single page document, |
| 1048 |
you can use @samp{-E} to get pure EPSF output.) |
| 1049 |
@end itemize |
| 1050 |
|
| 1051 |
@item -title @var{string} |
| 1052 |
@opindex -title @var{str} |
| 1053 |
@cindex title, specifying |
| 1054 |
@cindex output title, specifying |
| 1055 |
@cindex document title, specifying |
| 1056 |
@findex %%Title |
| 1057 |
Use @var{string} as the title in the generated PostScript |
| 1058 |
(@code{%%Title}). If not specified, the default is the basename of the |
| 1059 |
input file; for example, running @code{dvips /foo/bar.dvi} will have a |
| 1060 |
@code{%%Title} of @samp{bar.dvi}. |
| 1061 |
|
| 1062 |
@item -T @var{hsize},@var{vsize} |
| 1063 |
@opindex -T @var{hsize},@var{vsize} |
| 1064 |
Set the paper size to (@var{hsize},@var{vsize}), a comma-separated |
| 1065 |
pair of dimensions such as @samp{.1in,-.3cm} (@pxref{@samp{papersize} |
| 1066 |
special}). It overrides any paper size special in the DVI file. Be |
| 1067 |
careful, as the paper size will stick to a predefined size if there is |
| 1068 |
one close enough. To disable this behavior, use @samp{-tunknown}. |
| 1069 |
|
| 1070 |
@item -u @var{psmapfile} |
| 1071 |
@opindex -u @var{psmapfile} |
| 1072 |
@cindex PostScript font alias file |
| 1073 |
@cindex resident fonts, different in different printers |
| 1074 |
Set @var{psmapfile} to be the file that dvips uses for looking up |
| 1075 |
PostScript font aliases. If @var{psmapfile} begins with a @samp{+} |
| 1076 |
character, then the rest of the name is used as the name of the map file, |
| 1077 |
and the map file is appended to the list of map files (instead of replacing |
| 1078 |
the list). In either case, if the name has no extension, then @samp{.map} |
| 1079 |
is added at the end. |
| 1080 |
|
| 1081 |
@item -U* |
| 1082 |
@opindex -U |
| 1083 |
@cindex Xerox 4045 |
| 1084 |
Disable a PostScript virtual memory-saving optimization that stores the |
| 1085 |
character metric information in the same string that is used to store |
| 1086 |
the bitmap information. This is only necessary when driving the Xerox |
| 1087 |
4045 PostScript interpreter, which has a bug that puts garbage on the |
| 1088 |
bottom of each character. Not recommended unless you must drive this |
| 1089 |
printer. |
| 1090 |
|
| 1091 |
@item -v |
| 1092 |
@opindex -v |
| 1093 |
Print the dvips version number and exit. |
| 1094 |
|
| 1095 |
@item -V* |
| 1096 |
@opindex -V |
| 1097 |
Download non-resident PostScript fonts as bitmaps. This requires use |
| 1098 |
@pindex mtpk |
| 1099 |
@pindex gsftopk |
| 1100 |
@pindex pstopk |
| 1101 |
of @code{mtpk} or @code{gsftopk} or @code{pstopk} or some combination |
| 1102 |
thereof to generate the required bitmap fonts; these programs are |
| 1103 |
supplied with Dvips. The bitmap must be put into @file{psfonts.map} as |
| 1104 |
the downloadable file for that font. This is useful only for those |
| 1105 |
fonts for which you do not have real outlines, being downloaded to |
| 1106 |
printers that have no resident fonts, i.e., very rarely. |
| 1107 |
|
| 1108 |
|
| 1109 |
@item -x @var{num} |
| 1110 |
@opindex -x @var{num} |
| 1111 |
@cindex magnification, overriding DVI |
| 1112 |
Set the magnification ratio to @math{@var{num}/1000}. Overrides |
| 1113 |
the magnification specified in the DVI file. Must be between 10 and |
| 1114 |
100000. It is recommended that you use standard magstep values (1095, |
| 1115 |
1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the total |
| 1116 |
number of PK files generated. @var{num} may be a real number, not an |
| 1117 |
integer, for increased precision. |
| 1118 |
|
| 1119 |
@item -X @var{num} |
| 1120 |
@opindex -X @var{num} |
| 1121 |
@cindex resolution |
| 1122 |
Set the horizontal resolution in dots per inch to @var{num}. |
| 1123 |
|
| 1124 |
@item -y @var{num} |
| 1125 |
@cindex magnification, vertical |
| 1126 |
Set the magnification ratio to @math{@var{num}/1000} times the |
| 1127 |
magnification specified in the DVI file. See |
| 1128 |
@samp{-x} above. |
| 1129 |
|
| 1130 |
@item -Y @var{num} |
| 1131 |
@opindex -Y @var{num} |
| 1132 |
Set the vertical resolution in dots per inch to @var{num.} |
| 1133 |
@cindex resolution |
| 1134 |
|
| 1135 |
@item -z* |
| 1136 |
@opindex -z @r{for recognizing hyperdvi} |
| 1137 |
@cindex hyperdvi extensions, enabling |
| 1138 |
@cindex distillation, and @samp{-z} |
| 1139 |
@cindex PDF files, option for |
| 1140 |
@findex html @r{specials, and @samp{-z}} |
| 1141 |
Pass @samp{html} hyperdvi specials through to the output for eventual |
| 1142 |
distillation into PDF. This is not enabled by default to avoid |
| 1143 |
including the header files unnecessarily, and use of temporary files in |
| 1144 |
creating the output. @xref{Hypertext}. |
| 1145 |
|
| 1146 |
@item -Z* |
| 1147 |
@opindex -Z @r{for compressing bitmap fonts} |
| 1148 |
@cindex compressing bitmap fonts |
| 1149 |
Compress bitmap fonts in the output file, thereby reducing the size of |
| 1150 |
what gets downloaded. Especially useful at high resolutions or when |
| 1151 |
very large fonts are used. May slow down printing, especially on early |
| 1152 |
68000-based PostScript printers. Generally recommend today, and can be |
| 1153 |
enabled in the configuration file (@pxref{Configuration file commands}). |
| 1154 |
|
| 1155 |
@end table |
| 1156 |
|
| 1157 |
|
| 1158 |
@node Environment variables |
| 1159 |
@section Environment variables |
| 1160 |
|
| 1161 |
@cindex environment variables |
| 1162 |
|
| 1163 |
Dvips looks for many environment variables, to define search paths and |
| 1164 |
other things. The path variables are read as needed, after all |
| 1165 |
configuration files are read, so they override values in the |
| 1166 |
configuration files. (Except for @code{TEXCONFIG}, which defines where |
| 1167 |
the configuration files themselves are found.) |
| 1168 |
|
| 1169 |
@xref{Path specifications,,, kpathsea, Kpathsea}, for details of |
| 1170 |
interpretation of path and other environment variables common to all |
| 1171 |
Kpathsea-using programs. Only the environment variables specific to |
| 1172 |
Dvips are mentioned here. |
| 1173 |
|
| 1174 |
@vtable @code |
| 1175 |
@item DVIPSDEBUG |
| 1176 |
@vindex KPATHSEA_DEBUG |
| 1177 |
Write the absolute path names of any configuration or map files to |
| 1178 |
standard output, for debugging. This isn't done by default because |
| 1179 |
these files are read even before the banner is printed. For |
| 1180 |
voluminous additional debugging, set the environment variable |
| 1181 |
@env{KPATHSEA_DEBUG} to @samp{-1} |
| 1182 |
(@pxref{Debugging,,,kpathsea,Kpathsea}). (If @env{KPATHSEA_DEBUG} is |
| 1183 |
set to any value, it automatically turns on @env{DVIPSDEBUG}.) |
| 1184 |
|
| 1185 |
@item DVIPSFONTS |
| 1186 |
Default path to search for all fonts. Overrides all the font path |
| 1187 |
config file options and other environment variables (@pxref{Supported |
| 1188 |
file formats,,, kpathsea, Kpathsea}). |
| 1189 |
|
| 1190 |
@item DVIPSHEADERS |
| 1191 |
Default path to search for PostScript header files. Overrides the @samp{H} |
| 1192 |
config file option (@pxref{Configuration file commands}). |
| 1193 |
|
| 1194 |
@item DVIPSMAKEPK |
| 1195 |
@pindex mktexpk@r{, changing name} |
| 1196 |
Overrides @samp{mktexpk} as the name of the program to invoke to |
| 1197 |
create missing PK fonts. You can change the arguments passed to the |
| 1198 |
@code{mktexpk} program with the @code{MAKETEXPK} environment |
| 1199 |
variable; @pxref{MakeTeX script arguments,,, kpathsea, Kpathsea}. |
| 1200 |
|
| 1201 |
@item DVIPSRC |
| 1202 |
Specifies the name of the startup file (@pxref{Configuration file |
| 1203 |
searching}) which is read after @file{config.ps} but before any |
| 1204 |
printer-specific configuration files. |
| 1205 |
|
| 1206 |
@item DVIPSSIZES |
| 1207 |
@cindex last-resort font scaling, with @code{DVIPSSIZES} |
| 1208 |
Last-resort sizes for scaling of unfound fonts. Overrides the @samp{R} |
| 1209 |
definition in config files (@pxref{Configuration file commands}). |
| 1210 |
|
| 1211 |
@item PRINTER |
| 1212 |
Determine the default printer configuration file. (Dvips itself does |
| 1213 |
not use @code{PRINTER} to determine the output destination in any way.) |
| 1214 |
|
| 1215 |
@item TEXCONFIG |
| 1216 |
@cindex configuration file path |
| 1217 |
Path to search for Dvips' @file{config.@var{printer}} configuration |
| 1218 |
files, including the base @file{config.ps}. Using this single |
| 1219 |
environment variable, you can override everything else. (The |
| 1220 |
printer-specific configuration files are called @file{@var{printer}.cfg} |
| 1221 |
on MS-DOS, but @file{config.ps} is called by that name on all |
| 1222 |
platforms.) |
| 1223 |
|
| 1224 |
@item TEXPICTS |
| 1225 |
Path to search for included graphics files. Overrides the @samp{S} |
| 1226 |
config file option (@pxref{Configuration file commands}). If not set, |
| 1227 |
@code{TEXINPUTS} is looked for. @xref{Supported file formats,,, |
| 1228 |
kpathsea, Kpathsea}. |
| 1229 |
|
| 1230 |
@end vtable |
| 1231 |
|
| 1232 |
|
| 1233 |
@node Config files |
| 1234 |
@section Dvips configuration files |
| 1235 |
|
| 1236 |
@cindex configuration files |
| 1237 |
|
| 1238 |
This section describes in detail the Dvips-specific @file{config.*} |
| 1239 |
device configuration files (called @file{*.cfg} on MS-DOS), which |
| 1240 |
override the @file{texmf.cnf} |
| 1241 |
configuration files generic to Kpathsea which Dvips also reads |
| 1242 |
(@pxref{Config files,,, kpathsea, Kpathsea}). |
| 1243 |
|
| 1244 |
For information about installing these files, including a prototype file |
| 1245 |
you can copy, @pxref{config.ps installation}. |
| 1246 |
|
| 1247 |
@menu |
| 1248 |
* Configuration file searching:: Where config.* files are searched for. |
| 1249 |
* Configuration file commands:: What can go in a config.* file. |
| 1250 |
@end menu |
| 1251 |
|
| 1252 |
|
| 1253 |
@node Configuration file searching |
| 1254 |
@subsection Configuration file searching |
| 1255 |
|
| 1256 |
@cindex configuration file searching |
| 1257 |
@cindex searching config files, order of |
| 1258 |
|
| 1259 |
The Dvips program loads many different configuration files, so that |
| 1260 |
parameters can be set globally across the system, on a per-device basis, |
| 1261 |
or individually by each user. |
| 1262 |
|
| 1263 |
@enumerate |
| 1264 |
@item |
| 1265 |
@flindex config.ps@r{, searched for} |
| 1266 |
Dvips first reads (if it exists) @file{config.ps}; it is searched for |
| 1267 |
along the path for Dvips configuration files, as described in |
| 1268 |
@ref{Supported file formats,,, kpathsea, Kpathsea}. |
| 1269 |
|
| 1270 |
@item |
| 1271 |
@flindex .dvipsrc@r{, searched for} |
| 1272 |
A user-specific startup file is loaded, so individual users can override |
| 1273 |
any options set in the global file. The environment variable |
| 1274 |
@code{DVIPSRC}, if defined, is used as the specification of the startup |
| 1275 |
file. If this variable is undefined, Dvips uses a platform-specific |
| 1276 |
default name. On Unix Dvips looks for the default startup file under |
| 1277 |
the name @file{$HOME/.dvipsrc}, which is in the user's home directory. |
| 1278 |
On MS-DOS and MS-Windows, where users generally don't have their private |
| 1279 |
directories, the startup file is called @file{dvips.ini} and it is |
| 1280 |
searched for along the path for Dvips configuration files (as described |
| 1281 |
in @ref{Supported file formats,,, kpathsea, Kpathsea}.); users are |
| 1282 |
expected to set this path as they see fit for their taste. |
| 1283 |
|
| 1284 |
@item |
| 1285 |
@opindex -P@var{printer}@r{, and config file searching} |
| 1286 |
The command line is read and parsed: if the @samp{-P@var{device}} option |
| 1287 |
is encountered, at that point @file{config.@var{device}} is loaded. |
| 1288 |
Thus, the printer configuration file can override anything in the |
| 1289 |
site-wide or user configuration file, and it can also override options |
| 1290 |
in the command line up to the point that the @samp{-P} option was |
| 1291 |
encountered. (On MS-DOS, the printer configuration files are called |
| 1292 |
@file{@var{device}.cfg}, since DOS doesn't allow more than 3 characters |
| 1293 |
after the dot in filenames.) |
| 1294 |
|
| 1295 |
@item |
| 1296 |
@vindex PRINTER@r{, and config file searching} |
| 1297 |
If no @samp{-P} option was specified, and also the @samp{-o} and |
| 1298 |
@samp{-f} command line options were not used, Dvips checks the |
| 1299 |
environment variable @code{PRINTER}. If it exists, then |
| 1300 |
@file{config.@var{$PRINTER}} (@file{@var{$PRINTER}.cfg} on MS-DOS) is |
| 1301 |
loaded (if it exists). |
| 1302 |
|
| 1303 |
@end enumerate |
| 1304 |
|
| 1305 |
Because the @file{.dvipsrc} file is read before the printer-specific |
| 1306 |
configuration files, individual users cannot override settings in the |
| 1307 |
latter. On the other hand, the @code{TEXCONFIG} path can be set to |
| 1308 |
anything, so the users can always define their own printer-specific |
| 1309 |
configuration files to be found before the system's. |
| 1310 |
|
| 1311 |
A few command-line options are treated specially, in that they are not |
| 1312 |
overridden by configuration files: |
| 1313 |
|
| 1314 |
@table @samp |
| 1315 |
@item -D |
| 1316 |
As well as setting the resolution, this unsets the mode, if the mode was |
| 1317 |
previously set from a configuration file. If @file{config.$PRINTER} is |
| 1318 |
read, however, any @samp{D} or @samp{M} lines from there will take |
| 1319 |
effect. |
| 1320 |
|
| 1321 |
@item -mode |
| 1322 |
This overrides any mode setting (@samp{M} line) in configuration files. |
| 1323 |
@samp{-mode} does not affect the resolution. |
| 1324 |
|
| 1325 |
@item -o |
| 1326 |
This overrides any output setting (@samp{o} line) in configuration files. |
| 1327 |
|
| 1328 |
@end table |
| 1329 |
|
| 1330 |
The purpose of these special cases is to (1) minimize the chance of |
| 1331 |
having a mismatched mode and resolution (which @samp{mktexpk} cannot |
| 1332 |
resolve), and (2) let command-line options override config files where |
| 1333 |
possible. |
| 1334 |
|
| 1335 |
|
| 1336 |
@node Configuration file commands |
| 1337 |
@subsection Configuration file commands |
| 1338 |
|
| 1339 |
@cindex configuration file options |
| 1340 |
@cindex Dvips configuration file options |
| 1341 |
|
| 1342 |
Most of the configuration file commands are similar to corresponding |
| 1343 |
command line options, but there are a few exceptions. When they are the |
| 1344 |
same, we omit the description here. |
| 1345 |
|
| 1346 |
As with command line options, many may be turned off by suffixing the |
| 1347 |
letter with a zero (@samp{0}). |
| 1348 |
|
| 1349 |
@cindex comments, in configuration files |
| 1350 |
@cindex continuation lines, not supported |
| 1351 |
Within a configuration file, empty lines, and lines starting with a |
| 1352 |
space, asterisk, equal sign, percent sign, or pound sign are ignored. |
| 1353 |
There is no provision for continuation lines. |
| 1354 |
|
| 1355 |
@table @samp |
| 1356 |
@item @@ @var{name hsize vsize} |
| 1357 |
@opindex @@ @r{config command (define paper sizes)} |
| 1358 |
Define paper sizes. @xref{Config file paper sizes}. |
| 1359 |
|
| 1360 |
@item a* |
| 1361 |
@opindex a @r{config command (conserve memory)} |
| 1362 |
Memory conservation. Same as @samp{-a}, @pxref{Option details}. |
| 1363 |
|
| 1364 |
@item b @var{#copies} |
| 1365 |
@opindex b @r{config command (#copies)} |
| 1366 |
Multiple copies. Same as @samp{-b}, @pxref{Option details}. |
| 1367 |
|
| 1368 |
@item bitmapfontenc @var{option} |
| 1369 |
@opindex bitmapfontenc @r{config command (bitmap font encoding)} |
| 1370 |
Turns bitmap font encoding to @samp{off}, @samp{on} (no warnings |
| 1371 |
for missing bitmap font encodings), or @samp{strict} (with warnings |
| 1372 |
for missing bitmap font encodings). |
| 1373 |
|
| 1374 |
@item c @var{filename} |
| 1375 |
@opindex c @r{config command (include another config file)} |
| 1376 |
Include @var{filename} as an additional configuration file, read |
| 1377 |
immediately. |
| 1378 |
|
| 1379 |
@item D @var{dpi} |
| 1380 |
@opindex D @r{config command (dpi)} |
| 1381 |
Output resolution. Same as @samp{-D}, @pxref{Option details}. |
| 1382 |
|
| 1383 |
@item e @var{num} |
| 1384 |
@opindex e @r{config command (maxdrift)} |
| 1385 |
Max drift. Same as @samp{-e}, @pxref{Option details}. |
| 1386 |
|
| 1387 |
@item E @var{command} |
| 1388 |
@opindex E @r{config command (shell escape)} |
| 1389 |
@findex system @r{in config file} |
| 1390 |
@cindex datestamp, in output |
| 1391 |
@cindex shell escape, in config file |
| 1392 |
Executes the command listed with @code{system}(3); can be used to get |
| 1393 |
the current date into a header file for inclusion, for instance. |
| 1394 |
Possibly dangerous; this may be disabled, in which case a warning will |
| 1395 |
be printed if the option is used (and warnings are not suppressed). |
| 1396 |
|
| 1397 |
@item f* |
| 1398 |
@itemx F |
| 1399 |
@opindex f @r{config command (filter)} |
| 1400 |
@opindex F @r{config command (filter)} |
| 1401 |
Run as a filter. Same as @samp{-f}, @pxref{Option details}. |
| 1402 |
|
| 1403 |
@item G* |
| 1404 |
@opindex G @r{config command (character shifting)} |
| 1405 |
Shift low-numbered characters; obsolete. Same as @samp{-G}, |
| 1406 |
@pxref{Option details}. |
| 1407 |
|
| 1408 |
@item h @var{header} |
| 1409 |
@opindex h @r{config command (download additional header)} |
| 1410 |
Prepend @var{header} to output. Same as @samp{h-}; that is, the |
| 1411 |
config file @code{h} directive suppresses any inclusion of standard |
| 1412 |
headers (@pxref{Option details}). |
| 1413 |
|
| 1414 |
@item H @var{path} |
| 1415 |
@opindex H @r{config command (PostScript header path)} |
| 1416 |
@cindex header path, defining |
| 1417 |
@vindex DVIPSHEADERS@r{, overrides} H |
| 1418 |
Use @var{path} to search for PostScript header files. The environment |
| 1419 |
variable @code{DVIPSHEADERS} overrides this. |
| 1420 |
|
| 1421 |
@item i @var{n} |
| 1422 |
@opindex i @r{config command (pages/section)} |
| 1423 |
Make multiple output files. Same as @samp{-i -S @var{n}}, @pxref{Option |
| 1424 |
details}. |
| 1425 |
|
| 1426 |
@item j* |
| 1427 |
@opindex j @r{config command (partial font downloading)} |
| 1428 |
Partially download Type 1 fonts. Same as @samp{-j}, @pxref{Option details}. |
| 1429 |
|
| 1430 |
@item K* |
| 1431 |
@opindex K @r{config command (comment removal)} |
| 1432 |
Remove comments from included PostScript files. Same as @samp{-K}, |
| 1433 |
@pxref{Option details}. |
| 1434 |
|
| 1435 |
@item L* |
| 1436 |
@opindex L @r{config command (last paper size wins)} |
| 1437 |
If zero, the first paper size specified is effective, else the last. |
| 1438 |
Same as @samp{-L}, @pxref{Option details}. |
| 1439 |
|
| 1440 |
@item landscaperotate |
| 1441 |
@opindex landscaperotate @r{config command} |
| 1442 |
Permit rotation of page content to match page size. |
| 1443 |
Same as @samp{-landscaperotate}, @pxref{Option details}. |
| 1444 |
|
| 1445 |
@item m @var{num} |
| 1446 |
@opindex m @r{config command (available memory)} |
| 1447 |
@cindex memory available |
| 1448 |
@cindex printer memory |
| 1449 |
Declare @var{num} as the memory available for fonts and strings in the |
| 1450 |
printer. The compile-time default is 180000, but this is typically |
| 1451 |
overridden by @file{config.ps} or other configuration files. This |
| 1452 |
value must be accurate if memory conservation and document splitting |
| 1453 |
is to work correctly. To determine this value, send the following |
| 1454 |
file to the printer: |
| 1455 |
|
| 1456 |
@example |
| 1457 |
%! Hey, we're PostScript |
| 1458 |
/Times-Roman findfont 30 scalefont setfont 144 432 moveto |
| 1459 |
vmstatus exch sub 40 string cvs show pop showpage |
| 1460 |
@end example |
| 1461 |
|
| 1462 |
@noindent |
| 1463 |
The number printed by this file is the total memory free; it is usually |
| 1464 |
best to tell Dvips that the printer has slightly less memory, because |
| 1465 |
many programs download permanent macros that can reduce the memory in |
| 1466 |
the printer. Some systems or printers can dynamically increase the |
| 1467 |
memory available to a PostScript interpreter, in which case this file |
| 1468 |
might return a ridiculously low number; for example, the NeXT computer |
| 1469 |
and Ghostscript. In these cases, a value of, say, 10 million is |
| 1470 |
likely fine. |
| 1471 |
|
| 1472 |
To go all out: If @var{num} is zero or negative, Dvips sets the |
| 1473 |
available memory to a very large number (the maximum integer value in |
| 1474 |
C), the idea being that output is not to a printer and thus no |
| 1475 |
splitting of the output is desirable. The Dvips config file |
| 1476 |
@file{config.maxmem} is provided to do this conveniently, namely with |
| 1477 |
@samp{dvips -Pmaxmem}. |
| 1478 |
|
| 1479 |
@item M @var{mode} |
| 1480 |
@opindex M @r{config command (mf mode)} |
| 1481 |
Metafont mode. Same as @samp{-mode}, @pxref{Option details}. |
| 1482 |
|
| 1483 |
@item N* |
| 1484 |
@opindex N @r{ config command (disable EPS)} |
| 1485 |
Disable structured comments. Beware: This also turns off displaying |
| 1486 |
page numbers or changing to specific page numbers in PostScript viewers. |
| 1487 |
Same as @samp{-N}, @pxref{Option details}. |
| 1488 |
|
| 1489 |
@item o @var{name} |
| 1490 |
@opindex o @r{config command (output destination)} |
| 1491 |
@cindex output file, setting |
| 1492 |
Send output to @var{name}. Same as @samp{-o}, @pxref{Option details}. |
| 1493 |
In the file @file{config.foo}, a setting like this is probably |
| 1494 |
appropriate: |
| 1495 |
@example |
| 1496 |
o |lpr -Pfoo |
| 1497 |
@end example |
| 1498 |
The MS-DOS version will emulate spooling to @code{lpr} by printing to |
| 1499 |
the local printer device @file{PRN} if it doesn't find an executable |
| 1500 |
program by that name in the current directory or along the @code{PATH}. |
| 1501 |
|
| 1502 |
@item O @var{xoff},@var{yoff} |
| 1503 |
@opindex O @r{config command (page offsets)} |
| 1504 |
Origin offset. Same as @samp{-O}, @pxref{Option details}. |
| 1505 |
|
| 1506 |
@item p @r{[+]}@var{name} |
| 1507 |
@opindex p @r{config command (font aliases)} |
| 1508 |
@cindex PostScript font alias file |
| 1509 |
@cindex resident fonts, different in different printers |
| 1510 |
@kindex +@var{psmapfile} |
| 1511 |
Examine @var{name} for PostScript font aliases. Default is |
| 1512 |
@file{psfonts.map}. This option allows you to specify different resident |
| 1513 |
fonts that different printers may have. If @var{name} starts with a |
| 1514 |
@samp{+} character, then the rest of the name (after any leading spaces) |
| 1515 |
is used as an additional map file; thus, it is possible to have local |
| 1516 |
map files pointed to by local configuration files that append to the |
| 1517 |
global map file. This can be used for font families. |
| 1518 |
|
| 1519 |
@item P @var{path} |
| 1520 |
@opindex P @r{config command (PK path)} |
| 1521 |
@vindex PKFONTS@r{, overrides} P |
| 1522 |
@vindex TEXPKS@r{, overrides} P |
| 1523 |
@vindex GLYPHFONTS@r{, overrides} P |
| 1524 |
@vindex TEXFONTS@r{, overrides} P |
| 1525 |
Use @var{path} to search for bitmap PK font files is @var{path}. The |
| 1526 |
@code{PKFONTS}, @code{TEXPKS}, @code{GLYPHFONTS}, and @code{TEXFONTS} |
| 1527 |
environment variables override this. @xref{Supported file formats,,, |
| 1528 |
kpathsea, Kpathsea}. |
| 1529 |
|
| 1530 |
@item q* |
| 1531 |
@itemx Q |
| 1532 |
@opindex q @r{config command (quiet)} |
| 1533 |
@opindex Q @r{config command (quiet)} |
| 1534 |
Run quietly. Same as @samp{-q}, @pxref{Option details}. |
| 1535 |
|
| 1536 |
@item r* |
| 1537 |
@opindex r @r{config command (page reversal)} |
| 1538 |
Page reversal. Same as @samp{-r}, @pxref{Option details}. |
| 1539 |
|
| 1540 |
@item R @var{num1 num2 @dots{}} |
| 1541 |
@opindex R @r{config command (fallback resolution)} |
| 1542 |
@cindex fallback resolutions |
| 1543 |
@cindex default resolutions |
| 1544 |
@cindex last-resort scaling, with @code{R} |
| 1545 |
Define the list of default resolutions for PK fonts. If a font size |
| 1546 |
actually used in a document is not available and cannot be created, |
| 1547 |
Dvips will scale the font found at the closest of these resolutions to |
| 1548 |
the requested size, using PostScript scaling. The resulting output may |
| 1549 |
be ugly, and thus a warning is issued. To turn this last-resort scaling |
| 1550 |
off, use a line with just the @samp{R} and no numbers. |
| 1551 |
|
| 1552 |
The given numbers must be sorted in increasing order; any number smaller |
| 1553 |
than the preceding one is ignored. This is because it is better to |
| 1554 |
scale a font up than down; scaling down can obliterate small features in |
| 1555 |
the character shape. |
| 1556 |
|
| 1557 |
@vindex DVIPSSIZES@r{, overrides} R |
| 1558 |
@vindex TEXSIZES@r{, overrides} R |
| 1559 |
The environment and config file values @samp{DVIPSSIZES} or |
| 1560 |
@samp{TEXSIZES} override this configuration file setting. |
| 1561 |
|
| 1562 |
@vindex default_texsizes @r{Make variable} |
| 1563 |
If no @samp{R} settings or environment variables are specified, a list |
| 1564 |
compiled in during installation is used. This default list is defined by |
| 1565 |
the Makefile variable @samp{default_texsizes}, defined in the file |
| 1566 |
@file{make/paths.make}. |
| 1567 |
|
| 1568 |
@item s* |
| 1569 |
@opindex s @r{config command (global save/restore)} |
| 1570 |
Output global save/restore. Same as @samp{-s}, @pxref{Option details}. |
| 1571 |
|
| 1572 |
@item S @var{path} |
| 1573 |
@opindex S @r{config command (pict path)} |
| 1574 |
@vindex TEXPICTS@r{, overrides} S |
| 1575 |
@vindex TEXINPUTS@r{, overrides} S |
| 1576 |
Use @var{path} to search for special illustrations (Encapsulated |
| 1577 |
PostScript files or psfiles). The @code{TEXPICTS} and then |
| 1578 |
@code{TEXINPUTS} environment variables override this. |
| 1579 |
|
| 1580 |
@item T @var{path} |
| 1581 |
@opindex T @r{config command (TFM path)} |
| 1582 |
@vindex TFMFONTS@r{, overrides} T |
| 1583 |
@vindex TEXFONTS@r{, overrides} T |
| 1584 |
Use @var{path} to search for TFM files. The @code{TFMFONTS} and then |
| 1585 |
@code{TEXFONTS} environment variables overrides this. This path is used |
| 1586 |
for resident fonts and fonts that can't otherwise be found. |
| 1587 |
|
| 1588 |
@item U* |
| 1589 |
@opindex U @r{config command (Xerox 4045)} |
| 1590 |
Work around bug in Xerox 4045 printer. Same as @samp{-U}, @pxref{Option |
| 1591 |
details}. |
| 1592 |
|
| 1593 |
@item V @var{path} |
| 1594 |
@opindex V @r{config command (vf path)} |
| 1595 |
@cindex virtual font path |
| 1596 |
@cindex device dependency, and virtual fonts |
| 1597 |
Use @var{path} to search for virtual font files. This may be |
| 1598 |
device-dependent if you use virtual fonts to simulate actual fonts on |
| 1599 |
different devices. |
| 1600 |
|
| 1601 |
@item W @r{[@var{string}]} |
| 1602 |
@opindex W @r{config command (emit warning)} |
| 1603 |
@cindex warning messages, defining |
| 1604 |
If @var{string} is supplied, write it to standard error after reading |
| 1605 |
all the configuration files; with no @var{string}, cancel any previous |
| 1606 |
@samp{W} message. This is useful in the default configuration file to |
| 1607 |
remind users to specify a printer, for instance, or to notify users |
| 1608 |
about special characteristics of a particular printer. |
| 1609 |
|
| 1610 |
@item X @var{num} |
| 1611 |
@opindex X @r{config command (horizontal resolution)} |
| 1612 |
Horizontal resolution. Same as @samp{-X} (@pxref{Option details}). |
| 1613 |
|
| 1614 |
@item Y @var{num} |
| 1615 |
@opindex Y @r{config command (vertical resolution)} |
| 1616 |
Vertical resolution. Same as @samp{-Y} (@pxref{Option details}). |
| 1617 |
|
| 1618 |
@item Z* |
| 1619 |
@opindex Z @r{config command (compress fonts)} |
| 1620 |
Compress bitmap fonts. Same as @samp{-Z} (@pxref{Option details}). |
| 1621 |
|
| 1622 |
@item z* |
| 1623 |
@opindex z @r{config command (secure mode)} |
| 1624 |
Disables execution of system commands, like @samp{-R} |
| 1625 |
(@pxref{Option details}). If @samp{-R} is specified |
| 1626 |
on the command line, that takes precedence. |
| 1627 |
|
| 1628 |
@end table |
| 1629 |
|
| 1630 |
|
| 1631 |
@node Paper size and landscape |
| 1632 |
@chapter Paper size and landscape orientation |
| 1633 |
|
| 1634 |
@cindex paper size, general |
| 1635 |
|
| 1636 |
Most @TeX{} documents at a particular site are designed to use the |
| 1637 |
local standard paper size (letter size in the United States, A4 |
| 1638 |
elsewhere). The Dvips program can be customized either sitewide or |
| 1639 |
for a particular printer. |
| 1640 |
|
| 1641 |
@cindex landscape orientation, defined |
| 1642 |
@cindex portrait orientation, defined |
| 1643 |
On the other hand, plenty of documents are designed for other paper |
| 1644 |
sizes. For instance, you may want to design a document that has the |
| 1645 |
long edge of the paper horizontal. This can be useful when |
| 1646 |
typesetting booklets, brochures, complex tables, or many other |
| 1647 |
documents. This type of paper orientation is called @dfn{landscape} |
| 1648 |
orientation (the default orientation is called @dfn{portrait}). |
| 1649 |
Alternatively, a document might be designed for ledger or A3 paper. |
| 1650 |
|
| 1651 |
Since the intended paper size in these cases is a document design |
| 1652 |
decision, not a printing decision, such information should be given in |
| 1653 |
the @TeX{} file and not on the Dvips command line. For this reason, |
| 1654 |
Dvips supports a @samp{papersize} special. It is hoped that this |
| 1655 |
special will become standard over time for @TeX{} previewers and other |
| 1656 |
printer drivers. |
| 1657 |
|
| 1658 |
Some @LaTeX{} packages, e.g., @samp{hyperref.sty}, write a |
| 1659 |
@samp{papersize} special into the DVI file. In this case, you need |
| 1660 |
not and should not attempt to override it manually. |
| 1661 |
|
| 1662 |
@menu |
| 1663 |
* @samp{papersize} special:: Specifying the paper size in TeX. |
| 1664 |
* Config file paper sizes:: Specifying printer- and site-specific sizes. |
| 1665 |
* Paper trays:: Changing paper trays automatically. |
| 1666 |
@end menu |
| 1667 |
|
| 1668 |
|
| 1669 |
@node @samp{papersize} special |
| 1670 |
@section @samp{papersize} special |
| 1671 |
|
| 1672 |
@findex papersize @r{special} |
| 1673 |
|
| 1674 |
The format of the @samp{papersize} special is |
| 1675 |
|
| 1676 |
@example |
| 1677 |
\special@{papersize=@var{width},@var{height}@} |
| 1678 |
@end example |
| 1679 |
|
| 1680 |
@noindent |
| 1681 |
@var{width} is the horizontal size of the page, and @var{height} is the |
| 1682 |
vertical size. The dimensions supported are the same as for @TeX{}; |
| 1683 |
namely, in (inches), cm (centimeters), mm (millimeters), pt (points), sp |
| 1684 |
(scaled points), bp (big points, the same as the default PostScript |
| 1685 |
unit), pc (picas), dd (didot points), and cc (ciceros). |
| 1686 |
|
| 1687 |
@findex landscape@r{, as @code{\special}} |
| 1688 |
For a US letter size landscape document, the @samp{papersize} would be: |
| 1689 |
@example |
| 1690 |
\special@{papersize=11in,8.5in@} |
| 1691 |
@end example |
| 1692 |
|
| 1693 |
@noindent |
| 1694 |
An alternate specification of @code{landscape}: |
| 1695 |
@example |
| 1696 |
\special@{landscape@} |
| 1697 |
@end example |
| 1698 |
|
| 1699 |
@noindent |
| 1700 |
This is supported for backward compatibility, but it is hoped that |
| 1701 |
eventually the @samp{papersize} comment will dominate. |
| 1702 |
|
| 1703 |
Of course, such a @code{\special} only informs Dvips of the desired |
| 1704 |
paper size; you must also adjust @code{\hsize} and @code{\vsize} in your |
| 1705 |
@TeX{} document typeset to those dimensions. |
| 1706 |
|
| 1707 |
@findex unknown@r{, paper format for @samp{-t}} |
| 1708 |
When using the @samp{papersize} special, you generally should not also |
| 1709 |
specify @code{-t} on the command line (@pxref{Option details}). The |
| 1710 |
exception is when using a nonstandard paper size that isn't |
| 1711 |
predefined; in this case, use @code{-t@tie{}unknown}. |
| 1712 |
|
| 1713 |
The @samp{papersize} special must occur somewhere on the first page of |
| 1714 |
the document. Some packages, notably @samp{hyperref}, insert this special. |
| 1715 |
|
| 1716 |
By default, if a DVI file contains multiple @samp{papersize} specials, |
| 1717 |
the last one wins; this is also the behavior of the @code{dvipdfmx} |
| 1718 |
driver. If the @code{-L0} command line option or @code{L0} config |
| 1719 |
file command is specified, the first special wins---this was the |
| 1720 |
behavior of Dvips prior to the 2017 release. |
| 1721 |
|
| 1722 |
|
| 1723 |
@node Config file paper sizes |
| 1724 |
@section Configuration file paper size command |
| 1725 |
|
| 1726 |
@cindex paper size configuration file command |
| 1727 |
@cindex configuration file paper size command |
| 1728 |
|
| 1729 |
The @samp{@@} command in a configuration file sets the paper size |
| 1730 |
defaults and options. The first @samp{@@} command defines the default |
| 1731 |
paper size. It has three possible parameters: |
| 1732 |
|
| 1733 |
@example |
| 1734 |
@@ @r{[}@var{name} @r{[}@var{hsize} @var{vsize}@r{]]} |
| 1735 |
@end example |
| 1736 |
|
| 1737 |
If @samp{@@} is specified on a line by itself, with no parameters, it |
| 1738 |
instructs Dvips to discard all previous paper size information (possibly |
| 1739 |
from another configuration file). |
| 1740 |
|
| 1741 |
If three parameters are given, with the first parameter being a name and |
| 1742 |
the second and third being a dimension (as in @samp{8.5in} or |
| 1743 |
@samp{3.2cc}, just like in the @samp{papersize} special), then the |
| 1744 |
option is interpreted as starting a new paper size description, where |
| 1745 |
@var{name} is the name and @var{hsize} and @var{vsize} define the |
| 1746 |
horizontal and vertical size of the sheet of paper, respectively. For |
| 1747 |
example: |
| 1748 |
|
| 1749 |
@example |
| 1750 |
@@ letterSize 8.5in 11in |
| 1751 |
@end example |
| 1752 |
|
| 1753 |
If both @var{hsize} and @var{vsize} are zero (you must still specify |
| 1754 |
units!)@: then any page size will match. If the @samp{@@} character is |
| 1755 |
immediately followed by a @samp{+} sign, then the remainder of the line |
| 1756 |
(after skipping any leading blanks) is treated as PostScript code to |
| 1757 |
send to the printer, presumably to select that particular paper size: |
| 1758 |
|
| 1759 |
@example |
| 1760 |
@@ letter 8.5in 11in |
| 1761 |
@@+ %%BeginPaperSize: Letter |
| 1762 |
@@+ letter |
| 1763 |
@@+ %%EndPaperSize |
| 1764 |
@end example |
| 1765 |
|
| 1766 |
After all that, if the first character of the line is an exclamation |
| 1767 |
point, then the line is put in the initial comments section of the final |
| 1768 |
output file; else, it is put in the setup section of the output file. |
| 1769 |
For example: |
| 1770 |
|
| 1771 |
@example |
| 1772 |
@@ legal 8.5in 14in |
| 1773 |
@@+ ! %%DocumentPaperSizes: Legal |
| 1774 |
@@+ %%BeginPaperSize: Legal |
| 1775 |
@@+ legal |
| 1776 |
@@+ %%EndPaperSize |
| 1777 |
@end example |
| 1778 |
|
| 1779 |
When Dvips has a paper format name given on the command line, it looks |
| 1780 |
for a match by the @var{name}; when it has a @samp{papersize} special, |
| 1781 |
it looks for a match by dimensions. The best match found (from the |
| 1782 |
paper size information in the configuration file) is used. The |
| 1783 |
dimensions must match within 5bp. |
| 1784 |
|
| 1785 |
If nothing matches, a warning is printed and the first paper size with |
| 1786 |
zero dimensions is used; this should be the @code{unknown} paper size |
| 1787 |
definition mentioned below, resulting in the actual dimensions being |
| 1788 |
used. |
| 1789 |
|
| 1790 |
@cindex landscaperotate configuration file command |
| 1791 |
@cindex landscaperotate command line option |
| 1792 |
In versions of Dvips prior to 2022.1, if the paper size specified did |
| 1793 |
not match one of the defined paper sizes, Dvips considered rotated |
| 1794 |
page content and rotated paper sizes for a match. This provided some |
| 1795 |
automatic support for landscape mode on raw printers, but today it can |
| 1796 |
be harmful when generating PDF. (Specifically, the @samp{/MediaBox} |
| 1797 |
then ends up with rotated values, which is not expected by PDF |
| 1798 |
viewers, e.g., when a document intentionally has a single page |
| 1799 |
rotated.) |
| 1800 |
|
| 1801 |
Further, on all recent computer systems, this facility is typically |
| 1802 |
provided instead by a print spooler that considers the bounding box of |
| 1803 |
the document and inserts appropriate media selection commands as part |
| 1804 |
of the print job. So, this automatic rotation is no longer done by |
| 1805 |
default by Dvips. If you want to enable it, the |
| 1806 |
@samp{-landscaperotate} command line option or @samp{landscaperotate} |
| 1807 |
configuration file option can be used. @xref{Option details}. |
| 1808 |
|
| 1809 |
@cindex zero dimensions and setting paper size |
| 1810 |
If your printer has a command to set a special paper size, then give |
| 1811 |
dimensions of @samp{0in 0in}; the PostScript code that sets the paper |
| 1812 |
size can refer to the dimensions the user requested as @samp{hsize} |
| 1813 |
and @samp{vsize}; these will be macros defined in the PostScript that |
| 1814 |
return the requested size in default PostScript units. Also, some |
| 1815 |
printers want @samp{BeginPaperSize} comments and paper size setting |
| 1816 |
commands; others (such as the NeXT) want @samp{PaperSize} comments and |
| 1817 |
they will handle setting the paper size. So paper size entries should |
| 1818 |
typically specify both. |
| 1819 |
|
| 1820 |
@findex unknown@r{, paper format for @samp{-t}} |
| 1821 |
When using a paper size that is not already defined in |
| 1822 |
@file{config.ps}, you probably want to say @samp{-t@tie{}unknown} on |
| 1823 |
the command line; the @code{unknown} paper size definition in |
| 1824 |
@file{config.ps} has the requisite PostScript incantation to set the |
| 1825 |
PostScript page size, as just described. |
| 1826 |
|
| 1827 |
@findex nopaper@r{, paper format for @samp{-t}} |
| 1828 |
If you want no paper size information in the output at all, use |
| 1829 |
@samp{-t@tie{}nopaper}. This is useful with multi-page output that |
| 1830 |
will be processed further. If you just have a single page document, |
| 1831 |
you can use @samp{-E} to get pure EPSF output. |
| 1832 |
|
| 1833 |
@flindex mkdvipspapers |
| 1834 |
The Perl 5 script @file{contrib/configs/mkdvipspapers} in the |
| 1835 |
distribution directory may help in determining appropriate paper size |
| 1836 |
definitions. |
| 1837 |
|
| 1838 |
@flindex config.ps @r{paper sizes} |
| 1839 |
@findex letter @r{paper size} |
| 1840 |
@findex a4 @r{paper size} |
| 1841 |
Notwithstanding the above, the default @code{letter} and @code{a4} |
| 1842 |
paper size definitions in @file{config.ps} execute the |
| 1843 |
@code{setpagedevice} operator if it exists (it was defined in |
| 1844 |
PostScript Level@tie{}2), or the @samp{letter} or @samp{a4} operator |
| 1845 |
if they exist (they are nonstandard and thus perhaps cause failures on |
| 1846 |
certain (unknown) printers). Not executing any page size definition |
| 1847 |
at all confuses PostScript conversion programs such as |
| 1848 |
@command{ps2pdf}, so we want to execute one if we can. |
| 1849 |
|
| 1850 |
@findex letterSize @r{paper size} |
| 1851 |
@findex A4size @r{paper size} |
| 1852 |
The @code{letterSize} and @code{A4Size} paper size definitions are now |
| 1853 |
synonyms for @code{letter} and @code{a4}. |
| 1854 |
|
| 1855 |
|
| 1856 |
@node Paper trays |
| 1857 |
@section Paper trays |
| 1858 |
|
| 1859 |
@cindex paper trays |
| 1860 |
@cindex dual paper trays |
| 1861 |
@cindex multiple paper trays |
| 1862 |
@cindex HP4Si printer and paper trays |
| 1863 |
|
| 1864 |
@findex bop-hook |
| 1865 |
Some printers, such as the Hewlett-Packard HP4si, have multiple paper |
| 1866 |
trays. You can set up Dvips to take advantage of this using the |
| 1867 |
@code{bop-hook} PostScript variable (@pxref{PostScript hooks}). |
| 1868 |
|
| 1869 |
@cindex letterhead tray |
| 1870 |
For example, suppose you have an alternate tray stocked with letterhead |
| 1871 |
paper; the usual tray has the usual paper. You have a document where |
| 1872 |
you want the first page printed on letterhead, and the remaining pages |
| 1873 |
on the usual paper. You can create a header file, say |
| 1874 |
@file{firstletterhead.PS}, with the following (PostScript) code |
| 1875 |
(@code{bop-hook} is passed the current physical page number, which |
| 1876 |
starts at zero): |
| 1877 |
|
| 1878 |
@example |
| 1879 |
/bop-hook @{ dup 0 eq @{ @var{alternatetray} @} @{ @var{normaltray} @} ifelse @} def |
| 1880 |
@end example |
| 1881 |
|
| 1882 |
@noindent where @var{alternatetray} and @var{normaltray} are the appropriate |
| 1883 |
commands to select the paper trays. On the 4SI, @var{alternatetray} is |
| 1884 |
@samp{statusdict begin 1 setpapertray end} and @var{normaltray} is |
| 1885 |
@samp{statusdict begin 0 setpapertray end}. |
| 1886 |
|
| 1887 |
Then, include the file with either |
| 1888 |
@itemize @bullet |
| 1889 |
@item the @samp{-h} command-line option (@pxref{Option details}); or |
| 1890 |
|
| 1891 |
@item the @samp{h} config file option (@pxref{Configuration file |
| 1892 |
commands}); or |
| 1893 |
|
| 1894 |
@item @samp{\special@{header=@var{file}@}} in your @TeX{} document |
| 1895 |
(@pxref{Including headers from TeX,, Including headers from @TeX{}}). |
| 1896 |
|
| 1897 |
@end itemize |
| 1898 |
|
| 1899 |
|
| 1900 |
@node Interaction with PostScript |
| 1901 |
@chapter Interaction with PostScript |
| 1902 |
|
| 1903 |
@cindex interaction with PostScript |
| 1904 |
@cindex PostScript interaction |
| 1905 |
|
| 1906 |
Dvips supports inclusion of PostScript figure files (e.g., Encapsulated |
| 1907 |
PostScript), downloading other header files (e.g., fonts), including |
| 1908 |
literal PostScript code, and hypertext. |
| 1909 |
|
| 1910 |
@menu |
| 1911 |
* PostScript figures:: Including an Encapsulated PostScript figure. |
| 1912 |
* Header files:: Downloading extra definitions. |
| 1913 |
* Literal PS:: Writing literal PostScript code. |
| 1914 |
* Hypertext:: Producing HyperPostScript to make PDF. |
| 1915 |
@end menu |
| 1916 |
|
| 1917 |
|
| 1918 |
@node PostScript figures |
| 1919 |
@section PostScript figures |
| 1920 |
|
| 1921 |
Scaling and including PostScript graphics is a breeze---if the PostScript |
| 1922 |
file is correctly formed. Even if it is not, however, the file can usually |
| 1923 |
be accommodated with just a little more work. |
| 1924 |
|
| 1925 |
@menu |
| 1926 |
* Bounding box:: The %%BoundingBox EPS comment. |
| 1927 |
* \includegraphics:: The LaTeX \includegraphics macro. |
| 1928 |
* EPSF macros:: Including the file in TeX. |
| 1929 |
* psfile special:: The basic special. |
| 1930 |
* Dynamic creation of graphics:: Handling compressed or generated figures. |
| 1931 |
* Fonts in figures:: The %*Font comment. |
| 1932 |
@end menu |
| 1933 |
|
| 1934 |
|
| 1935 |
@node Bounding box |
| 1936 |
@subsection The bounding box comment |
| 1937 |
|
| 1938 |
@cindex bounding box, comment for |
| 1939 |
|
| 1940 |
The most important feature of a good PostScript file from the standpoint |
| 1941 |
of including it in another document is an accurate bounding box comment. |
| 1942 |
Every well-formed PostScript file has a comment describing where on the |
| 1943 |
page the graphic is located, and how big that graphic is. |
| 1944 |
|
| 1945 |
@cindex big points |
| 1946 |
@cindex PostScript units |
| 1947 |
@cindex bounding box, defined |
| 1948 |
This information is given as the lower left and upper right corners of |
| 1949 |
the box just enclosing the graphic, and is thus referred to as the |
| 1950 |
@dfn{bounding box}. These coordinates are given in the default |
| 1951 |
PostScript units (there are precisely 72 PostScript units to the inch, |
| 1952 |
like @TeX{} big points) with respect to the lower left corner of the |
| 1953 |
sheet of paper. |
| 1954 |
|
| 1955 |
@findex %%BoundingBox |
| 1956 |
To see if a PostScript file has a bounding box comment, just look at the |
| 1957 |
first few lines of the file. PostScript files are standard ASCII, so |
| 1958 |
you can use any text editor to do this. If within the first few dozen |
| 1959 |
lines there is a line like |
| 1960 |
|
| 1961 |
@example |
| 1962 |
%%BoundingBox: 25 50 400 300 |
| 1963 |
@end example |
| 1964 |
|
| 1965 |
@noindent |
| 1966 |
(with any reasonable numbers), chances are very good that the file is |
| 1967 |
Encapsulated PostScript and will work easily with Dvips. If the file |
| 1968 |
contains instead a line like |
| 1969 |
|
| 1970 |
@findex atend@r{, bounding box specification} |
| 1971 |
@findex (atend)@r{, bounding box specification} |
| 1972 |
@example |
| 1973 |
%%BoundingBox: (atend) |
| 1974 |
@end example |
| 1975 |
|
| 1976 |
@noindent |
| 1977 |
the file is still probably Encapsulated PostScript, but the bounding box |
| 1978 |
is given at the end of the file. Dvips needs it at the beginning. You |
| 1979 |
can move it with that same text editor, or a simple script. (The |
| 1980 |
bounding box is given in this way when the program that generated the |
| 1981 |
PostScript couldn't know the size in advance, or was too lazy to compute |
| 1982 |
it.) |
| 1983 |
|
| 1984 |
@pindex bbfig |
| 1985 |
@cindex bounding box, determining |
| 1986 |
If the document lacks a @samp{%%BoundingBox:} altogether, you can |
| 1987 |
determine one in a couple of ways. One is to use the @samp{bbfig} |
| 1988 |
program distributed with Dvips in the @file{contrib} directory. This can |
| 1989 |
usually find the correct bounding box automatically; it works best with |
| 1990 |
Ghostscript. |
| 1991 |
|
| 1992 |
@vindex 612 792 @r{bounding box size} |
| 1993 |
If the comment looks like this: |
| 1994 |
@example |
| 1995 |
%%BoundingBox: 0 0 612 792 |
| 1996 |
@end example |
| 1997 |
|
| 1998 |
@noindent |
| 1999 |
the graphic claims to take up an entire sheet of paper. This is |
| 2000 |
usually a symptom of a bug in the program that generated it. |
| 2001 |
|
| 2002 |
The other is to do it yourself: print the file. Now, take a ruler, and |
| 2003 |
make the following measurements (in PostScript units, so measure in |
| 2004 |
inches and multiply by 72): From the left edge of the paper to the |
| 2005 |
leftmost mark on the paper is @var{llx}, the first number. From the |
| 2006 |
bottom edge of the paper to the bottommost mark on the paper is |
| 2007 |
@var{lly}, the second number. From the left edge of the paper to the |
| 2008 |
rightmost mark on the paper is @var{urx}, the third number. The fourth |
| 2009 |
and final number, @var{ury}, is the distance from the bottom of the page |
| 2010 |
to the uppermost mark on the paper. |
| 2011 |
|
| 2012 |
Once you have the numbers, add a comment of the following form as the |
| 2013 |
second line of the document. (The first line should already be a line |
| 2014 |
starting with the two characters @samp{%!}; if it is not, the file |
| 2015 |
probably isn't PostScript.) |
| 2016 |
|
| 2017 |
@example |
| 2018 |
%%BoundingBox: @var{llx} @var{lly} @var{urx} @var{ury} |
| 2019 |
@end example |
| 2020 |
|
| 2021 |
@noindent |
| 2022 |
Or, if you don't want to modify the file, you can simply write these |
| 2023 |
numbers down in a convenient place and give them in your @TeX{} document |
| 2024 |
when you import the graphic, as described in the next section. |
| 2025 |
|
| 2026 |
If the document does not have such a bounding box, or if the bounding |
| 2027 |
box is given at the end of the document, or the bounding box is wrong, |
| 2028 |
please complain to the authors of the software package that generated |
| 2029 |
the file. |
| 2030 |
|
| 2031 |
|
| 2032 |
@node \includegraphics |
| 2033 |
@subsection The \includegraphics macro for @LaTeX{} |
| 2034 |
|
| 2035 |
@cindex \includegraphics @LaTeX{} macro |
| 2036 |
@cindex macros for epsf inclusion |
| 2037 |
|
| 2038 |
Once the figure file has a bounding box comment (see the previous |
| 2039 |
section) you are ready to import the graphic into a La@TeX{} |
| 2040 |
document. For @LaTeX{}2e, you can use the epsf, graphics or graphicx |
| 2041 |
packages, but the last is recommended---it has the most flexible |
| 2042 |
syntax, and is briefly described here. Further information can be |
| 2043 |
found in @file{grfguide} or @file{epslatex}, which should be included |
| 2044 |
in your @LaTeX{} distribution in DVI, PDF, or other formats. (If you |
| 2045 |
are still using La@TeX{} 2.09, use epsf.sty). |
| 2046 |
|
| 2047 |
Just put the following command into your preamble: |
| 2048 |
|
| 2049 |
@example |
| 2050 |
\usepackage[dvips]@{graphicx@} |
| 2051 |
@end example |
| 2052 |
|
| 2053 |
Depending on your system, a suitable driver setup may already be |
| 2054 |
present, so that @LaTeX{} automatically produces DVI files suitable for |
| 2055 |
Dvips. In this case you can leave out the @samp{[dvips]} parameter. |
| 2056 |
|
| 2057 |
Now, at the point you want to include a file @file{foo.eps}, enter a |
| 2058 |
line such as: |
| 2059 |
|
| 2060 |
@example |
| 2061 |
\includegraphics@{foo.eps@} |
| 2062 |
@end example |
| 2063 |
|
| 2064 |
However, it is usually best to omit the file extension and only use |
| 2065 |
|
| 2066 |
@example |
| 2067 |
\includegraphics@{foo@} |
| 2068 |
@end example |
| 2069 |
|
| 2070 |
@noindent because then you can process the same LaTeX file with |
| 2071 |
different @TeX{} engines or DVI converters if you also provide |
| 2072 |
suitable graphics files for them, e.g., @file{foo.pdf} or |
| 2073 |
@file{foo.png}. |
| 2074 |
|
| 2075 |
@cindex bounding box, supplying to @TeX{} |
| 2076 |
The \includegraphics command has many options, specified in |
| 2077 |
@samp{key=value} syntax, to allow you to resize, rotate or trim the |
| 2078 |
included graphic---see @file{grfguide} or @file{epslatex}. If your |
| 2079 |
file does not have a bounding box comment, you can supply the numbers |
| 2080 |
as determined in the previous section, in the same order they would |
| 2081 |
have been in a normal bounding box comment: |
| 2082 |
|
| 2083 |
@example |
| 2084 |
\includegraphics[bb=100 100 500 500]@{foo.ps@} |
| 2085 |
@end example |
| 2086 |
|
| 2087 |
@noindent |
| 2088 |
Now, save your changes and run @LaTeX{} and Dvips; the output should |
| 2089 |
have your graphic positioned at precisely the point you indicated, |
| 2090 |
occupying the proper amount of space. |
| 2091 |
|
| 2092 |
PostScript graphics have their origin in the lower left |
| 2093 |
corner. Therefore, in @TeX{}, a graphic will occupy a box that extends |
| 2094 |
far above the line where it is put in, but has depth zero below it. |
| 2095 |
Combining @samp{\includegraphics} with @samp{\parbox} commands or |
| 2096 |
minipages can sometimes be confusing when this is not taken into |
| 2097 |
account. |
| 2098 |
|
| 2099 |
|
| 2100 |
@node EPSF macros |
| 2101 |
@subsection Using the EPSF macros |
| 2102 |
|
| 2103 |
@cindex EPSF macros |
| 2104 |
@cindex macros for epsf inclusion |
| 2105 |
|
| 2106 |
If you are using @LaTeX{}2e, use the @samp{graphics} or @samp{graphicx} |
| 2107 |
package. @xref{\includegraphics}. |
| 2108 |
|
| 2109 |
If you are using plain @TeX{} or La@TeX{} 2.09, you need @file{epsf.tex} |
| 2110 |
(for plain @TeX{}) and @file{epsf.sty} (for La@TeX{}). For plain |
| 2111 |
@TeX{}, add a line like this near the top of your input file: |
| 2112 |
|
| 2113 |
@flindex epsf.tex |
| 2114 |
@example |
| 2115 |
\input epsf |
| 2116 |
@end example |
| 2117 |
|
| 2118 |
@noindent |
| 2119 |
@flindex epsf.sty |
| 2120 |
If you are using @LaTeX{} 2.09, add the @samp{epsf} style option, as in: |
| 2121 |
|
| 2122 |
@example |
| 2123 |
\documentstyle[12pt,epsf]@{article@} |
| 2124 |
@end example |
| 2125 |
|
| 2126 |
@noindent |
| 2127 |
In any case, the above only needs to be done once, no matter how many |
| 2128 |
figures you plan to include. |
| 2129 |
|
| 2130 |
Now, at the point you want to include a file, enter a line such as: |
| 2131 |
|
| 2132 |
@example |
| 2133 |
\epsffile@{foo.eps@} |
| 2134 |
@end example |
| 2135 |
|
| 2136 |
@findex \leavevmode |
| 2137 |
@cindex bounding box, supplying to @TeX{} |
| 2138 |
If you are using @LaTeX{}, you may need to add @code{\leavevmode} |
| 2139 |
immediately before the @code{\epsffile} command to get certain |
| 2140 |
environments to work correctly. If your file does not have a bounding |
| 2141 |
box comment, you can supply the numbers as determined in the previous |
| 2142 |
section, in the same order they would have been in a normal bounding box |
| 2143 |
comment: |
| 2144 |
|
| 2145 |
@example |
| 2146 |
\epsffile[100 100 500 500]@{foo.ps@} |
| 2147 |
@end example |
| 2148 |
|
| 2149 |
@noindent |
| 2150 |
Now, save your changes and run @TeX{} and Dvips; the output should have |
| 2151 |
your graphic positioned at precisely the point you indicated, occupying |
| 2152 |
the proper amount of space. |
| 2153 |
|
| 2154 |
@findex \epsffile @r{macro} |
| 2155 |
@cindex figures, natural size |
| 2156 |
The @code{\epsffile} macro typesets the figure as a @TeX{} @code{\vbox} |
| 2157 |
at the point of the page that the command is executed. By default, the |
| 2158 |
graphic will have its `natural' width (namely, the width of its bounding |
| 2159 |
box). The @TeX{} box will have depth zero and its natural height. By |
| 2160 |
default, the graphic will be scaled by any DVI magnification in effect, |
| 2161 |
just as is everything else in your document. See the next section for |
| 2162 |
more information on scaling. |
| 2163 |
|
| 2164 |
@vindex \epsfverbosetrue |
| 2165 |
@cindex verbose EPSF processing |
| 2166 |
If you want @TeX{} to report the size of the figure as a message on your |
| 2167 |
terminal when it processes each figure, give the command: |
| 2168 |
|
| 2169 |
@example |
| 2170 |
\epsfverbosetrue |
| 2171 |
@end example |
| 2172 |
|
| 2173 |
@menu |
| 2174 |
* EPSF scaling:: |
| 2175 |
* EPSF clipping:: |
| 2176 |
@end menu |
| 2177 |
|
| 2178 |
|
| 2179 |
@node EPSF scaling |
| 2180 |
@subsubsection EPSF scaling |
| 2181 |
|
| 2182 |
@cindex scaling of figures |
| 2183 |
@cindex figures, scaling |
| 2184 |
|
| 2185 |
Usually, you will want to scale an EPSF figure to some size appropriate |
| 2186 |
for your document, since its natural size is determined by the creator |
| 2187 |
of the EPS file. |
| 2188 |
|
| 2189 |
The best way to do this is to assign the desired size to the @TeX{} |
| 2190 |
@code{\epsfxsize} or @code{\epsfysize} variables, whichever is more |
| 2191 |
convenient for you. That is, put |
| 2192 |
|
| 2193 |
@vindex \epsfxsize |
| 2194 |
@example |
| 2195 |
\epsfxsize=@var{dimen} |
| 2196 |
@end example |
| 2197 |
|
| 2198 |
@noindent |
| 2199 |
right before the call to @code{\epsffile}. Then the width of the @TeX{} |
| 2200 |
box will be @var{dimen} and its height will be scaled proportionately. |
| 2201 |
Similarly, you can set the vertical size with |
| 2202 |
|
| 2203 |
@vindex \epsfysize |
| 2204 |
@example |
| 2205 |
\epsfysize=@var{dimen} |
| 2206 |
@end example |
| 2207 |
|
| 2208 |
@noindent |
| 2209 |
in which case the height will be set and the width scaled |
| 2210 |
proportionally. |
| 2211 |
|
| 2212 |
If you set both, both will be honored, but the aspect ratio of the |
| 2213 |
included graphic may necessarily be distorted, i.e., its contents |
| 2214 |
stretched in one direction or the other. |
| 2215 |
|
| 2216 |
@findex \epsfsize |
| 2217 |
You can resize graphics in a more general way by redefining the |
| 2218 |
@code{\epsfsize} macro. @code{\epsffile} calls this with two |
| 2219 |
parameters: the natural horizontal and vertical sizes of the PostScript |
| 2220 |
graphic. @code{\epsfsize} must expand to the desired horizontal size, |
| 2221 |
that is, the width of the @code{\vbox}. Schematically: |
| 2222 |
|
| 2223 |
@example |
| 2224 |
\def\epsfsize#1#2@{@var{body}@} |
| 2225 |
@end example |
| 2226 |
|
| 2227 |
Some useful definitions of @var{body}: |
| 2228 |
|
| 2229 |
@table @samp |
| 2230 |
@item \epsfxsize |
| 2231 |
This definition (the default) enables the default features listed above, |
| 2232 |
by setting @code{\epsfxsize} to the same value it had before the macro |
| 2233 |
was called. |
| 2234 |
|
| 2235 |
@item #1 |
| 2236 |
Force the natural size by returning the first parameter (the original |
| 2237 |
width). |
| 2238 |
|
| 2239 |
@item 0pt |
| 2240 |
A special case, equivalent to @samp{#1}. |
| 2241 |
|
| 2242 |
@item 0.5#1 |
| 2243 |
Scale to half the natural size. |
| 2244 |
|
| 2245 |
@item \hsize |
| 2246 |
Scale to the current @code{\hsize}. (In @LaTeX{}, use @code{\textwidth} |
| 2247 |
instead of @code{\hsize}.) |
| 2248 |
|
| 2249 |
@item \ifnum#1>\hsize\hsize\else#1\fi |
| 2250 |
If the natural width is greater than the current @code{\hsize}, scale to |
| 2251 |
@code{\hsize}, otherwise use the natural width. |
| 2252 |
|
| 2253 |
@end table |
| 2254 |
|
| 2255 |
@cindex DVI magnification |
| 2256 |
@cindex magnification, DVI |
| 2257 |
@vindex \magnification |
| 2258 |
For compatibility with other PostScript drivers, it is possible to turn |
| 2259 |
off the default scaling of included figures by the DVI magnification |
| 2260 |
with the following @TeX{} command: |
| 2261 |
|
| 2262 |
@vindex /magscale |
| 2263 |
@example |
| 2264 |
\special@{! /magscale false def@} |
| 2265 |
@end example |
| 2266 |
|
| 2267 |
@noindent |
| 2268 |
Use of this command is not recommended because it will make the |
| 2269 |
@code{\epsffile} graphics the ``wrong'' size if global magnification is |
| 2270 |
being used, and it will cause any PostScript graphics to appear |
| 2271 |
improperly scaled and out of position if a DVI to DVI program is used to |
| 2272 |
scale or otherwise modify the document. |
| 2273 |
|
| 2274 |
@findex bop-hook |
| 2275 |
DVI magnification is not applied to any output from code you write in |
| 2276 |
@samp{bop-hook} or its ilk (@pxref{PostScript hooks}), |
| 2277 |
|
| 2278 |
|
| 2279 |
@node EPSF clipping |
| 2280 |
@subsubsection EPSF clipping |
| 2281 |
|
| 2282 |
@cindex clipping of EPSF |
| 2283 |
@cindex bounding box, inaccurate |
| 2284 |
@cindex text in figures, chopped off |
| 2285 |
@cindex lines in figures, wrong width |
| 2286 |
|
| 2287 |
By default, clipping is disabled for included EPSF images. This is |
| 2288 |
because clipping to the bounding box dimensions often cuts off a |
| 2289 |
small portion of the figure, due to slightly inaccurate bounding |
| 2290 |
box arguments. The problem might be subtle; lines around the boundary |
| 2291 |
of the image might be half their intended width, or the tops or |
| 2292 |
bottoms of some text annotations might be sliced off. If you want to |
| 2293 |
turn clipping on, just use the command |
| 2294 |
|
| 2295 |
@example |
| 2296 |
\epsfclipon |
| 2297 |
@end example |
| 2298 |
|
| 2299 |
@noindent |
| 2300 |
and to turn clipping back off, use |
| 2301 |
|
| 2302 |
@example |
| 2303 |
\epsfclipoff |
| 2304 |
@end example |
| 2305 |
|
| 2306 |
|
| 2307 |
@node psfile special |
| 2308 |
@subsection @samp{psfile} special |
| 2309 |
|
| 2310 |
@findex psfile @r{special} |
| 2311 |
|
| 2312 |
The basic special for file inclusion is as follows: |
| 2313 |
|
| 2314 |
@example |
| 2315 |
\special@{psfile=@var{filename}.ps @r{[}@var{key}=@var{value}@r{]} @dots{} @} |
| 2316 |
@end example |
| 2317 |
|
| 2318 |
@noindent |
| 2319 |
This downloads the PostScript file @file{@var{filename}.ps} such that |
| 2320 |
the current point will be the origin of the PostScript coordinate |
| 2321 |
system. The optional @var{key}@t{=}@var{value} assignments allow you to |
| 2322 |
specify transformations on the PostScript. |
| 2323 |
|
| 2324 |
The possible @var{key}s are: |
| 2325 |
|
| 2326 |
@table @samp |
| 2327 |
@item hoffset |
| 2328 |
@opindex hoffset @r{(@samp{psfile} special option)} |
| 2329 |
The horizontal offset (default 0). |
| 2330 |
|
| 2331 |
@item voffset |
| 2332 |
@opindex voffset @r{(@samp{psfile} special option)} |
| 2333 |
The vertical offset (default 0). |
| 2334 |
|
| 2335 |
@item hsize |
| 2336 |
@opindex hsize @r{(@samp{psfile} special option)} |
| 2337 |
The horizontal clipping size (default 612). |
| 2338 |
|
| 2339 |
@item vsize |
| 2340 |
@opindex vsize @r{(@samp{psfile} special option)} |
| 2341 |
The vertical clipping size (default 792). |
| 2342 |
|
| 2343 |
@item hscale |
| 2344 |
@opindex hscale @r{(@samp{psfile} special option)} |
| 2345 |
The horizontal scaling factor, as a percentage (default 100). |
| 2346 |
|
| 2347 |
@item vscale |
| 2348 |
@opindex vscale @r{(@samp{psfile} special option)} |
| 2349 |
The vertical scaling factor, as a percentage (default 100). |
| 2350 |
|
| 2351 |
@item angle |
| 2352 |
@opindex angle @r{(@samp{psfile} special option)} |
| 2353 |
The rotation, in degrees (default 0). |
| 2354 |
|
| 2355 |
@item clip |
| 2356 |
@opindex clip @r{(@samp{psfile} special option)} |
| 2357 |
Enable clipping to the bounding box (default disabled). |
| 2358 |
|
| 2359 |
@item llx, lly, urx, ury |
| 2360 |
@opindex llx @r{(@samp{psfile} special option)} |
| 2361 |
@opindex lly @r{(@samp{psfile} special option)} |
| 2362 |
@opindex urx @r{(@samp{psfile} special option)} |
| 2363 |
@opindex ury @r{(@samp{psfile} special option)} |
| 2364 |
Bounding box of the included image, just as in a @code{%%BoundingBox} |
| 2365 |
comment. Values are in big points, and may be fractional. |
| 2366 |
|
| 2367 |
@item rhi, rwi |
| 2368 |
@opindex rhi @r{(@samp{psfile} special option)} |
| 2369 |
@opindex rwi @r{(@samp{psfile} special option)} |
| 2370 |
Desired width and height of the resulting figure in the output, in |
| 2371 |
tenths of big points (720 to the inch); may be fractional. |
| 2372 |
|
| 2373 |
If both @code{rwi} and @code{rhi} are nonzero, the picture is scaled, |
| 2374 |
possibly losing aspect ratio. If only one of @code{rwi} and |
| 2375 |
@code{rhi} is nonzero, the picture is scaled, preserving aspect ratio. |
| 2376 |
|
| 2377 |
@end table |
| 2378 |
|
| 2379 |
The offsets and sizes are given in PostScript units (big points). |
| 2380 |
Thus, for example: |
| 2381 |
|
| 2382 |
@example |
| 2383 |
\special@{psfile=foo.ps hoffset=72 hscale=90 vscale=90@} |
| 2384 |
@end example |
| 2385 |
|
| 2386 |
@noindent |
| 2387 |
will shift the graphics produced by file @file{foo.ps} right by one inch |
| 2388 |
and will draw it at 0.9 times normal size. Offsets are given relative |
| 2389 |
to the point of the special command, and are unaffected by scaling or |
| 2390 |
rotation. Rotation is counterclockwise about the origin. The order of |
| 2391 |
operations is to rotate the figure, scale it, then offset it. |
| 2392 |
|
| 2393 |
For compatibility with older PostScript drivers, it is possible to change |
| 2394 |
the units that @samp{hscale} and @samp{vscale} are given in. This can be |
| 2395 |
done by redefining @samp{@@scaleunit} |
| 2396 |
@vindex scaleunit |
| 2397 |
in @samp{SDict} |
| 2398 |
@vindex SDict |
| 2399 |
by a @TeX{} command such as |
| 2400 |
|
| 2401 |
@example |
| 2402 |
\special@{! /@@scaleunit 1 def@} |
| 2403 |
@end example |
| 2404 |
|
| 2405 |
@noindent |
| 2406 |
The @samp{@@scaleunit} variable, which is by default 100, is what |
| 2407 |
@samp{hscale} and @samp{vscale} are divided by to yield an absolute |
| 2408 |
scale factor. |
| 2409 |
|
| 2410 |
|
| 2411 |
@node Dynamic creation of graphics |
| 2412 |
@subsection Dynamic creation of PostScript graphics files |
| 2413 |
|
| 2414 |
@cindex dynamic creation of graphics |
| 2415 |
@cindex compressed PostScript |
| 2416 |
@cindex uncompressing PostScript |
| 2417 |
|
| 2418 |
PostScript is an excellent page description language---but it does tend |
| 2419 |
to be rather verbose. Compressing PostScript graphics files can reduce |
| 2420 |
them by factor of five or more. For this reason, if the name of an |
| 2421 |
included PostScript file ends with @file{.Z} or @file{.gz}, Dvips |
| 2422 |
automatically runs @samp{gzip -d}. For example: |
| 2423 |
|
| 2424 |
@example |
| 2425 |
\epsffile[72 72 540 720]@{foo.ps.gz@} |
| 2426 |
@end example |
| 2427 |
|
| 2428 |
@noindent |
| 2429 |
Since the results of such a command are not accessible to @TeX{}, if you |
| 2430 |
use this facility with the @file{epsf} macros, you need to supply the |
| 2431 |
bounding box parameter yourself, as shown. |
| 2432 |
|
| 2433 |
More generally, if the filename parameter to one of the graphics |
| 2434 |
inclusion techniques starts with a left quote (@samp{`}), the parameter |
| 2435 |
is instead interpreted as a command to execute that will send the actual |
| 2436 |
file to standard output. For example: |
| 2437 |
|
| 2438 |
@example |
| 2439 |
\special@{psfile="`gnuplot foo"@} |
| 2440 |
@end example |
| 2441 |
|
| 2442 |
@noindent |
| 2443 |
@flindex gnuplot |
| 2444 |
to include the file @file{foo}. Of course, the command to be executed |
| 2445 |
can be anything, including using a file conversion utility such as |
| 2446 |
@file{tek2ps} or whatever is appropriate. This feature can be disabled |
| 2447 |
with the @samp{-R} command-line option or @samp{R} configuration option. |
| 2448 |
|
| 2449 |
|
| 2450 |
@node Fonts in figures |
| 2451 |
@subsection Fonts in figures |
| 2452 |
|
| 2453 |
@cindex figures and fonts |
| 2454 |
@cindex fonts, in PostScript figures |
| 2455 |
@findex %*Font |
| 2456 |
|
| 2457 |
You can use any font available to @TeX{} and Dvips within a graphics |
| 2458 |
file by putting a @code{%*Font:} line in the leading commentary of the |
| 2459 |
file. Schematically, this looks like: |
| 2460 |
|
| 2461 |
@example |
| 2462 |
%*Font: @var{tfmname} @var{scaledbp} @var{designbp} @var{hex-start}:@var{hex-bitstring} |
| 2463 |
@end example |
| 2464 |
|
| 2465 |
Here is the meaning of each of these elements: |
| 2466 |
|
| 2467 |
@table @var |
| 2468 |
@item tfmname |
| 2469 |
The @TeX{} TFM filename, e.g., @file{cmr10}. You can give the same |
| 2470 |
@var{tfmname} on more than one @samp{%*Font} line; this is useful when |
| 2471 |
the number of characters from the font used needs a longer |
| 2472 |
@var{hex-bitstring} (see item below) than conveniently fits on one line. |
| 2473 |
|
| 2474 |
@item scaledbp |
| 2475 |
The size at which you are using the font, in PostScript points (@TeX{} |
| 2476 |
big points). 72@dmn{bp} = 72.27@dmn{pt} = 1@dmn{in}. |
| 2477 |
|
| 2478 |
@item designbp |
| 2479 |
The designsize of the font, again in PostScript points. This should |
| 2480 |
match the value in the TFM file @var{tfmname}. Thus, for @file{cmr10}, |
| 2481 |
it should be @samp{9.96265}. |
| 2482 |
|
| 2483 |
@item hex-start |
| 2484 |
The character code of the first character used from the font, specified |
| 2485 |
as two ASCII hexadecimal characters, e.g., @samp{4b} or @samp{4B} for |
| 2486 |
@samp{K}. |
| 2487 |
|
| 2488 |
@item hex-bitstring |
| 2489 |
An arbitrary number of ASCII hexadecimal digits specifying which |
| 2490 |
characters following (and including) @var{hex-start} are used. This is |
| 2491 |
treated as a bitmap. For example, if your figure used the single letter |
| 2492 |
@samp{K}, you would use @samp{4b:8} for @var{hex-start} and |
| 2493 |
@var{hex-bitstring}. If it used @samp{KLMNP}, you would use |
| 2494 |
@samp{4b:f4}. |
| 2495 |
|
| 2496 |
@end table |
| 2497 |
|
| 2498 |
MetaPost's output figures contain lines like this for bitmap fonts used |
| 2499 |
in a MetaPost label (@pxref{MetaPost,,, web2c, Web2c}). |
| 2500 |
|
| 2501 |
|
| 2502 |
@node Header files |
| 2503 |
@section PostScript header files |
| 2504 |
|
| 2505 |
@cindex header files, defined |
| 2506 |
@cindex PostScript header files |
| 2507 |
|
| 2508 |
@dfn{Header files} are bits of PostScript included in the output file; |
| 2509 |
generally they provide support for special features, rather than |
| 2510 |
producing any printed output themselves. You can explicitly request |
| 2511 |
downloading header files if necessary for some figure, or to achieve |
| 2512 |
some special effect. |
| 2513 |
|
| 2514 |
@vindex psheaderdir |
| 2515 |
@flindex .pro @r{prologue files} |
| 2516 |
@flindex .lpro @r{long prologue files} |
| 2517 |
Dvips includes some headers on its own initiative, to implement features |
| 2518 |
such as PostScript font reencoding, bitmap font downloading, handling of |
| 2519 |
@code{\special}'s, and so on. These standard headers are the |
| 2520 |
@file{.pro} files (for ``prologue'') in the installation directory |
| 2521 |
@samp{$(psheaderdir)}; they are created from the @file{.lpro} (``long |
| 2522 |
prologue'') files in the distribution by stripping |
| 2523 |
comments, squeezing blank lines, etc., for maximum efficiency. If you |
| 2524 |
want to peruse one of the standard header files, read the @file{.lpro} |
| 2525 |
version. |
| 2526 |
|
| 2527 |
@vindex userdict@r{, and dictionary files} |
| 2528 |
@cindex dictionary, @code{userdict} |
| 2529 |
The PostScript dictionary stack will be at the @samp{userdict} level |
| 2530 |
when header files are included. |
| 2531 |
|
| 2532 |
@menu |
| 2533 |
* Including headers from TeX:: |
| 2534 |
* Including headers from the command line:: |
| 2535 |
* Headers and memory usage:: |
| 2536 |
@end menu |
| 2537 |
|
| 2538 |
|
| 2539 |
@node Including headers from TeX |
| 2540 |
@subsection Including headers from @TeX{} |
| 2541 |
|
| 2542 |
@cindex including headers in @TeX{} |
| 2543 |
@findex header=@var{file} \special |
| 2544 |
@cindex @TeX{}, including headers in |
| 2545 |
|
| 2546 |
@cindex headers, including in @TeX{} |
| 2547 |
In order to get a particular graphic file to work, a certain font or |
| 2548 |
header file might need to be sent first. The Dvips program provides |
| 2549 |
support for this with the @samp{header} @code{\special}. For instance, |
| 2550 |
to ensure that @file{foo.ps} gets downloaded: |
| 2551 |
|
| 2552 |
@example |
| 2553 |
\special@{header=foo.ps@} |
| 2554 |
@end example |
| 2555 |
|
| 2556 |
@cindex fonts, as header files |
| 2557 |
As another example, if you have some PostScript code that uses a |
| 2558 |
PostScript font not built into your printer, you must download it to the |
| 2559 |
printer. If the font isn't used elsewhere in the document, Dvips can't |
| 2560 |
know you've used it, so you must include it in the same way, as in: |
| 2561 |
|
| 2562 |
@example |
| 2563 |
\special@{header=putr.pfa@} |
| 2564 |
@end example |
| 2565 |
|
| 2566 |
@noindent |
| 2567 |
to include the font definition file for Adobe Utopia Roman. |
| 2568 |
|
| 2569 |
The @code{header} also special allows for specifying some additional |
| 2570 |
code that should be inserted into the PostScript document before and after |
| 2571 |
the file itself, as follows: |
| 2572 |
|
| 2573 |
@example |
| 2574 |
\special@{header=@{foo.ps@} pre=@{pre code@} post=@{post code@}@} |
| 2575 |
@end example |
| 2576 |
|
| 2577 |
@cindex before header, inserting code |
| 2578 |
@cindex after header, inserting code |
| 2579 |
@findex pre @r{code before headers} |
| 2580 |
@findex post @r{code after headers} |
| 2581 |
This will insert @code{pre code} just before @file{foo.ps} and |
| 2582 |
@code{post code} just after. It is required to use the (balanced) |
| 2583 |
braces in @emph{all} of the arguments, including the @code{header}, |
| 2584 |
when using this extended syntax. |
| 2585 |
|
| 2586 |
This allows, for instance, dynamic headers, where some of the content |
| 2587 |
depends on settings from the user in (La)@TeX{}. Another application |
| 2588 |
is the inclusion of graphics inside the PostScript header, so that |
| 2589 |
they can be reused throughout the document, as with logs. That avoids |
| 2590 |
including the same graphic several times. This is implemented in the |
| 2591 |
@file{graphics/graphicx-psmin} package. |
| 2592 |
|
| 2593 |
This extended syntax has one additional feature. When Dvips finds the |
| 2594 |
extended syntax, it will also look in the installed @file{tex/} |
| 2595 |
tree(s) for the header file (@file{foo.ps} in our example), and not |
| 2596 |
only in the current directory and dvips tree as the original syntax |
| 2597 |
does. This is because common graphics may well come with packages |
| 2598 |
which are installed in the @file{tex/} tree. |
| 2599 |
|
| 2600 |
|
| 2601 |
@node Including headers from the command line |
| 2602 |
@subsection Including headers from the command line |
| 2603 |
|
| 2604 |
@cindex including headers from the command line |
| 2605 |
@cindex command line, including headers from |
| 2606 |
@cindex headers, including from the command line |
| 2607 |
|
| 2608 |
You can include headers when you run Dvips, as well as from your |
| 2609 |
document (see the previous section). To do this, run Dvips with the |
| 2610 |
option @samp{-P @var{header}}; this will read the file |
| 2611 |
@file{config.@var{header}}, which in turn can specify a header file to |
| 2612 |
be downloaded with the @samp{h} option. @xref{Configuration file |
| 2613 |
commands}. These files are called @file{@var{header}.cfg} on MS-DOS. |
| 2614 |
|
| 2615 |
@cindex duplex printers |
| 2616 |
@cindex simplex mode on duplex printers |
| 2617 |
@cindex screen frequencies, setting |
| 2618 |
You can arrange for the same file to serve as a @samp{-P} config file |
| 2619 |
and the downloadable header file, by starting the lines of PostScript |
| 2620 |
code with a space, leaving only the @samp{h} line and any comments |
| 2621 |
starting in the first column. As an example, see |
| 2622 |
@file{contrib/volker/config.*} (@file{contrib/volker/*.cfg} on MS-DOS). |
| 2623 |
(These files also perform useful functions: controlling duplex/simplex |
| 2624 |
mode on duplex printers, and setting various screen frequencies; |
| 2625 |
@file{contrib/volker/README} explains further.) |
| 2626 |
|
| 2627 |
|
| 2628 |
@node Headers and memory usage |
| 2629 |
@subsection Headers and memory usage |
| 2630 |
|
| 2631 |
@cindex headers and memory usage |
| 2632 |
@cindex memory usage, and headers |
| 2633 |
|
| 2634 |
@cindex sections of output file, and memory |
| 2635 |
@cindex output file, sectioning of |
| 2636 |
Dvips tries to avoid overflowing the printer's memory by splitting the |
| 2637 |
output files into ``sections'' (see the @samp{-i} option in @ref{Option |
| 2638 |
details}). Therefore, for all header files, Dvips debits the printer VM |
| 2639 |
budget by some value. If the header file has, in its leading |
| 2640 |
commentary a line of the form |
| 2641 |
|
| 2642 |
@findex VMusage |
| 2643 |
@findex %%VMusage |
| 2644 |
@example |
| 2645 |
%%VMusage: @var{min} @var{max} |
| 2646 |
@end example |
| 2647 |
|
| 2648 |
@noindent |
| 2649 |
then @var{max} is used. If there is no @code{%%VMusage} line, then |
| 2650 |
the size (in bytes) of the header file is used as an approximation. |
| 2651 |
If you want a file to be ignored in the sectioning calculations, use |
| 2652 |
@samp{%%VMusage: 0 0}. |
| 2653 |
|
| 2654 |
Illustrations (figure files) are also checked for @code{%%VMusage} line. |
| 2655 |
|
| 2656 |
Therefore, if your document uses very large fonts or very large |
| 2657 |
included figures, Dvips might take it upon itself to split the output |
| 2658 |
into unwanted sections. If this causes problems, the simplest |
| 2659 |
solution is to use @samp{dvips -Pmaxmem}, which reads the Dvips file |
| 2660 |
@file{config.maxmem}, which sets Dvips's idea of the memory available |
| 2661 |
to a very large number. (See the @samp{m} item in @ref{Configuration |
| 2662 |
file commands}.) |
| 2663 |
|
| 2664 |
|
| 2665 |
@node Literal PS |
| 2666 |
@section Literal PostScript |
| 2667 |
|
| 2668 |
@cindex literal PostScript, using |
| 2669 |
@cindex PostScript code, literal |
| 2670 |
|
| 2671 |
You can include literal PostScript code in your document in several ways. |
| 2672 |
|
| 2673 |
@menu |
| 2674 |
* " special:: To include inline PostScript code. |
| 2675 |
* ps special:: Inline PostScript without save/restore. |
| 2676 |
* Literal headers:: Literal PostScript for the whole document. |
| 2677 |
* PostScript hooks:: Specifying code to run in the PS interpreter. |
| 2678 |
* Literal examples:: Neat example. |
| 2679 |
@end menu |
| 2680 |
|
| 2681 |
|
| 2682 |
@node " special |
| 2683 |
@subsection @code{"} special: Literal PostScript |
| 2684 |
|
| 2685 |
@findex " @r{special (literal PostScript)} |
| 2686 |
|
| 2687 |
For simple graphics, or just for experimentation, literal PostScript |
| 2688 |
code can be included. Simply use a @code{\special} beginning with a |
| 2689 |
double quote character @samp{"}; there is no matching closing @samp{"}. |
| 2690 |
|
| 2691 |
For instance, the following (simple) graphic: |
| 2692 |
|
| 2693 |
@iftex |
| 2694 |
@tex |
| 2695 |
\vskip\baselineskip |
| 2696 |
\vbox to 100bp{\vss % a bp is the same as a PostScript unit |
| 2697 |
\special{" newpath 0 0 moveto 100 100 lineto 394 0 lineto |
| 2698 |
closepath gsave 0.8 setgray fill grestore stroke}} |
| 2699 |
@end tex |
| 2700 |
@end iftex |
| 2701 |
@ifinfo |
| 2702 |
[ picture of a grey triangle ] |
| 2703 |
@end ifinfo |
| 2704 |
|
| 2705 |
@noindent |
| 2706 |
was created by typing: |
| 2707 |
|
| 2708 |
@example |
| 2709 |
\vbox to 100bp@{\vss % a bp is the same as a PostScript unit |
| 2710 |
\special@{" newpath 0 0 moveto 100 100 lineto 394 0 lineto |
| 2711 |
closepath gsave 0.8 setgray fill grestore stroke@}@} |
| 2712 |
@end example |
| 2713 |
|
| 2714 |
You are responsible for leaving space for such literal graphics, as with |
| 2715 |
the @code{\vbox} above. |
| 2716 |
|
| 2717 |
|
| 2718 |
@node ps special |
| 2719 |
@subsection @samp{ps} special |
| 2720 |
|
| 2721 |
@findex ps @r{special} |
| 2722 |
|
| 2723 |
@cindex save/restore, and specials |
| 2724 |
Generally, Dvips encloses specials in a PostScript save/restore pair, |
| 2725 |
guaranteeing that the special will have no effect on the rest of the |
| 2726 |
document. The @samp{ps} special, however, allows you to insert literal |
| 2727 |
PostScript instructions without this protective shield; you should |
| 2728 |
understand what you're doing (and you shouldn't change the PostScript |
| 2729 |
graphics state unless you are willing to take the consequences). This |
| 2730 |
command can take many forms because it has had a torturous history; any |
| 2731 |
of the following will work: |
| 2732 |
|
| 2733 |
@example |
| 2734 |
\special@{ps:@var{text}@} |
| 2735 |
\special@{ps::@var{text}@} |
| 2736 |
\special@{ps::[begin]@var{text}@} |
| 2737 |
\special@{ps::[end]@var{text}@} |
| 2738 |
\special@{ps::[nobreak]@var{text}@} |
| 2739 |
@end example |
| 2740 |
|
| 2741 |
@noindent |
| 2742 |
(with longer forms taking precedence over shorter forms, when they are |
| 2743 |
present). @samp{ps::} and @samp{ps::[end]} do no positioning, so they |
| 2744 |
can be used to continue PostScript literals started with @samp{ps:} or |
| 2745 |
@samp{ps::[begin]}. |
| 2746 |
|
| 2747 |
Literal PostScript instructions after @samp{ps::[nobreak]} are |
| 2748 |
@emph{not} broken into lines. This feature may be used to include |
| 2749 |
PostScript comments, for example. |
| 2750 |
|
| 2751 |
@findex plotfile@r{, @samp{ps} subspecial} |
| 2752 |
In addition, the variant |
| 2753 |
|
| 2754 |
@example |
| 2755 |
\special@{ps: plotfile @var{filename}@} |
| 2756 |
@end example |
| 2757 |
|
| 2758 |
@noindent |
| 2759 |
@flindex rotate.tex |
| 2760 |
inserts the contents of @var{filename} verbatim into the output (except |
| 2761 |
for omitting lines that begin with %). An example of the proper use of |
| 2762 |
literal specials can be found in the file @file{rotate.tex}, which makes |
| 2763 |
it easy to typeset text turned in multiples of 90 degrees. |
| 2764 |
|
| 2765 |
|
| 2766 |
@node Literal headers |
| 2767 |
@subsection Literal headers: @samp{!} @code{\special} |
| 2768 |
|
| 2769 |
@cindex literal headers |
| 2770 |
@vindex SDict @r{dictionary} |
| 2771 |
|
| 2772 |
@findex ! @r{special (literal PS header)} |
| 2773 |
@cindex dictionary, @code{SDict} |
| 2774 |
You can download literal PostScript header code in your @TeX{} document, |
| 2775 |
for use with (for example) literal graphics code that you include later. |
| 2776 |
The text of a @code{\special} beginning with an @samp{!} is copied into |
| 2777 |
the output file. A dictionary @code{SDict} will be current when this |
| 2778 |
code is executed; Dvips arranges for @code{SDict} to be first on the |
| 2779 |
dictionary stack when any PostScript graphic is included, whether |
| 2780 |
literally (the @samp{"} special) or through macros (e.g., |
| 2781 |
@file{epsf.tex}). |
| 2782 |
|
| 2783 |
For example: |
| 2784 |
|
| 2785 |
@example |
| 2786 |
\special@{! /reset @{ 0 0 moveto@} def@} |
| 2787 |
@end example |
| 2788 |
|
| 2789 |
|
| 2790 |
@node PostScript hooks |
| 2791 |
@subsection PostScript hooks |
| 2792 |
|
| 2793 |
@cindex PostScript hooks |
| 2794 |
|
| 2795 |
Besides including literal PostScript at a particular place in your |
| 2796 |
document (as described in the previous section), you can also arrange to |
| 2797 |
execute arbitrary PostScript code at particular times while the |
| 2798 |
PostScript is printing. |
| 2799 |
|
| 2800 |
@findex bop-hook |
| 2801 |
@findex eop-hook |
| 2802 |
@findex start-hook |
| 2803 |
@findex end-hook |
| 2804 |
If any of the PostScript names @code{bop-hook}, @code{eop-hook}, |
| 2805 |
@code{start-hook}, or @code{end-hook} are defined in @code{userdict}, |
| 2806 |
they will be executed at the beginning of a page, end of a page, start |
| 2807 |
of the document, and end of a document, respectively. |
| 2808 |
|
| 2809 |
@cindex draft copies |
| 2810 |
@cindex dated output |
| 2811 |
When these macros are executed, the default PostScript coordinate system |
| 2812 |
and origin is in effect. Such macros can be defined in headers added by |
| 2813 |
the @samp{-h} option or the @samp{header=} special, and might be useful |
| 2814 |
for writing, for instance, `DRAFT' across the entire page, or, with the |
| 2815 |
aid of a shell script, dating the document. These macros are executed |
| 2816 |
outside of the save/restore context of the individual pages, so it is |
| 2817 |
possible for them to accumulate information, but if a document must be |
| 2818 |
divided into sections because of memory constraints, such added |
| 2819 |
information will be lost across section breaks. |
| 2820 |
|
| 2821 |
@cindex physical page number, and @code{bop-hook} |
| 2822 |
The single argument to @code{bop-hook} is the physical page number; the |
| 2823 |
first page gets zero, the second one, etc. @code{bop-hook} must leave |
| 2824 |
this number on the stack. None of the other hooks are passed arguments. |
| 2825 |
|
| 2826 |
As an example of what can be done, the following special will write |
| 2827 |
a light grey `DRAFT' across each page in the document: |
| 2828 |
|
| 2829 |
@example |
| 2830 |
\special@{!userdict begin /bop-hook@{gsave 200 30 translate |
| 2831 |
65 rotate /Times-Roman findfont 216 scalefont setfont |
| 2832 |
0 0 moveto 0.7 setgray (DRAFT) show grestore@}def end@} |
| 2833 |
@end example |
| 2834 |
|
| 2835 |
@findex %%Page@r{, and multi-page information} |
| 2836 |
Using @code{bop-hook} or @code{eop-hook} to preserve information across |
| 2837 |
pages breaks compliance with the Adobe document structuring conventions, |
| 2838 |
so if you use any such tricks, you may also want to use the @samp{-N} |
| 2839 |
option to turn off structured comments (such as @samp{%%Page}). |
| 2840 |
Otherwise, programs that read your file will assume its pages are |
| 2841 |
independent. |
| 2842 |
|
| 2843 |
|
| 2844 |
@node Literal examples |
| 2845 |
@subsection Literal examples |
| 2846 |
|
| 2847 |
@cindex literal PostScript, examples |
| 2848 |
@cindex examples of literal PostScript |
| 2849 |
|
| 2850 |
To finish off this section, the following examples of literal PostScript |
| 2851 |
are presented without explanation: |
| 2852 |
|
| 2853 |
@example |
| 2854 |
\def\rotninety@{\special@{ps:currentpoint currentpoint translate 90 |
| 2855 |
rotate neg exch neg exch translate@}@}\font\huge=cmbx10 at 14.4truept |
| 2856 |
\setbox0=\hbox to0pt@{\huge A\hss@}\vskip16truept\centerline@{\copy0 |
| 2857 |
\special@{ps:gsave@}\rotninety\copy0\rotninety\copy0\rotninety |
| 2858 |
\box0\special@{ps:grestore@}@}\vskip16truept |
| 2859 |
@end example |
| 2860 |
|
| 2861 |
@iftex |
| 2862 |
@tex |
| 2863 |
\def\rotninety{\special{ps:currentpoint currentpoint translate 90 |
| 2864 |
rotate neg exch neg exch translate}} |
| 2865 |
\font\huge=cmbx10 at 14.4truept |
| 2866 |
\setbox0=\hbox to0pt {\huge A\hss} |
| 2867 |
\vskip16truept |
| 2868 |
\centerline{\copy0\special{ps:gsave} |
| 2869 |
\rotninety\copy0\rotninety\copy0\rotninety |
| 2870 |
\box0\special{ps:grestore}} |
| 2871 |
\vskip16truept |
| 2872 |
@end tex |
| 2873 |
@end iftex |
| 2874 |
@ifinfo |
| 2875 |
[ There are 4 @samp{A} characters, each rotated 90 degrees about a |
| 2876 |
common center point ] |
| 2877 |
@end ifinfo |
| 2878 |
|
| 2879 |
|
| 2880 |
@example |
| 2881 |
\vbox to 2truein@{\special@{ps:gsave 0.3 setgray@}\hrule height 2in |
| 2882 |
width\hsize\vskip-2in\special@{ps:grestore@}\font\big=cminch\big |
| 2883 |
\vss\special@{ps:gsave 1 setgray@}\vbox to 0pt@{\vskip2pt |
| 2884 |
\line@{\hss\hskip4pt NEAT\hss@}\vss@}\special@{ps:0 setgray@}% |
| 2885 |
\hbox@{\raise2pt\line@{\hss NEAT\hss@}\special@{ps:grestore@}@}\vss@} |
| 2886 |
@end example |
| 2887 |
|
| 2888 |
@iftex |
| 2889 |
@tex |
| 2890 |
\smallskip |
| 2891 |
\vbox to 2truein{\special{ps:gsave 0.3 setgray}\hrule height 2in |
| 2892 |
width\hsize\vskip-2in\special{ps:grestore}\font\big=cminch\big |
| 2893 |
\vss\special{ps:gsave 1 setgray}\vbox to 0pt{\vskip2pt |
| 2894 |
\line{\hss\hskip4pt NEAT\hss}\vss}\special{ps:0 setgray}% |
| 2895 |
\hbox{\raise2pt\line{\hss NEAT\hss}\special{ps:grestore}}\vss} |
| 2896 |
@end tex |
| 2897 |
@end iftex |
| 2898 |
@ifinfo |
| 2899 |
[ There is a big gray box with the word @samp{NEAT} inside in big letters ] |
| 2900 |
@end ifinfo |
| 2901 |
|
| 2902 |
@findex \rotninety |
| 2903 |
@findex gsave@r{/}grestore@r{, and literal PS} |
| 2904 |
@findex save@r{/}restore@r{, and literal PS} |
| 2905 |
Some caveats are in order, however. Make sure that each @code{gsave} is |
| 2906 |
matched with a @code{grestore} on the same page. Do not use @code{save} |
| 2907 |
and @code{restore}; they can interact with the PostScript generated by |
| 2908 |
Dvips if care is not taken. Try to understand what the above macros are |
| 2909 |
doing before writing your own. The @code{\rotninety} macro especially |
| 2910 |
has a useful trick that appears again and again. |
| 2911 |
|
| 2912 |
|
| 2913 |
@node Hypertext |
| 2914 |
@section Hyper@TeX{}t |
| 2915 |
|
| 2916 |
@cindex hypertext support |
| 2917 |
|
| 2918 |
@opindex -z |
| 2919 |
@findex html @r{specials} |
| 2920 |
@findex pdfmark |
| 2921 |
Dvips has support for producing hypertext PostScript documents. If you |
| 2922 |
specify the @samp{-z} option, the @file{html:} specials described below |
| 2923 |
will be converted into @samp{pdfmark} PostScript operators to specify |
| 2924 |
links. Without @samp{-z}, @file{html:} specials are ignored. |
| 2925 |
|
| 2926 |
@cindex distiller, for PDF files |
| 2927 |
@cindex PDF files, making |
| 2928 |
The resulting PostScript can then be processed by a distiller program to |
| 2929 |
make a PDF file. (It can still be handled by ordinary PostScript |
| 2930 |
interpreters as well.) Various versions of both PC and Unix distillers |
| 2931 |
are supported; Ghostscript includes limited distiller support |
| 2932 |
(@pxref{Ghostscript installation}). |
| 2933 |
|
| 2934 |
By far the most common @LaTeX{} package used to create hyperlinked |
| 2935 |
output is @code{hyperref} (@url{https://ctan.org/pkg/hyperref}). For |
| 2936 |
plain @TeX{}, the Eplain package has some hyperlink support |
| 2937 |
(@url{https://tug.org/eplain}). |
| 2938 |
|
| 2939 |
@cindex Doyle, Mark |
| 2940 |
@cindex Bhattacharya, Tanmoy |
| 2941 |
@pindex dvihps@r{, hyperdvi to PostScript} |
| 2942 |
This hypertext support (and original form of the documentation) was |
| 2943 |
written by Mark Doyle and Tanmoy Bhattacharya as the @samp{dvihps} |
| 2944 |
program. |
| 2945 |
|
| 2946 |
@menu |
| 2947 |
* Hypertext caveats:: Font quality, missing character psi. |
| 2948 |
* Hypertext specials:: The details on the specials. |
| 2949 |
@end menu |
| 2950 |
|
| 2951 |
|
| 2952 |
@node Hypertext caveats |
| 2953 |
@subsection Hypertext caveats |
| 2954 |
|
| 2955 |
@cindex hypertext caveats |
| 2956 |
|
| 2957 |
@cindex Computer Modern in PostScript |
| 2958 |
@cindex hypertext and bitmap fonts |
| 2959 |
@cindex hypertext caveats |
| 2960 |
@cindex embedding Type 1 fonts |
| 2961 |
@cindex PDF files, font quality |
| 2962 |
If you intend to go all the way to PDF, you may want to use the standard |
| 2963 |
35 PostScript fonts exclusively, since other fonts are embedded as |
| 2964 |
bitmaps by default. The Adobe PDF readers are extremely slow when |
| 2965 |
dealing with bitmap fonts and the results look terrible on the screen. |
| 2966 |
Printouts will probably look fine, but may not take full advantage of a |
| 2967 |
high-resolution printer. Alternatively, you can have your fonts |
| 2968 |
embedded as Type 1 scalable outlines. The resulting PostScript files |
| 2969 |
may be larger, but can be effectively rasterized at any resolution. |
| 2970 |
They can also be converted to PDF files that can be used effectively at |
| 2971 |
any screen or printer resolution. |
| 2972 |
|
| 2973 |
To get the TeX fonts embedded in the PostScript file as Type 1 fonts, |
| 2974 |
add @samp{-Ppdf} to the dvips command line switches. The printout |
| 2975 |
for a run should look something like this: |
| 2976 |
|
| 2977 |
@smallexample |
| 2978 |
dvips report -Ppdf -o report.ps |
| 2979 |
This is dvips(k) 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com) |
| 2980 |
' TeX output 2001.06.15:0837' -> report.ps |
| 2981 |
<tex.pro><alt-rule.pro><texc.pro><texps.pro><special.pro>. |
| 2982 |
<cmbx9.pfb><cmsy6.pfb><cmsy7.pfb><cmr5.pfb><cmex10.pfb><cmr9.pfb> |
| 2983 |
<cmmi7.pfb><cmsy10.pfb><cmmib10.pfb><cmmi10.pfb><cmti10.pfb> |
| 2984 |
<cmr7.pfb><cmbx10.pfb><cmr10.pfb><cmti9.pfb><cmr12.pfb><cmbx12.pfb> |
| 2985 |
[1] [2<mean1.ps>] [3<bounce1-00.ps>] [4] |
| 2986 |
@end smallexample |
| 2987 |
|
| 2988 |
An entry like "<cmr10.pfb>" indicates success: dvips found the Computer |
| 2989 |
Modern Roman 10 point font in a PostScript Font Binary file, translated |
| 2990 |
it to an ASCII encoding, and embedded it. You can confirm this by |
| 2991 |
examining the PostScript output file, looking for the section starting |
| 2992 |
@code{%%BeginFont: CMR10} followed by an entry @code{/FontType 1 def}. |
| 2993 |
|
| 2994 |
The @samp{-Ppdf} option requires that the relevant outline |
| 2995 |
(@file{.pfa} or @file{.pfb}) files be installed (@pxref{Font |
| 2996 |
concepts}). For example, the @file{cmr10} file might be in |
| 2997 |
@file{/usr/share/texmf/fonts/type1/bluesky/cm/cmr10.pfb}. Your TeX |
| 2998 |
distribution may make those fonts available in a separate optional |
| 2999 |
package (e.g., @code{tetex-extra} in Debian). Failing that, |
| 3000 |
commercial versions of the Computer Modern fonts are available from |
| 3001 |
Blue Sky; public domain versions, in particular, the lm |
| 3002 |
and cm-super font families, are available from CTAN and in @TeX{} |
| 3003 |
distributions. |
| 3004 |
|
| 3005 |
You can convert a PostScript file to PDF using @code{distill}, which |
| 3006 |
comes with Adobe Acrobat, or @code{ps2pdf}, which comes with |
| 3007 |
Ghostscript. The @code{ps2pdf} that comes with @code{Ghostscript} |
| 3008 |
version 6.0 or earlier will not embed Type 1 fonts. Current |
| 3009 |
recommendations are GNU Ghostscript 6.51 or Aladdin Ghostscript 7.0. |
| 3010 |
You can check the fonts in a PDF file with Acrobat Reader by selecting |
| 3011 |
the menu entries @samp{File|Document Info|Fonts}. |
| 3012 |
|
| 3013 |
@cindex psi character missing |
| 3014 |
@cindex trailing spaces, dropped |
| 3015 |
@cindex spaces, dropped trailing |
| 3016 |
Also, the Adobe distillers prior to 2.1 drop trailing space characters |
| 3017 |
(character code 32) from strings. Unfortunately, the PostScript fonts |
| 3018 |
use this character code for characters other than space (notably the |
| 3019 |
Greek letter psi in the @code{Symbol} font), and so these characters are |
| 3020 |
dropped. This bug is fixed in version 2.1. |
| 3021 |
|
| 3022 |
If you can't upgrade, one workaround is to change all the trailing |
| 3023 |
blanks in strings to a character code that isn't in the font. This works |
| 3024 |
because the default behavior is to substitute a blank for a missing |
| 3025 |
character, i.e., the distiller is fooled into substituting the right |
| 3026 |
character. For instance, with the Blue Sky fonts, you can globally |
| 3027 |
replace @samp{ )} with @samp{\200)} (with @code{sed}, for example) and |
| 3028 |
get the desired result. With the public domain fonts, you will probably |
| 3029 |
have to use a character code in the range 128 to 191 since these fonts |
| 3030 |
duplicate the first 32 characters starting at 192 to avoid MS-DOS |
| 3031 |
problems. |
| 3032 |
|
| 3033 |
For more information on the use of TeX to produce PDF files, see the |
| 3034 |
article ``Creating quality Adobe PDF files from @TeX{} with DVIPS'' by |
| 3035 |
Kendall Whitehouse of Adobe. Adobe seems not to offer the article any |
| 3036 |
more, but copies are available elsewhere: |
| 3037 |
@display |
| 3038 |
@url{http://www.math.hawaii.edu/~ralph/MathOnWeb/TeXPDF.html} |
| 3039 |
@url{http://www.utdallas.edu/~cantrell/online/543e.html} |
| 3040 |
@end display |
| 3041 |
|
| 3042 |
|
| 3043 |
@node Hypertext specials |
| 3044 |
@subsection Hypertext specials |
| 3045 |
|
| 3046 |
@cindex hypertext specials |
| 3047 |
@cindex specials, hypertext |
| 3048 |
|
| 3049 |
@cindex Smith, Arthur |
| 3050 |
Current support for the World Wide Web in the @TeX{} system does not |
| 3051 |
involve modifying @TeX{} itself. We need only define some specials; |
| 3052 |
Arthur Smith (@email{apsmith@@aps.org}), Tanmoy Bhattacharya, and Paul |
| 3053 |
Ginsparg originally proposed and implemented the following: |
| 3054 |
@example |
| 3055 |
html:<a href="@var{xurl}"> |
| 3056 |
html:<a name="@var{name}"> |
| 3057 |
html:</a> |
| 3058 |
html:<img src="@var{xurl}"> |
| 3059 |
html:<base href="@var{xurl}"> |
| 3060 |
@end example |
| 3061 |
|
| 3062 |
Like all @TeX{} @code{\special}'s, these produce no visible output, and |
| 3063 |
are uninterpreted by @TeX{} itself. They are instructions to DVI |
| 3064 |
processors only. |
| 3065 |
|
| 3066 |
@cindex uniform resource locator |
| 3067 |
@cindex extended URL |
| 3068 |
@cindex URL, extended for @TeX{} |
| 3069 |
@cindex Murphy, Tim |
| 3070 |
Here, @var{xurl} is a standard WWW uniform resource locator (URL), |
| 3071 |
possibly extended with a @samp{#@var{type}.@var{string}} construct, |
| 3072 |
where @var{type} is @samp{page}, @samp{section}, @samp{equation}, |
| 3073 |
@samp{reference} (for bibliographic references), @samp{figure}, |
| 3074 |
@samp{table}, etc. For example, |
| 3075 |
@smallexample |
| 3076 |
\special@{html:<a href="http://www.maths.tcd.ie/~tim/ch1.dvi#equation.1.1">@} |
| 3077 |
@end smallexample |
| 3078 |
@noindent is a link to equation (1.1) in an example document by Tim Murphy. |
| 3079 |
|
| 3080 |
@cindex URL, definition |
| 3081 |
See the URL @url{http://www.w3.org/hypertext/WWW/Addressing/Addressing.html} |
| 3082 |
for a precise description of base URL's. |
| 3083 |
|
| 3084 |
Descriptions of the @code{\special}'s: |
| 3085 |
@ftable @samp |
| 3086 |
@item href |
| 3087 |
@cindex links, hypertext |
| 3088 |
Creates links in your @TeX{} document. For example: |
| 3089 |
@example |
| 3090 |
\special@{html:<a href="http://www.tug.org/">@}\TeX\ Users |
| 3091 |
Group\special@{html:</a>@} |
| 3092 |
@end example |
| 3093 |
@noindent The user will be able to click on the text `@TeX{} Users |
| 3094 |
Group' while running Xdvi and get to the TUG home page. (By the way, |
| 3095 |
this is for illustration. In practice, you most likely want to use |
| 3096 |
macros to insert the @code{\special} commands; reference above.) |
| 3097 |
|
| 3098 |
@item name |
| 3099 |
@cindex Anderson, Laurie |
| 3100 |
Defines URL targets in your @TeX{} documents, so links can be |
| 3101 |
resolved. For example: |
| 3102 |
@example |
| 3103 |
\special@{html:<a name="paradise">@}Paradise\special@{html:</a>@} |
| 3104 |
is exactly where you are right now. |
| 3105 |
@end example |
| 3106 |
This will resolve an @samp{href="#paradise"}. You'll also have to |
| 3107 |
change the catcode of @samp{#}, etc. It's usually easiest to use |
| 3108 |
existing macro packages which take care of all the details, such as |
| 3109 |
@file{hyperref} for @LaTeX{}. The @url{http://arxiv.org/hypertex/, |
| 3110 |
HyperTeX FAQ} has more information. |
| 3111 |
|
| 3112 |
@item img |
| 3113 |
@flindex mailcap @r{and hypertext} |
| 3114 |
Links to an arbitrary external file. Interactively, a viewer is spawned |
| 3115 |
to read the file according to the file extension and your @file{mailcap} |
| 3116 |
file (see the Xdvi documentation). |
| 3117 |
|
| 3118 |
@item base |
| 3119 |
Defines a base URL that is prepended to all the @code{name} targets. |
| 3120 |
Typically unnecessary, as the name of the DVI file being read is used by |
| 3121 |
default. |
| 3122 |
@end ftable |
| 3123 |
|
| 3124 |
The @samp{img} and @samp{base} tags are not yet implemented in Dvips or |
| 3125 |
the NeXTSTEP DVI viewer. |
| 3126 |
|
| 3127 |
|
| 3128 |
@node PostScript fonts |
| 3129 |
@chapter PostScript fonts |
| 3130 |
|
| 3131 |
@cindex PostScript fonts |
| 3132 |
|
| 3133 |
Dvips supports the use of PostScript fonts in @TeX{} documents. To use |
| 3134 |
a PostScript font conveniently, you need to prepare a corresponding |
| 3135 |
virtual font; the program Afm2tfm, supplied with Dvips, helps |
| 3136 |
with that. |
| 3137 |
|
| 3138 |
All the necessary support for the standard 35 PostScript fonts |
| 3139 |
(@samp{AvantGarde-Book} through @samp{ZapfDingbats}), plus other freely |
| 3140 |
or commonly available PostScript fonts is available along with Dvips. |
| 3141 |
To use these fonts, you need do nothing beyond what is mentioned in the |
| 3142 |
installation procedure (@pxref{Installation}). This chapter is |
| 3143 |
therefore relevant only if you are installing new PostScript fonts not |
| 3144 |
supplied with Dvips. (Or if you're curious.) |
| 3145 |
|
| 3146 |
@menu |
| 3147 |
* Font concepts:: Metrics, glyphs, virtual fonts, and encodings. |
| 3148 |
* Making a font available:: Installing and using a PostScript font. |
| 3149 |
* Invoking afm2tfm:: Creating TFM and AFM files for a virtual font. |
| 3150 |
* psfonts.map:: Defining available PostScript fonts. |
| 3151 |
@end menu |
| 3152 |
|
| 3153 |
|
| 3154 |
@node Font concepts |
| 3155 |
@section Font concepts |
| 3156 |
|
| 3157 |
@cindex font concepts |
| 3158 |
|
| 3159 |
The information needed to typeset using a particular font is contained |
| 3160 |
in two files: a @dfn{metric file} that contains shape-independent |
| 3161 |
information and a @dfn{glyph file} that contains the actual shapes of |
| 3162 |
the font's characters. A @dfn{virtual font} is an optional additional |
| 3163 |
file that can specify special ways to construct the characters. @TeX{} |
| 3164 |
itself (or @LaTeX{}) look only at the metric file, but DVI drivers such |
| 3165 |
as Dvips look at all three of these files. |
| 3166 |
|
| 3167 |
An @dfn{encoding file} defines the correspondence between the code |
| 3168 |
numbers of the characters in a font and their descriptive names. Two |
| 3169 |
encoding files used together can describe a reencoding that rearranges, |
| 3170 |
i.e., renumbers, the characters of a font. |
| 3171 |
|
| 3172 |
@menu |
| 3173 |
* Metric files:: Shape-independent font information. |
| 3174 |
* Glyph files:: Character shapes. |
| 3175 |
* Virtual fonts:: Constructing one font from others. |
| 3176 |
* Encodings:: Character codes and character names. |
| 3177 |
* Bitmap font encodings:: Encodings for bitmapped fonts. |
| 3178 |
* PostScript typesetting:: How PostScript typesets a character. |
| 3179 |
@end menu |
| 3180 |
|
| 3181 |
|
| 3182 |
@node Metric files |
| 3183 |
@subsection Metric files |
| 3184 |
|
| 3185 |
@cindex metric files |
| 3186 |
|
| 3187 |
A @dfn{metric file} describes properties of the font that are |
| 3188 |
independent of what the characters actually look like. Aside from |
| 3189 |
general information about the font itself, a metric file has two kinds |
| 3190 |
of information: information about individual characters, organized by |
| 3191 |
character code, and information about sequences of characters. |
| 3192 |
|
| 3193 |
The per-character information specifies the width, height, depth, and |
| 3194 |
italic correction of each character in the font. Any might be zero. |
| 3195 |
|
| 3196 |
@cindex kerning, defined |
| 3197 |
@cindex ligature, defined |
| 3198 |
In addition to information on individual characters, the metric file |
| 3199 |
specifies @dfn{kerning}, i.e., adding or removing space between |
| 3200 |
particular character pairs. It further specifies @dfn{ligature} |
| 3201 |
information: when a sequence of input characters should be typeset as a |
| 3202 |
single (presumably different) ``ligature'' character. For example, it's |
| 3203 |
traditional for the input @samp{fi} to be typeset as `fi', not as |
| 3204 |
`@r{f}@r{i}' (with the dot of the `i' colliding with `f'). (In English, |
| 3205 |
the only common ligatures are fi, fl, ff, ffi, and ffl.) |
| 3206 |
|
| 3207 |
Different typesetting systems use different metric file formats: |
| 3208 |
|
| 3209 |
@itemize @bullet |
| 3210 |
@item |
| 3211 |
@cindex afm files |
| 3212 |
@flindex .afm @r{Adobe metric files} |
| 3213 |
Each PostScript font has an @dfn{Adobe font metrics} (@samp{.afm}) |
| 3214 |
file. These files are plain text, so you can inspect them easily. |
| 3215 |
|
| 3216 |
@item |
| 3217 |
@cindex tfm files |
| 3218 |
@flindex .tfm @r{@TeX{} font metric files} |
| 3219 |
@TeX{} uses @dfn{@TeX{} font metrics} (@samp{.tfm}) files. When you say |
| 3220 |
@samp{\font = @var{font}} in your @TeX{} document, @TeX{} reads a file |
| 3221 |
named @samp{@var{font}.tfm}. (Well, except for the @file{texfonts.map} |
| 3222 |
feature; @pxref{Fontmap,,, kpathsea, Kpathsea}). @TeX{} can then |
| 3223 |
calculate the space occupied by characters from the font when |
| 3224 |
typesetting. In addition, the DVI drivers you use to print or view the |
| 3225 |
DVI file produced by @TeX{} may need to look at the TFM file. |
| 3226 |
|
| 3227 |
@cindex property list files |
| 3228 |
@pindex tftopl |
| 3229 |
@pindex pltotf |
| 3230 |
@flindex .pl @r{property list files} |
| 3231 |
TFM files are binary (and hence are typically much smaller than AFM |
| 3232 |
files). You can use the @code{tftopl} program (@pxref{tftopl |
| 3233 |
invocation,,, web2c, Web2c}) that comes with @TeX{} to transform a TFM |
| 3234 |
file into a human-readable ``property list'' (@samp{.pl}) file. You can |
| 3235 |
also edit a PL file and transform it back to a @TeX{}-readable TFM with |
| 3236 |
the companion program @code{pltotf} (@pxref{pltotf invocation,,, web2c, |
| 3237 |
Web2c}). Editing metrics by hand is not something you're likely to want |
| 3238 |
to do often, but the capability is there. |
| 3239 |
|
| 3240 |
@item |
| 3241 |
@cindex pfm files |
| 3242 |
@flindex .pfm @r{printer font metric files} |
| 3243 |
ATM and other typesetting systems use @dfn{printer font metric} |
| 3244 |
(@samp{.pfm}) files. These are binary files. They are irrelevant in the |
| 3245 |
@TeX{} world, and not freely available, so we will not discuss them |
| 3246 |
further. |
| 3247 |
|
| 3248 |
@end itemize |
| 3249 |
|
| 3250 |
The Afm2tfm program distributed with Dvips converts an AFM file |
| 3251 |
to a TFM file and performs other useful transformations as well. |
| 3252 |
@xref{Invoking afm2tfm}. |
| 3253 |
|
| 3254 |
|
| 3255 |
@node Glyph files |
| 3256 |
@subsection Glyph files |
| 3257 |
|
| 3258 |
@cindex glyph files |
| 3259 |
|
| 3260 |
Although a metric file (see the previous section) contains information |
| 3261 |
about the spatial and other properties of the character at position 75, |
| 3262 |
say, it contains nothing about what the character at position 75 |
| 3263 |
actually looks like. The glyphs---the actual shapes of the letterforms |
| 3264 |
in a font---are defined by other files, which we call glyph files. |
| 3265 |
@TeX{} itself only reads the TFM file for a font; it does not need to |
| 3266 |
know character shapes. |
| 3267 |
|
| 3268 |
A @dfn{glyph file} is a file that defines the shapes of the characters |
| 3269 |
in a font. The shapes can be defined either by outlines or by bitmaps. |
| 3270 |
|
| 3271 |
@cindex outline fonts |
| 3272 |
@cindex arcs |
| 3273 |
@cindex splines |
| 3274 |
PostScript fonts are defined as @dfn{outline fonts}: Each character in |
| 3275 |
the font is defined by giving the mathematical curves (lines, arcs, and |
| 3276 |
splines) that define its contours. Different sizes of a character are |
| 3277 |
generated by linearly scaling a single shape. For example, a 10-point |
| 3278 |
`A' is simply half the size of a 20-point `A'. Nowadays, outline fonts |
| 3279 |
usually also contain @dfn{hints}---additional information to improve the |
| 3280 |
appearance of the font at small sizes or low resolutions. |
| 3281 |
|
| 3282 |
@cindex Type 1 fonts |
| 3283 |
@cindex pfa files |
| 3284 |
@cindex pfb files |
| 3285 |
@flindex .pfa @r{printer font ascii files} |
| 3286 |
@flindex .pfb @r{printer font binary files} |
| 3287 |
Although various kinds of PostScript outline fonts exist, by far the |
| 3288 |
most common, and the only one we will consider, is called @dfn{Type 1}. |
| 3289 |
The glyph files for PostScript Type 1 fonts typically have names ending |
| 3290 |
in @samp{.pfa} (``printer font ASCII'') or @samp{.pfb} (``printer font |
| 3291 |
binary''). |
| 3292 |
|
| 3293 |
@cindex bitmap fonts |
| 3294 |
@flindex .mf @r{Metafont source files} |
| 3295 |
@cindex Metafont source files |
| 3296 |
In contrast, glyph files for Computer Modern and the other standard |
| 3297 |
@TeX{} fonts are @dfn{bitmap fonts}, generated from Metafont |
| 3298 |
(@samp{.mf}) descriptions. The Metafont program distributed with @TeX{} |
| 3299 |
generates bitmaps from these descriptions. |
| 3300 |
|
| 3301 |
@cindex pk files |
| 3302 |
@flindex .@var{nnn}pk @r{packed font bitmaps} |
| 3303 |
The glyph files for @TeX{} bitmap fonts are usually stored in |
| 3304 |
@dfn{packed font} (PK) files. The names of these files end in |
| 3305 |
@samp{.@var{nnn}pk}, where @var{nnn} is the resolution of the font in |
| 3306 |
dots per inch. For example, @file{cmr10.600pk} contains the bitmaps for |
| 3307 |
the @samp{cmr10} font at a resolution of 600@dmn{dpi}. (On DOS |
| 3308 |
filesystems, it's more likely @file{dpi600\cmr10.pk}.) |
| 3309 |
|
| 3310 |
@cindex gf files |
| 3311 |
@pindex gftopk |
| 3312 |
Metafont actually outputs @dfn{generic font} (GF) files, e.g., |
| 3313 |
@file{cmr10.600gf}, but the GF files are usually converted immediately |
| 3314 |
to PK format (using the @code{gftopk} utility that comes with @TeX{}) |
| 3315 |
since PK files are smaller and contain the same information. (The GF |
| 3316 |
format is a historical artifact.) |
| 3317 |
|
| 3318 |
|
| 3319 |
@node Virtual fonts |
| 3320 |
@subsection Virtual fonts |
| 3321 |
|
| 3322 |
@cindex virtual fonts |
| 3323 |
|
| 3324 |
A @dfn{virtual font} is constructed by extracting characters from one |
| 3325 |
or more existing fonts and rearranging them, or synthesizing new |
| 3326 |
characters in various ways. The explanation in this manual is |
| 3327 |
intended to suffice for understanding enough about virtual fonts to |
| 3328 |
use them with Dvips. It isn't a reference manual on virtual fonts. |
| 3329 |
For more information: The primary document on virtual fonts is |
| 3330 |
Donald@tie{}E. Knuth, @cite{TUGboat} 11(1), Apr.@: 1990, pp.@: 13--23, |
| 3331 |
``Virtual Fonts: More Fun for Grand Wizards'' |
| 3332 |
(@url{https://mirror.ctan.org/info/virtual-fonts.knuth}). (Don't be |
| 3333 |
intimidated by the subtitle.) |
| 3334 |
|
| 3335 |
@cindex vf files |
| 3336 |
@cindex vpl files |
| 3337 |
A virtual font (@samp{.vf}) file specifies, for each character in the |
| 3338 |
virtual font, a recipe for typesetting that character. A VF file, like |
| 3339 |
a TFM file, is in a compressed binary format. The @code{vftovp} and |
| 3340 |
@code{vptovf} programs convert a VF file to a human-readable VPL |
| 3341 |
(virtual property list) format and back again. @xref{vftovp |
| 3342 |
invocation,,, web2c, Web2c}, and @ref{vptovf invocation,,, web2c, |
| 3343 |
Web2c}. |
| 3344 |
|
| 3345 |
@cindex base fonts |
| 3346 |
In the case of a PostScript font @var{f} being used in a straightforward |
| 3347 |
way, the recipe says: character @var{i} in the VF font is character |
| 3348 |
@var{j} in font @var{f}. The font @var{f} is called a @dfn{base font}. |
| 3349 |
For example, the VF file could remap the characters of the PostScript |
| 3350 |
font to the positions where @TeX{} expects to find them. |
| 3351 |
@xref{Encodings}. |
| 3352 |
|
| 3353 |
Since @TeX{} reads only TFM files, not VF's, each VF must have a |
| 3354 |
corresponding TFM for use with @TeX{}. This corresponding TFM is |
| 3355 |
created when you run @code{vptovf}. |
| 3356 |
|
| 3357 |
@cindex expansion, of virtual fonts |
| 3358 |
@cindex virtual font expansion |
| 3359 |
You can @dfn{expand} virtual fonts into their base fonts with DVIcopy |
| 3360 |
(@pxref{dvicopy invocation,,, web2c, Web2c}). This is useful if you are |
| 3361 |
using a DVI translator that doesn't itself understand vf's. |
| 3362 |
|
| 3363 |
@pindex ptex @r{JFM} |
| 3364 |
@pindex uptex @r{JFM} |
| 3365 |
@cindex Japanese font metric file |
| 3366 |
@cindex JFM file, and virtual font fallback |
| 3367 |
If a virtual font has no entry at a given codepoint and the first |
| 3368 |
@code{MAPFONT} designates an (u)pTeX JFM, we designate the glyph of |
| 3369 |
the same codepoint in the TFM(JFM) with the smallest font ID. This |
| 3370 |
feature helps to reduce the size of Japanese virtual fonts. For more |
| 3371 |
information about the extensive support of Japanese in TeX, see |
| 3372 |
@url{https://github.com/texjporg}. |
| 3373 |
|
| 3374 |
|
| 3375 |
@node Encodings |
| 3376 |
@subsection Encodings |
| 3377 |
|
| 3378 |
@cindex encodings |
| 3379 |
|
| 3380 |
Every font, whatever its type, has an @dfn{encoding}, that specifies the |
| 3381 |
correspondence between ``logical'' characters and character codes. For |
| 3382 |
example, the ASCII encoding specifies that the character numbered 65 |
| 3383 |
(decimal) is an uppercase `A'. The encoding does not specify what the |
| 3384 |
character at that position looks like; there are lots of ways to draw an |
| 3385 |
`A', and a glyph file (@pxref{Glyph files}) tells how. Nor does it |
| 3386 |
specify how much space that character occupies; that information is in a |
| 3387 |
metric file (@pxref{Metric files}). |
| 3388 |
|
| 3389 |
@cindex Computer Modern, encoding of |
| 3390 |
@TeX{} implicitly assumes a particular encoding for the fonts you use |
| 3391 |
with it. For example, the plain @TeX{} macro @code{\'}, which typesets |
| 3392 |
an acute accent over the following letter, assumes the acute accent is |
| 3393 |
at position 19 (decimal). This happens to be true of standard @TeX{} |
| 3394 |
fonts such as Computer Modern, as you might expect, but it is not true |
| 3395 |
of normal PostScript fonts. |
| 3396 |
|
| 3397 |
It's possible but painful to change all the macros that assume |
| 3398 |
particular character positions. A better solution is to create a new |
| 3399 |
font with the information for the acute accent at position 19, where |
| 3400 |
@TeX{} expects it to be. @xref{Making a font available}. |
| 3401 |
|
| 3402 |
@cindex PostScript encoding |
| 3403 |
@cindex encoding files |
| 3404 |
@cindex encoding vectors, defined |
| 3405 |
|
| 3406 |
PostScript represents encodings as a sequence of 256 character names |
| 3407 |
called an @dfn{encoding vector}. An @dfn{encoding file} (@samp{.enc}) |
| 3408 |
gives such a vector, together with ligature and kerning information |
| 3409 |
(with which we are not concerned at the moment). These encoding files |
| 3410 |
are used by the Afm2tfm program. Encoding files are also downloaded to |
| 3411 |
the PostScript interpreter in your printer if you use one of them in |
| 3412 |
place of the default encoding vector for a particular PostScript font. |
| 3413 |
|
| 3414 |
@flindex dvips.enc |
| 3415 |
@flindex 8r.enc |
| 3416 |
@flindex texmext.enc |
| 3417 |
@flindex texmital.enc |
| 3418 |
@flindex texmsym.enc |
| 3419 |
@flindex reencode/*.enc |
| 3420 |
Examples of encodings: the @file{dvips.enc} encoding file that comes |
| 3421 |
with the Fontname distribution (@url{http://tug.org/fontname}) is a |
| 3422 |
good (but not perfect) approximation to the @TeX{} encoding for |
| 3423 |
@TeX{}'s Computer Modern text fonts. This is the encoding of the |
| 3424 |
fonts that originated with Dvips, such as @file{ptmr.tfm}. The |
| 3425 |
distribution includes many other encoding files; for example, |
| 3426 |
@file{8r.enc}, which is the base font for the current PostScript font |
| 3427 |
distribution, and three corresponding to the @TeX{} mathematics fonts: |
| 3428 |
@file{texmext.enc} for math extensions, @file{texmital.enc} for math |
| 3429 |
italics, and @file{texmsym.enc} for math symbols. |
| 3430 |
|
| 3431 |
|
| 3432 |
@node Bitmap font encodings |
| 3433 |
@subsection Bitmap font encodings |
| 3434 |
|
| 3435 |
@cindex bitmap font encodings |
| 3436 |
@cindex font encodings, bitmap |
| 3437 |
@cindex encodings, for bitmap fonts |
| 3438 |
|
| 3439 |
To dvips, bitmapped fonts do not have any notion of linguistics; they |
| 3440 |
are simply a vector of glyphs. By comparison, PostScript fonts are |
| 3441 |
required to contain an encoding vector that at least provides |
| 3442 |
glyph names; these names can permit PostScript and PDF viewers to |
| 3443 |
extract legible text from PostScript and PDF output. |
| 3444 |
|
| 3445 |
Unlike previous versions, dvips versions 2020 and later add glyph |
| 3446 |
naming information to Type 3 bitmapped fonts (if they can locate such |
| 3447 |
information) as an Encoding vector. This provides some support for |
| 3448 |
search, for copy and paste, and even some limited support for |
| 3449 |
accessibility. The @samp{bitmapfontenc} command line option |
| 3450 |
(@pxref{Option details} and @code{bitmapfontenc} configuration option |
| 3451 |
(@pxref{Configuration file commands}) enable and disable this |
| 3452 |
functionality; by default it is set to enabled, without warnings. |
| 3453 |
|
| 3454 |
@flindex dvips-all.enc |
| 3455 |
To do this, dvips must find encoding information for the bitmapped |
| 3456 |
fonts. It does this by first searching for a font-specific encoding |
| 3457 |
file; for instance, for cmr10, it will search for @file{dvips-cmr10.enc} |
| 3458 |
in the standard encoding path. If it does not find such a file, it |
| 3459 |
will search for a @file{dvips-all.enc} file which contains a base set of |
| 3460 |
encodings for many fonts. |
| 3461 |
|
| 3462 |
The specific syntax of an encoding file is unspecified, except that it |
| 3463 |
must be a PostScript fragment that leaves exactly one object on the |
| 3464 |
operand stack. (This is different from the encoding files used to |
| 3465 |
define encodings for PostScript fonts, described earlier). Normally |
| 3466 |
that object is just an array of 256 names; in this case, that array is |
| 3467 |
used as the encoding vector for the font. Alternatively, the object |
| 3468 |
can be a procedure that, when executed, leaves a legal encoding vector |
| 3469 |
on the stack. This second option is made available to support future |
| 3470 |
enhancements that may add additional constructs to the font dictionary |
| 3471 |
to enhance the interpretation of font characters. |
| 3472 |
|
| 3473 |
The @file{dvips-all.enc} file contains encodings for many fonts, and |
| 3474 |
it is loaded by dvips at most once. The format is just a sequence of |
| 3475 |
font names, one per line, each terminated by a colon, followed by the |
| 3476 |
encoding to use for those files. |
| 3477 |
|
| 3478 |
@cindex bounding box, for bitmap fonts |
| 3479 |
@cindex coordinate system, for bitmap fonts |
| 3480 |
As part of its operation, to enable heuristics in PostScript and |
| 3481 |
PDF viewers to properly identify word breaks and column gutters, |
| 3482 |
dvips also generates a modified font bounding box and a modified |
| 3483 |
font coordinate system. |
| 3484 |
|
| 3485 |
|
| 3486 |
@node PostScript typesetting |
| 3487 |
@subsection How PostScript typesets a character |
| 3488 |
|
| 3489 |
@cindex typesetting in PostScript |
| 3490 |
@cindex character lookup procedure in PostScript |
| 3491 |
|
| 3492 |
The output of Dvips is a program in the PostScript language that |
| 3493 |
instructs your (presumably PostScript-capable) printer how to typeset |
| 3494 |
your document by transforming it into toner on paper. Your printer, in |
| 3495 |
turn, contains a PostScript interpreter that carries out the |
| 3496 |
instructions in this typesetting program. |
| 3497 |
|
| 3498 |
The program must include the definition of any PostScript fonts that you |
| 3499 |
use in your document. Fonts built into your printer (probably the |
| 3500 |
standard 35: @samp{Times-Roman}, @samp{ZapfDingbats}, @dots{}) are |
| 3501 |
defined within the interpreter itself. Other fonts must be downloaded |
| 3502 |
as pfa or pfb files (@pxref{Glyph files}) from your host (the computer |
| 3503 |
on which you're running Dvips). |
| 3504 |
|
| 3505 |
You may be wondering exactly how a PostScript interpreter figures out |
| 3506 |
what character to typeset, with this mass of metrics, glyphs, encodings, |
| 3507 |
and other information. (If you're not wondering, skip this section |
| 3508 |
@dots{}) |
| 3509 |
|
| 3510 |
@findex show @r{PostScript operator} |
| 3511 |
The basic PostScript operator for imaging characters is |
| 3512 |
@code{show}. Suppose you've asked @TeX{} to typeset an `S'. This will |
| 3513 |
eventually wind up in the Dvips output as the equivalent of this |
| 3514 |
PostScript operation: |
| 3515 |
|
| 3516 |
@example |
| 3517 |
(S) show |
| 3518 |
@end example |
| 3519 |
|
| 3520 |
@noindent Here is how PostScript typesets the `S': |
| 3521 |
|
| 3522 |
@enumerate |
| 3523 |
@item |
| 3524 |
@cindex ASCII character codes, used by PostScript |
| 3525 |
PostScript interpreters use ASCII; therefore `S' is represented as the |
| 3526 |
integer 83. (Any of the 256 possible characters representable in a |
| 3527 |
standard 8-bit byte can be typeset.) |
| 3528 |
|
| 3529 |
@item |
| 3530 |
@cindex current font, in PostScript |
| 3531 |
@cindex dictionary, PostScript language |
| 3532 |
A PostScript @dfn{dictionary} is a mapping of names to arbitrary values. |
| 3533 |
A font, to the interpreter, is a dictionary which contains entries for |
| 3534 |
certain names. (If these entries are missing, the interpreter refuses |
| 3535 |
to do anything with that font.) |
| 3536 |
|
| 3537 |
PostScript has a notion of ``the current font''---whatever font is |
| 3538 |
currently being typeset in. |
| 3539 |
|
| 3540 |
@item |
| 3541 |
@cindex encoding vectors, in Type 1 fonts |
| 3542 |
@findex Encoding @r{Type 1 dictionary} |
| 3543 |
One of the mandatory entries in a font dictionary is @samp{Encoding}, |
| 3544 |
which defines the encoding vector (@pxref{Encodings}) for that font. |
| 3545 |
This vector of 256 names maps each possible input character to a name. |
| 3546 |
|
| 3547 |
@item |
| 3548 |
The interpreter retrieves the entry at position 83 of the encoding |
| 3549 |
vector. This value is a PostScript name: @code{/S}. |
| 3550 |
|
| 3551 |
@item |
| 3552 |
@findex CharStrings @r{Type 1 dictionary} |
| 3553 |
@cindex dictionary, @code{CharStrings} |
| 3554 |
For Type 1 fonts (we're not going to discuss anything else), the |
| 3555 |
interpreter now looks up @code{/S} as a key in a dictionary named |
| 3556 |
@code{CharStrings}, another mandatory entry in a font dictionary. |
| 3557 |
|
| 3558 |
@item |
| 3559 |
@cindex hints |
| 3560 |
@cindex character definitions in PostScript |
| 3561 |
The value of @code{S} in @code{CharStrings} is the equivalent of a |
| 3562 |
series of standard PostScript commands like @samp{curveto}, |
| 3563 |
@samp{lineto}, @samp{fill}, and so on. These commands are executed to |
| 3564 |
draw the character. There can also be @dfn{hint information} that helps |
| 3565 |
adapt the character to low-resolution rasters. (@xref{Glyph files}.) |
| 3566 |
The commands are actually represented in a more compact way than |
| 3567 |
standard PostScript source; see the Type 1 book for details. |
| 3568 |
|
| 3569 |
@end enumerate |
| 3570 |
|
| 3571 |
This method for typesetting characters is used in both Level 1 and Level |
| 3572 |
2 PostScript. See the PostScript reference manuals for more |
| 3573 |
information. |
| 3574 |
|
| 3575 |
|
| 3576 |
@node Making a font available |
| 3577 |
@section Making a PostScript font available |
| 3578 |
|
| 3579 |
@cindex installing fonts |
| 3580 |
@cindex fonts, installing |
| 3581 |
|
| 3582 |
To make a PostScript font available in a @TeX{} document, you need to |
| 3583 |
install the font on your system and then define it within the document. |
| 3584 |
Once you have installed the font, of course, it is available for any |
| 3585 |
document thereafter and you don't need to reinstall it. You must have |
| 3586 |
an AFM file for any font you install. Unless the font is built into your |
| 3587 |
printer, you must also have a PFA or PFB file. |
| 3588 |
|
| 3589 |
In the following examples, we use the font @samp{Times-Roman} to |
| 3590 |
illustrate the process. But you should use the prebuilt fonts for Times |
| 3591 |
and the other standard fonts, rather than rebuilding them. The prebuilt |
| 3592 |
fonts are made using a more complicated process than that described |
| 3593 |
here, to make them work as well as possible with @TeX{}. So following |
| 3594 |
the steps in this manual will not generate files identical to the |
| 3595 |
distributed ones. @xref{PostScript font installation}, for pointers to |
| 3596 |
the prebuilt fonts. |
| 3597 |
|
| 3598 |
Installation of a PostScript font proceeds in three steps. @xref{Font |
| 3599 |
concepts}, for descriptions of the various files involved. |
| 3600 |
|
| 3601 |
@enumerate |
| 3602 |
@item |
| 3603 |
Run @code{afm2tfm} to create a TFM file for the original font, |
| 3604 |
and the VPL form of the virtual font: |
| 3605 |
@example |
| 3606 |
afm2tfm Times-Roman -v ptmr rptmr |
| 3607 |
@end example |
| 3608 |
|
| 3609 |
@item |
| 3610 |
Run @code{vptovf} to generate a VF and TFM file for the virtual font |
| 3611 |
from the VPL file: |
| 3612 |
@example |
| 3613 |
vptovf ptmr.vpl ptmr.vf ptmr.tfm |
| 3614 |
@end example |
| 3615 |
|
| 3616 |
@item |
| 3617 |
Insert an entry for the font in @file{psfonts.map} (@pxref{psfonts.map}): |
| 3618 |
@example |
| 3619 |
rptmr Times-Roman <ptmr8a.pfa |
| 3620 |
@end example |
| 3621 |
|
| 3622 |
@item |
| 3623 |
Install the files in the standard locations, as in: |
| 3624 |
@example |
| 3625 |
cp ptmr.vf @var{fontdir}/vf/@dots{} |
| 3626 |
cp *ptmr.tfm @var{fontdir}/tfm/@dots{} |
| 3627 |
cp ptmr.afm @var{fontdir}/afm/@dots{} |
| 3628 |
cp ptmr.pf? @var{fontdir}/type1/@dots{} |
| 3629 |
@end example |
| 3630 |
@end enumerate |
| 3631 |
|
| 3632 |
The simplest invocation of Afm2tfm to make virtual fonts goes something |
| 3633 |
like this: |
| 3634 |
|
| 3635 |
@pindex afm2tfm |
| 3636 |
@example |
| 3637 |
afm2tfm Times-Roman -v ptmr rptmr |
| 3638 |
@end example |
| 3639 |
|
| 3640 |
@noindent |
| 3641 |
This reads the file @file{Times-Roman.afm}, and produces two files as |
| 3642 |
output, namely the virtual property list file @file{ptmr.vpl}, and the |
| 3643 |
``raw'' font metric file @file{rptmr.tfm}. To use the font in @TeX{}, |
| 3644 |
you first run |
| 3645 |
|
| 3646 |
@pindex vptovf |
| 3647 |
@example |
| 3648 |
vptovf ptmr.vpl ptmr.vf ptmr.tfm |
| 3649 |
@end example |
| 3650 |
|
| 3651 |
@noindent |
| 3652 |
You should then install the virtual font file @file{ptmr.vf} where Dvips |
| 3653 |
will see it and install @file{ptmr.tfm} and @file{rptmr.tfm} where |
| 3654 |
@TeX{} and Dvips will see them. |
| 3655 |
|
| 3656 |
Using these raw fonts is not recommended; there are no raw fonts in the |
| 3657 |
prebuilt PostScript fonts distributed along with Dvips. But |
| 3658 |
nevertheless, that's how Afm2tfm presently operates, so that's what we |
| 3659 |
document here. The @samp{r} prefix convention is likewise historical |
| 3660 |
accident. |
| 3661 |
|
| 3662 |
You can also make more complex virtual fonts by editing @file{ptmr.vpl} |
| 3663 |
before running @samp{vptovf}; such editing might add the uppercase Greek |
| 3664 |
characters in the standard @TeX{} positions, for instance. (This has |
| 3665 |
already been done for the prebuilt fonts.) |
| 3666 |
|
| 3667 |
Once the files have been installed, you're all set. You can now do |
| 3668 |
things like this in @TeX{}: |
| 3669 |
@example |
| 3670 |
\font\myfont = ptmr at 12pt |
| 3671 |
\myfont Hello, I am being typeset in 12-point Times-Roman. |
| 3672 |
@end example |
| 3673 |
|
| 3674 |
Thus, we have two fonts, one actual (@samp{rptmr}, which is analogous to |
| 3675 |
the font in the printer) and one virtual (@samp{ptmr}, which has been |
| 3676 |
remapped to the standard @TeX{} encoding (almost)), and has typesetting |
| 3677 |
know-how added. You could also say |
| 3678 |
|
| 3679 |
@example |
| 3680 |
\font\raw = rptmr at 10pt |
| 3681 |
@end example |
| 3682 |
|
| 3683 |
@noindent |
| 3684 |
and typeset directly with that, but then you would have no ligatures or |
| 3685 |
kerning, and you would have to use Adobe character positions for special |
| 3686 |
letters like |
| 3687 |
@tex |
| 3688 |
\AE. |
| 3689 |
@end tex |
| 3690 |
@ifinfo |
| 3691 |
the ligature `AE'. |
| 3692 |
@end ifinfo |
| 3693 |
The virtual font @samp{ptmr} not only has ligatures and kerning, and |
| 3694 |
most of the standard accent conventions of @TeX{}, it also has a few |
| 3695 |
additional features not present in the Computer Modern fonts. For |
| 3696 |
example, it includes all the Adobe characters (such as the Polish ogonek |
| 3697 |
and the French guillemots). The only things you lose from ordinary |
| 3698 |
@TeX{} text fonts are the dotless `j' (which can be hacked into the VPL |
| 3699 |
file with literal PostScript specials if you have the patience) and |
| 3700 |
uppercase Greek letters (which just don't exist unless you buy them |
| 3701 |
separately). @xref{Reencoding with Afm2tfm}. |
| 3702 |
|
| 3703 |
As a final step you need to record information about both the virtual |
| 3704 |
font and the original font (if you ever might want to use it) in the |
| 3705 |
@file{psfonts.map} file (@pxref{psfonts.map}). For our example, you'd |
| 3706 |
insert the following into @file{psfonts.map}: |
| 3707 |
@example |
| 3708 |
rptmr Times-Roman <ptmr8a.pfa |
| 3709 |
@end example |
| 3710 |
|
| 3711 |
@noindent Of course, @code{Times-Roman} is already built in to most every |
| 3712 |
printer, so there's no need to download any Type 1 file for it. But if |
| 3713 |
you are actually following these instructions for new fonts, most likely |
| 3714 |
they are not built in to the printer. |
| 3715 |
|
| 3716 |
@cindex memory, used by PostScript fonts |
| 3717 |
@cindex efficiency, and fonts |
| 3718 |
These PostScript fonts can be scaled to any size. Go wild! Using |
| 3719 |
PostScript fonts, however, does use up a great deal of the printer's |
| 3720 |
memory and it does take time. You may find downloading bitmap fonts |
| 3721 |
(possibly compressed, with the @samp{Z} option) to be faster than using |
| 3722 |
the built-in PostScript fonts. |
| 3723 |
|
| 3724 |
|
| 3725 |
@node Invoking afm2tfm |
| 3726 |
@section Invoking Afm2tfm |
| 3727 |
|
| 3728 |
@pindex afm2tfm |
| 3729 |
|
| 3730 |
The Afm2tfm program converts an AFM file for a PostScript font to a TFM |
| 3731 |
file and a VPL file for a corresponding virtual font (or, in its |
| 3732 |
simplest form, to a TFM file for the PostScript font itself). The |
| 3733 |
results of the conversion are affected by the command-line options and |
| 3734 |
especially by the reencodings you can specify with those options. You |
| 3735 |
can also obtain special effects such as an oblique font. |
| 3736 |
|
| 3737 |
@pindex fontinst |
| 3738 |
@cindex virtual fonts, creating |
| 3739 |
@cindex Jeffrey, Alan |
| 3740 |
Alternatives to Afm2tfm for creating virtual fonts include |
| 3741 |
@code{fontinst} @url{https://ctan.org/pkg/fontinst}, |
| 3742 |
@code{lcdf-typetools}, particularly @code{otftotfm} |
| 3743 |
(@url{https://ctan.org/pkg/lcdf-typetools}), and @code{afm2pl} |
| 3744 |
(@url{http://tex.aanhet.net/afm2pl/}), among others. |
| 3745 |
|
| 3746 |
@menu |
| 3747 |
* Changing font encodings:: Reencoding with -t, -p, -T. |
| 3748 |
* Special font effects:: Oblique fonts, small caps, and such. |
| 3749 |
* Afm2tfm options:: afm2tfm command-line options. |
| 3750 |
@end menu |
| 3751 |
|
| 3752 |
|
| 3753 |
@node Changing font encodings |
| 3754 |
@subsection Changing font encodings |
| 3755 |
|
| 3756 |
@cindex encoding changes |
| 3757 |
@cindex fonts, changing encoding of |
| 3758 |
|
| 3759 |
Afm2tfm allows you to specify a different encoding for a PostScript font |
| 3760 |
(for a general introduction to encodings, @pxref{Encodings}). The |
| 3761 |
@samp{-t} option changes the @TeX{} encoding, @samp{-p} changes the |
| 3762 |
PostScript encoding, and @samp{-T} changes both simultaneously, as |
| 3763 |
detailed in the sections below. |
| 3764 |
|
| 3765 |
@menu |
| 3766 |
* Changing TeX encodings:: Where TeX finds a character. |
| 3767 |
* Changing PostScript encodings:: Where PostScript finds a character. |
| 3768 |
* Changing both encodings:: One and the same, simultaneously. |
| 3769 |
* Reencoding with Afm2tfm:: Problems with the default encoding. |
| 3770 |
* Encoding file format:: Syntax of an encoding file. |
| 3771 |
@end menu |
| 3772 |
|
| 3773 |
|
| 3774 |
@node Changing TeX encodings |
| 3775 |
@subsubsection @samp{-t}: Changing @TeX{} encodings |
| 3776 |
|
| 3777 |
@cindex changing @TeX{} encodings |
| 3778 |
@cindex @TeX{} encoding, changing |
| 3779 |
|
| 3780 |
@opindex -t @var{tex-enc} |
| 3781 |
To build a virtual font with Afm2tfm, you specify the @samp{-v} or |
| 3782 |
@samp{-V} option. You can then specify an encoding for that virtual font |
| 3783 |
with @samp{-t @var{tex-enc}}. (@samp{-t} is ignored if neither |
| 3784 |
@samp{-v} nor @samp{-V} is present.) Any ligature and kerning |
| 3785 |
information you specify in @var{tex-enc} will be used in the VPL, in |
| 3786 |
addition to the ligature and kerning information from the AFM file. |
| 3787 |
|
| 3788 |
If the AFM file has no entry for a character specified in @var{tex-enc}, |
| 3789 |
that character will be omitted from the output VPL. |
| 3790 |
|
| 3791 |
@flindex texmsym.enc |
| 3792 |
The @samp{-t} option is likely to be needed when you have a PostScript |
| 3793 |
font corresponding to a @TeX{} font other than a normal text font such |
| 3794 |
as Computer Modern. For instance, if you have a PostScript font that |
| 3795 |
contains math symbols, you'd probably want to use the encoding in the |
| 3796 |
@file{texmsym.enc} file supplied with Dvips. (For a start; to actually |
| 3797 |
get usable math fonts, you have to define much more than just an |
| 3798 |
encoding.) |
| 3799 |
|
| 3800 |
|
| 3801 |
@node Changing PostScript encodings |
| 3802 |
@subsubsection @samp{-p}: Changing PostScript encodings |
| 3803 |
|
| 3804 |
@cindex changing PostScript encodings |
| 3805 |
@cindex PostScript encoding, changing |
| 3806 |
@opindex -p @var{ps-enc} |
| 3807 |
|
| 3808 |
By default, Afm2tfm uses the encoding it finds in the AFM file. You can |
| 3809 |
specify a different PostScript encoding with @samp{-p @var{ps-enc}}. |
| 3810 |
This makes the raw TFM file (the one output by Afm2tfm) have the |
| 3811 |
encoding specified in the encoding file @var{ps-enc}. Any ligature or |
| 3812 |
kern information specified in @var{ps-enc} is ignored by Afm2tfm, since |
| 3813 |
ligkern info is always omitted from the raw TFM. |
| 3814 |
|
| 3815 |
If you use this option, you must also arrange to download @var{ps-enc} |
| 3816 |
as part of any document that uses this font. You do this by adding a |
| 3817 |
line like the following one to @file{psfonts.map} (@pxref{psfonts.map}): |
| 3818 |
@example |
| 3819 |
zpopr Optima "MyEncoding ReEncodeFont" <myenc.enc |
| 3820 |
@end example |
| 3821 |
|
| 3822 |
@findex trademark @r{character, accessing} |
| 3823 |
@findex registered @r{character, accessing} |
| 3824 |
@cindex extra characters, accessing |
| 3825 |
Using @samp{-p} is the only way to access characters in a PostScript |
| 3826 |
font that are neither encoded in the AFM file nor constructed from other |
| 3827 |
characters. For instance, Adobe's @samp{Times-Roman} font contains the |
| 3828 |
extra characters @samp{trademark} and @samp{registered} (among others); |
| 3829 |
these can only be accessed through such a PostScript reencoding. |
| 3830 |
|
| 3831 |
@findex 8r @r{encoding, and extra characters} |
| 3832 |
The `8r' base encoding used for the current PostScript font |
| 3833 |
distribution does do this reencoding, for precisely this reason. |
| 3834 |
|
| 3835 |
|
| 3836 |
@node Changing both encodings |
| 3837 |
@subsubsection @samp{-T}: Changing both @TeX{} and PostScript encodings |
| 3838 |
|
| 3839 |
@opindex -T @var{enc-file} |
| 3840 |
|
| 3841 |
The option @samp{-T @var{enc-file}} is equivalent to @samp{-p |
| 3842 |
@var{enc-file} -t @var{enc-file}}. If you make regular use of a private |
| 3843 |
non-standard reencoding @samp{-T} is usually a better idea than the |
| 3844 |
individual options, to avoid unexpected inconsistencies in mapping |
| 3845 |
otherwise. An example of when you might use this option is a dingbats |
| 3846 |
font: when you have a @TeX{} encoding that is designed to be used with a |
| 3847 |
particular PostScript font. |
| 3848 |
|
| 3849 |
|
| 3850 |
@node Reencoding with Afm2tfm |
| 3851 |
@subsubsection Reencoding with Afm2tfm |
| 3852 |
|
| 3853 |
@cindex reencoding |
| 3854 |
@cindex remapping |
| 3855 |
|
| 3856 |
The Afm2tfm program creates the TFM and VF files for the virtual font |
| 3857 |
corresponding to a PostScript font by @dfn{reencoding} the PostScript |
| 3858 |
font. Afm2tfm generates these files from two encodings: one for @TeX{} |
| 3859 |
and one for PostScript. The @TeX{} encoding is used to map character |
| 3860 |
numbers to character names while the PostScript encoding is used to map |
| 3861 |
each character name to a possibly different number. In combination, you |
| 3862 |
can get access to any character of a PostScript font at any position for |
| 3863 |
@TeX{} typesetting. |
| 3864 |
|
| 3865 |
In the default case, when you specify none of the @code{-t}, @code{-p}, |
| 3866 |
or @code{-T} options, Afm2tfm uses a default @TeX{} encoding (which |
| 3867 |
mostly corresponds to the Computer Modern text fonts) and the PostScript |
| 3868 |
encoding found in the AFM file being read. The reencoding is also |
| 3869 |
sometimes called a @dfn{remapping}. |
| 3870 |
|
| 3871 |
For example, the default encodings reencode the acute accent in two |
| 3872 |
steps: first the default @TeX{} encoding maps the number 19 to the |
| 3873 |
character name @samp{acute}; then the default PostScript encoding, as |
| 3874 |
found in the AFM file for an ordinary PostScript font, maps the |
| 3875 |
character name @samp{acute} to the number 194. (The PostScript encoding |
| 3876 |
works in reverse, by looking in the encoding vector for the name and |
| 3877 |
then yielding the corresponding number.) The combined mapping of 19 to |
| 3878 |
194 shows up explicitly in the VF file and also implicitly in the fact |
| 3879 |
that the properties of PostScript character 194 appear in position 19 of |
| 3880 |
the TFM file for the virtual font. |
| 3881 |
|
| 3882 |
@cindex accents, in wrong position |
| 3883 |
@cindex Hungarian umlaut |
| 3884 |
@cindex dot accent |
| 3885 |
@cindex Scandinavian A ring |
| 3886 |
@cindex A ring, Scandinavian letter |
| 3887 |
The default encoding of the distributed fonts (e.g., @file{ptmr.tfm}) |
| 3888 |
mostly follows plain @TeX{} conventions for accents. The exceptions: |
| 3889 |
the Hungarian umlaut (which is at position @code{0x7D} in @samp{cmr10}, |
| 3890 |
but position @code{0xCD} in @samp{ptmr}); the dot accent (at positions |
| 3891 |
@code{0x5F} and @code{0xC7}, respectively); and the Scandinavian A ring |
| 3892 |
@code{\AA}, whose definition needs different tweaking. In order to use |
| 3893 |
these accents with PostScript fonts or in math mode when |
| 3894 |
@code{\textfont0} is a PostScript font, you will need to use the |
| 3895 |
following definitions. These definitions will not work with the |
| 3896 |
Computer Modern fonts for the relevant accents. They are already part |
| 3897 |
of the distributed @file{psfonts.sty} for use with @LaTeX{}. |
| 3898 |
|
| 3899 |
@findex \H |
| 3900 |
@findex \. |
| 3901 |
@findex \dot |
| 3902 |
@findex \AA |
| 3903 |
@example |
| 3904 |
\def\H#1@{@{\accent"CD #1@}@} |
| 3905 |
\def\.#1@{@{\accent"C7 #1@}@} |
| 3906 |
\def\dot@{\mathaccent"70C7 @} |
| 3907 |
\newdimen\aadimen |
| 3908 |
\def\AA@{\leavevmode\setbox0\hbox@{h@}\aadimen\ht0 |
| 3909 |
\advance\aadimen-1ex\setbox0\hbox@{A@}\rlap@{\raise.67\aadimen |
| 3910 |
\hbox to \wd0@{\hss\char'27\hss@}@}A@} |
| 3911 |
@end example |
| 3912 |
|
| 3913 |
@vindex CODINGSCHEME |
| 3914 |
As a kind of summary, here are the @samp{CODINGSCHEME}s that result from |
| 3915 |
the various possible choices for reencoding. |
| 3916 |
|
| 3917 |
@table @asis |
| 3918 |
@item default encoding |
| 3919 |
@example |
| 3920 |
(CODINGSCHEME TeX text + AdobeStandardEncoding) |
| 3921 |
@end example |
| 3922 |
|
| 3923 |
@item @samp{-p dc.enc} |
| 3924 |
@example |
| 3925 |
(CODINGSCHEME TeX text + DCEncoding) |
| 3926 |
@end example |
| 3927 |
|
| 3928 |
@item @samp{-t dc.enc} |
| 3929 |
@example |
| 3930 |
(CODINGSCHEME DCEncoding + AdobeStandardEncoding) |
| 3931 |
@end example |
| 3932 |
|
| 3933 |
@item @samp{-T dc.enc} |
| 3934 |
@example |
| 3935 |
(CODINGSCHEME DCEncoding + DCEncoding) |
| 3936 |
@end example |
| 3937 |
|
| 3938 |
@end table |
| 3939 |
|
| 3940 |
@noindent The @samp{CODINGSCHEME} line appears in the VPL file but is |
| 3941 |
ignored by Dvips. |
| 3942 |
|
| 3943 |
|
| 3944 |
@node Encoding file format |
| 3945 |
@subsubsection Encoding file format |
| 3946 |
|
| 3947 |
@cindex encoding file format |
| 3948 |
|
| 3949 |
Afm2tfm's encoding files have the same format as an encoding vector in a |
| 3950 |
PostScript font. Here is a skeletal example: |
| 3951 |
|
| 3952 |
@example |
| 3953 |
% @r{Comments are ignored, unless the first word after the percent sign} |
| 3954 |
% @r{is @samp{LIGKERN}; see below.} |
| 3955 |
/MyEncoding [ % @r{exactly 256 entries follow, each with a leading @samp{/}} |
| 3956 |
/Alpha /Beta /Gamma /Delta @dots{} |
| 3957 |
/A /B @dots{} /Z |
| 3958 |
@dots{} /.notdef /xfooaccent /yfooaccent /zfooaccent |
| 3959 |
] def |
| 3960 |
@end example |
| 3961 |
|
| 3962 |
These encoding files are downloaded as part of changing the encoding at |
| 3963 |
the PostScript level (see the previous section). |
| 3964 |
|
| 3965 |
@cindex comments, in encoding files |
| 3966 |
Comments, which start with a percent sign and continue until the end |
| 3967 |
of the line, are ignored unless they start with @samp{LIGKERN} (see below). |
| 3968 |
|
| 3969 |
The first non-comment word of the file must start with a forward slash |
| 3970 |
@samp{/} (i.e., a PostScript literal name) and defines the name of the |
| 3971 |
encoding. The next word must be an left bracket @samp{[}. Following |
| 3972 |
that must be precisely 256 character names; use @samp{/.notdef} for any |
| 3973 |
that you want to leave undefined. Then there must be a matching right |
| 3974 |
bracket @code{]}. A final @samp{def} token is optional. All names are |
| 3975 |
case-sensitive. |
| 3976 |
|
| 3977 |
Any ligature or kern information is given as a comment. If the first |
| 3978 |
word after the @samp{%} is @samp{LIGKERN}, then the entire rest of the |
| 3979 |
line is parsed for ligature and kern information. This ligature and |
| 3980 |
kern information is given in groups of words: each group is terminated |
| 3981 |
by a space and a semicolon and (unless the semicolon is at the end of a |
| 3982 |
line) another space. |
| 3983 |
|
| 3984 |
@findex LIGKERN @r{encoding file command} |
| 3985 |
In these @code{LIGKERN} statements, three types of information may be |
| 3986 |
specified. These three types are ligature pairs, kerns to ignore, and |
| 3987 |
the character value of this font's boundary character. |
| 3988 |
|
| 3989 |
@cindex boundary character |
| 3990 |
Throughout a @code{LIGKERN} statement, the boundary character is |
| 3991 |
specified as @samp{||}. To set the font's boundary character value for |
| 3992 |
@TeX{}: |
| 3993 |
|
| 3994 |
@example |
| 3995 |
% LIGKERN || = 39 ; |
| 3996 |
@end example |
| 3997 |
|
| 3998 |
To indicate a kern to remove, give the names of the two characters |
| 3999 |
(without the leading slash) separated by @samp{@{@}}, as in @samp{one |
| 4000 |
@{@} one ;}. This is intended to be reminiscent of the way you might |
| 4001 |
use @samp{@{@}} in a @TeX{} file to turn off ligatures or kerns at a |
| 4002 |
particular location. Either or both of the character names can be given |
| 4003 |
as @samp{*}, which is a wild card matching any character; thus, all |
| 4004 |
kerns can be removed with @samp{* @{@} * ;}. |
| 4005 |
|
| 4006 |
@cindex ligature operations |
| 4007 |
@cindex Metafont ligature operations |
| 4008 |
To specify a ligature, specify the names of the pair of characters, |
| 4009 |
followed by the ligature operation (as in Metafont), followed by the |
| 4010 |
replacing character name. Either (but not both) of the first two |
| 4011 |
characters can be @samp{||} to indicate a word boundary. |
| 4012 |
|
| 4013 |
@findex =: @r{ligature operation} |
| 4014 |
The most common operation is @samp{=:} meaning that both characters are |
| 4015 |
removed and replaced by the third character, but by adding the @samp{|} |
| 4016 |
character on either side of the @samp{=:}, you can retain either or both |
| 4017 |
of the two leading characters. In addition, by suffixing the ligature |
| 4018 |
operation with one or two @samp{>} signs, you can make the ligature |
| 4019 |
scanning operation skip that many resulting characters before |
| 4020 |
proceeding. This works just like in Metafont. For example, the `fi' |
| 4021 |
ligature is specified with @w{@samp{f i =: fi ;}}. A more convoluted |
| 4022 |
ligature is @samp{one one |=:|>> exclam ;} which separates a pair of |
| 4023 |
adjacent @code{1}'s with an exclamation point, and then skips over two |
| 4024 |
of the resulting characters before continuing searching for ligatures |
| 4025 |
and kerns. You cannot give more @t{>}'s than @t{|}'s in an ligature |
| 4026 |
operation, so there are a total of eight possibilities: |
| 4027 |
|
| 4028 |
@example |
| 4029 |
=: |=: |=:> =:| =:|> |=:| |=:|> |=:|>> |
| 4030 |
@end example |
| 4031 |
|
| 4032 |
The default set of ligatures and kerns built in to Afm2tfm is: |
| 4033 |
|
| 4034 |
@example |
| 4035 |
% LIGKERN question quoteleft =: questiondown ; |
| 4036 |
% LIGKERN exclam quoteleft =: exclamdown ; |
| 4037 |
% LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ; |
| 4038 |
% LIGKERN quoteleft quoteleft =: quotedblleft ; |
| 4039 |
% LIGKERN quoteright quoteright =: quotedblright ; |
| 4040 |
% LIGKERN space @{@} * ; * @{@} space ; 0 @{@} * ; * @{@} 0 ; |
| 4041 |
% LIGKERN 1 @{@} * ; * @{@} 1 ; 2 @{@} * ; * @{@} 2 ; 3 @{@} * ; * @{@} 3 ; |
| 4042 |
% LIGKERN 4 @{@} * ; * @{@} 4 ; 5 @{@} * ; * @{@} 5 ; 6 @{@} * ; * @{@} 6 ; |
| 4043 |
% LIGKERN 7 @{@} * ; * @{@} 7 ; 8 @{@} * ; * @{@} 8 ; 9 @{@} * ; * @{@} 9 ; |
| 4044 |
@end example |
| 4045 |
|
| 4046 |
|
| 4047 |
@node Special font effects |
| 4048 |
@subsection Special font effects |
| 4049 |
|
| 4050 |
@cindex oblique fonts |
| 4051 |
@cindex slanted fonts |
| 4052 |
@cindex fonts, slanted |
| 4053 |
Besides the reencodings described in the previous section, Afm2tfm can |
| 4054 |
do other manipulations. (Again, it's best to use the prebuilt fonts |
| 4055 |
rather than attempting to remake them.) |
| 4056 |
|
| 4057 |
@samp{-s @var{slant}} makes an obliqued variant, as in: |
| 4058 |
|
| 4059 |
@example |
| 4060 |
afm2tfm Times-Roman -s .167 -v ptmro rptmro |
| 4061 |
@end example |
| 4062 |
|
| 4063 |
@noindent |
| 4064 |
This creates @file{ptmro.vpl} and @file{rptmro.tfm}. To use this font, |
| 4065 |
put the line |
| 4066 |
|
| 4067 |
@findex SlantFont |
| 4068 |
@example |
| 4069 |
rptmro Times-Roman ".167 SlantFont" |
| 4070 |
@end example |
| 4071 |
|
| 4072 |
@noindent |
| 4073 |
@flindex psfonts.map |
| 4074 |
into @file{psfonts.map}. Then @samp{rptmro} (our name for the obliqued |
| 4075 |
Times) will act as if it were a resident font, although it is actually |
| 4076 |
constructed from Times-Roman via the PostScript routine @code{SlantFont} |
| 4077 |
(which will slant everything 1/6 to the right, in this case). |
| 4078 |
|
| 4079 |
@cindex expanded fonts |
| 4080 |
@cindex fonts, expanded |
| 4081 |
Similarly, you can get an expanded font with |
| 4082 |
|
| 4083 |
@example |
| 4084 |
afm2tfm Times-Roman -e 1.2 -v ptmrre rptmrre |
| 4085 |
@end example |
| 4086 |
|
| 4087 |
@noindent |
| 4088 |
and by recording the pseudo-resident font |
| 4089 |
@findex ExtendFont |
| 4090 |
|
| 4091 |
@example |
| 4092 |
rptmrre Times-Roman "1.2 ExtendFont" |
| 4093 |
@end example |
| 4094 |
|
| 4095 |
@noindent |
| 4096 |
in @file{psfonts.map}. |
| 4097 |
|
| 4098 |
You can also create a small caps font with a command such as |
| 4099 |
@cindex small caps fonts |
| 4100 |
@cindex fonts, small caps |
| 4101 |
|
| 4102 |
@example |
| 4103 |
afm2tfm Times-Roman -V ptmrc rptmrc |
| 4104 |
@end example |
| 4105 |
|
| 4106 |
@noindent |
| 4107 |
This will generate a set of pseudo-small caps mapped into the usual |
| 4108 |
lowercase positions and scaled down to 0.8 of the normal cap |
| 4109 |
dimensions. You can also specify the scaling as something other than |
| 4110 |
the default 0.8: |
| 4111 |
|
| 4112 |
@example |
| 4113 |
afm2tfm Times-Roman -c 0.7 -V ptmrc rptmrc |
| 4114 |
@end example |
| 4115 |
|
| 4116 |
It is unfortunately not possible to increase the width of the small caps |
| 4117 |
independently of the rest of the font. If you want a really |
| 4118 |
professional looking set of small caps, you need to acquire a small caps |
| 4119 |
font. |
| 4120 |
|
| 4121 |
@findex PaintType |
| 4122 |
@cindex outline fonts |
| 4123 |
@cindex fonts, outlined |
| 4124 |
To change the @code{PaintType} in a font from filled (0) to outlined |
| 4125 |
(2), you can add @code{"/PaintType 2 store"} to @file{psfonts.map}, as |
| 4126 |
in the following: |
| 4127 |
|
| 4128 |
@example |
| 4129 |
rphvrl Helvetica "/PaintType 2 store" |
| 4130 |
@end example |
| 4131 |
|
| 4132 |
Afm2tfm writes to standard output the line you need to add to |
| 4133 |
@file{psfonts.map} to use that font, assuming the font is resident in |
| 4134 |
the printer; if the font is not resident, you must add the |
| 4135 |
@samp{<@var{filename}} command to download the font. Each identical |
| 4136 |
line only needs to be specified once in the @samp{psfonts.map} file, |
| 4137 |
even though many different fonts (small caps variants, or ones with |
| 4138 |
different output encodings) may be based on it. |
| 4139 |
|
| 4140 |
|
| 4141 |
@node Afm2tfm options |
| 4142 |
@subsection Afm2tfm options |
| 4143 |
|
| 4144 |
@cindex options, to Afm2tfm |
| 4145 |
@cindex afm2tfm options |
| 4146 |
|
| 4147 |
Synopsis: |
| 4148 |
@example |
| 4149 |
afm2tfm [@var{option}]@dots{} @var{afmfile}[.afm] [@var{tfmfile}[.tfm]] |
| 4150 |
@end example |
| 4151 |
|
| 4152 |
Afm2tfm reads @var{afmfile} and writes a corresponding (but ``raw'', |
| 4153 |
see below) TFM file. If @var{tfmfile} is not supplied, the base name |
| 4154 |
of the AFM file is extended with @samp{.tfm} to get the output |
| 4155 |
filename. |
| 4156 |
|
| 4157 |
The simplest example: |
| 4158 |
|
| 4159 |
@example |
| 4160 |
afm2tfm Times-Roman rptmr |
| 4161 |
@end example |
| 4162 |
|
| 4163 |
@cindex accents, wrong |
| 4164 |
@cindex raw tfm files |
| 4165 |
@noindent |
| 4166 |
The TFM file thus created is @dfn{raw} because it omits ligature and |
| 4167 |
kern information, and does no character remapping; it contains only |
| 4168 |
the character information in the AFM file in TFM format, which is the form |
| 4169 |
that @TeX{} understands. The characters have the same code in the TFM |
| 4170 |
file as in the AFM file. For text fonts, this means printable ASCII |
| 4171 |
characters will work ok, but little else, because standard PostScript |
| 4172 |
fonts have a different encoding scheme than the one that plain @TeX{} |
| 4173 |
expects (@pxref{Encodings}). Although the encodings agree for most |
| 4174 |
printable ASCII characters, other characters such as ligatures and |
| 4175 |
accents vary. Thus, in practice, it's almost always desirable to create |
| 4176 |
a virtual font as well with the @samp{-v} or @samp{-V} option. |
| 4177 |
@xref{Making a font available}. |
| 4178 |
|
| 4179 |
The command line options to Afm2tfm: |
| 4180 |
|
| 4181 |
@table @samp |
| 4182 |
@item -a |
| 4183 |
@opindex -a |
| 4184 |
@cindex accent height adjustment, omitting |
| 4185 |
By default, Afm2tfm looks for precomposed accented characters, such as |
| 4186 |
tdieresis, and possibly adjusts the height of the basic letter (t) |
| 4187 |
upward so that the result of using @code{\accent} (as in @code{\"t}) |
| 4188 |
is visually the same as the precomposed characters. The @code{-a} |
| 4189 |
option omits such adjustments, so that all characters' heights remain |
| 4190 |
as they are given in the AFM file. (Until Afm2tfm 8.4, released in |
| 4191 |
2016, heights could also be adjusted downward, but this is no longer |
| 4192 |
the case.) |
| 4193 |
|
| 4194 |
@item -c @var{ratio} |
| 4195 |
@opindex -c @var{ratio} |
| 4196 |
@cindex scaling small caps |
| 4197 |
See @samp{-V}; overrides the default ratio of 0.8 for the |
| 4198 |
scaling of small caps. |
| 4199 |
|
| 4200 |
@item -e @var{ratio} |
| 4201 |
@opindex -e @var{ratio} |
| 4202 |
@cindex expanded fonts |
| 4203 |
@cindex condensed fonts |
| 4204 |
Stretch characters horizontally by @var{ratio}; if less than 1.0, you |
| 4205 |
get a condensed font. |
| 4206 |
|
| 4207 |
@item -O |
| 4208 |
@opindex -O |
| 4209 |
@cindex octal character codes |
| 4210 |
Output all character codes in the @samp{vpl} file as octal numbers, not |
| 4211 |
names; this is useful for symbol or other special-purpose fonts where |
| 4212 |
character names such as @samp{A} have no meaning. |
| 4213 |
|
| 4214 |
@item -p @var{ps-enc} |
| 4215 |
@opindex -p @var{ps-enc} |
| 4216 |
Use @var{ps-enc} for the destination (PostScript) encoding of the font; |
| 4217 |
@var{ps-enc} must be mentioned as a header file for the font in |
| 4218 |
@samp{psfonts.map}. |
| 4219 |
@xref{Changing PostScript encodings}. |
| 4220 |
|
| 4221 |
@item -s @var{slant} |
| 4222 |
@opindex -s @var{slant} |
| 4223 |
@cindex slanted fonts, making |
| 4224 |
Slant characters to the right by @var{slant}. If @var{slant} is |
| 4225 |
negative, the letters slope to the left (or they might be upright if you |
| 4226 |
start with an italic font). |
| 4227 |
|
| 4228 |
@item -t @var{tex-enc} |
| 4229 |
@opindex -t @var{tex-enc} |
| 4230 |
Use @var{tex-enc} for the target (@TeX{}) encoding of the font. |
| 4231 |
Ligature and kern information may also be specified in @var{file}. |
| 4232 |
@var{file} is not mentioned in @file{psfonts.map}. |
| 4233 |
|
| 4234 |
@item -T @var{ps-tex-enc} |
| 4235 |
@opindex -T @var{ps-tex-enc} |
| 4236 |
Use @var{ps-tex-enc} for both the PostScript and target @TeX{} encodings |
| 4237 |
of the font. Equivalent to @samp{-p @var{file} -t @var{file}}. |
| 4238 |
|
| 4239 |
@item -u |
| 4240 |
@opindex -u |
| 4241 |
Use only those characters specified in the @TeX{} encoding, and no |
| 4242 |
others. By default, Afm2tfm tries to include all characters in the |
| 4243 |
input font, even those not present in the @TeX{} encoding (it puts them |
| 4244 |
into otherwise-unused positions, arbitrarily). |
| 4245 |
|
| 4246 |
@item -v @var{vpl-file} |
| 4247 |
@opindex -v @var{vpl-file} |
| 4248 |
Output a VPL (virtual property list) file, as well as a TFM file. |
| 4249 |
|
| 4250 |
@item -V @var{vpl-file} |
| 4251 |
@opindex -V @var{vpl-file} |
| 4252 |
Same as @samp{-v}, but the virtual font generated is a pseudo small caps |
| 4253 |
font obtained by scaling uppercase letters by 0.8 to typeset |
| 4254 |
lowercase. This font handles accented letters and retains proper |
| 4255 |
kerning. |
| 4256 |
@end table |
| 4257 |
|
| 4258 |
|
| 4259 |
@node psfonts.map |
| 4260 |
@section @file{psfonts.map}: PostScript font catalog |
| 4261 |
|
| 4262 |
@flindex psfonts.map |
| 4263 |
@cindex non-resident fonts |
| 4264 |
@cindex downloading PostScript fonts |
| 4265 |
@cindex fonts, downloading |
| 4266 |
|
| 4267 |
The @file{psfonts.map} file associates a PostScript font with related |
| 4268 |
files and constructs. Each line has the format: |
| 4269 |
|
| 4270 |
@example |
| 4271 |
@var{filename} @var{PostScript-name} @var{options} |
| 4272 |
@end example |
| 4273 |
|
| 4274 |
@kindex < @r{font downloading} |
| 4275 |
For example, the line |
| 4276 |
@example |
| 4277 |
rpstrn StoneInformal <StoneInformal.pfb |
| 4278 |
@end example |
| 4279 |
@noindent |
| 4280 |
causes Dvips to download @file{StoneInformal.pfb} (just as if it were |
| 4281 |
a header file, @pxref{Header files}) if the DVI file (or a virtual |
| 4282 |
font, @pxref{Virtual fonts}) references the TFM file @samp{rpstrn}. |
| 4283 |
The PostScript @code{/FontName} of the font defined inside the @samp{pfb} |
| 4284 |
file should be @code{StoneInformal}. |
| 4285 |
|
| 4286 |
@cindex transforming downloaded fonts |
| 4287 |
@cindex expanded fonts |
| 4288 |
@cindex wide fonts |
| 4289 |
@cindex narrow fonts |
| 4290 |
You can generate transformed fonts with a line like this: |
| 4291 |
@example |
| 4292 |
rpstrc StoneInformal <StoneInformal.pfb ".8 ExtendFont" |
| 4293 |
@end example |
| 4294 |
|
| 4295 |
@noindent |
| 4296 |
@xref{Special font effects}, for a |
| 4297 |
complete list of font effects. |
| 4298 |
|
| 4299 |
@cindex reencoding PostScript fonts |
| 4300 |
You can change the encoding of the Type 1 font at the PostScript |
| 4301 |
level with a @samp{ReEncodeFont} instruction, plus the name of the |
| 4302 |
encoding file. This allows you access to characters that may be present |
| 4303 |
in the Type 1 font file, but not encoded by default---most of the |
| 4304 |
preaccented characters, for example. An example: |
| 4305 |
@smallexample |
| 4306 |
pstrn8r StoneInformal "TeXBase1Encoding ReEncodeFont" <8r.enc <pstrn8a.pfb |
| 4307 |
@end smallexample |
| 4308 |
|
| 4309 |
@cindex 8r font encoding |
| 4310 |
@cindex base encoding, recommended |
| 4311 |
The @samp{8r} encoding mentioned here has been designed to serve as a |
| 4312 |
base for all downloadable fonts; it allows access to all the characters |
| 4313 |
commonly present in a Type 1 font. For more details, see the |
| 4314 |
@file{8r.enc} source file that comes with (and is installed with) Dvips. |
| 4315 |
|
| 4316 |
@kindex <[ @r{encoding vector downloading} |
| 4317 |
You may notice that the same syntax is used for downloading encoding |
| 4318 |
vectors and Type 1 font files. To make your intentions clear, you can |
| 4319 |
also use @samp{<[} to explicitly indicate you are downloading an |
| 4320 |
encoding vector, as in: |
| 4321 |
@smallexample |
| 4322 |
pstrn8r StoneInformal "TeXBase1Encoding ReEncodeFont" <[8r.enc <pstrn8a.pfb |
| 4323 |
@end smallexample |
| 4324 |
|
| 4325 |
@flindex .enc @r{extension for encoding vectors} |
| 4326 |
If the filename of your encoding vector does not end in @samp{.enc}, and |
| 4327 |
you are using partial font downloading, you must use the @samp{<[} |
| 4328 |
syntax, or Dvips will not download the font properly. |
| 4329 |
|
| 4330 |
@flindex .pfa @r{extension required for partial downloading} |
| 4331 |
@flindex .pfb @r{extension required for partial downloading} |
| 4332 |
Similarly, the name of the Type 1 font file itself must have extension |
| 4333 |
@file{.pfa} or @file{.pfb} for partial downloading to work properly. |
| 4334 |
|
| 4335 |
@cindex pfb files, automatically unpacked |
| 4336 |
When using PFB files, Dvips is smart enough to unpack the binary PFB |
| 4337 |
format into printable ASCII so there is no need to perform this |
| 4338 |
conversion yourself. In addition, Dvips scans the font to determine its |
| 4339 |
memory usage, just as it does for other header files (@pxref{Header |
| 4340 |
files}). |
| 4341 |
|
| 4342 |
@cindex partial font downloading |
| 4343 |
@cindex downloading fonts partially |
| 4344 |
If the @samp{j} config file or command-line option is enabled (as it |
| 4345 |
is by default), @file{StoneInformal.pfb} will be @dfn{partially |
| 4346 |
downloaded}---only those characters your document actually uses will |
| 4347 |
be extracted and downloaded, and the remainder discarded. |
| 4348 |
@xref{Option details}. |
| 4349 |
|
| 4350 |
@cindex whole font downloading |
| 4351 |
@cindex multiple master fonts |
| 4352 |
@cindex Minion typeface family |
| 4353 |
@kindex << @r{whole font downloading} |
| 4354 |
Adobe Multiple Master fonts, such as Minion, cannot be partially |
| 4355 |
downloaded. To partially download in general, but avoid partial |
| 4356 |
downloading for individual fonts, use @samp{<<} instead @samp{<}: |
| 4357 |
@example |
| 4358 |
pmnr8r Minion <<Minion.pfb |
| 4359 |
@end example |
| 4360 |
|
| 4361 |
Here is a brief summary of how @file{psfonts.map} is read: |
| 4362 |
|
| 4363 |
@enumerate |
| 4364 |
@item If a line is empty or begins with a space, percent, asterisk, |
| 4365 |
semicolon, or hash mark, it is ignored. |
| 4366 |
|
| 4367 |
@item Otherwise, the line is separated into words, where words are |
| 4368 |
separated by spaces or tabs, except that if a word begins with a double |
| 4369 |
quote, it extends until the next double quote or the end of the line. |
| 4370 |
|
| 4371 |
@item If a word starts with @samp{<<}, it is taken as a font file to be |
| 4372 |
wholly downloaded. Use this to avoid partial downloading, as described |
| 4373 |
above. |
| 4374 |
|
| 4375 |
@item If a word starts with @samp{<[}, it is taken as an encoding file |
| 4376 |
to be downloaded. Use this if the name of the encoding file does end in |
| 4377 |
@samp{.enc}, also as described above. |
| 4378 |
|
| 4379 |
@item If a word starts with a @samp{<} character, it is |
| 4380 |
treated as a header file that needs to be downloaded. If the name ends |
| 4381 |
in @samp{.pfa} or @samp{.pfb}, it is taken as Type 1 font file that will |
| 4382 |
be partially downloaded if the @samp{j} option is in effect. There can |
| 4383 |
be more than one such header for a given font. If a @samp{<} is a word |
| 4384 |
by itself, the next word is taken as the name of the header file. |
| 4385 |
|
| 4386 |
@item If a word starts with a @samp{"} character, it is taken as PostScript |
| 4387 |
code used in generating that font, and is inserted into the output |
| 4388 |
verbatim at the appropriate point. (And the double quotes beginning and |
| 4389 |
ending the word are removed.) |
| 4390 |
|
| 4391 |
@item Otherwise the word is a name. The first such name is the TFM |
| 4392 |
file, that either a DVI file or a virtual font file can refer to. If |
| 4393 |
there is a second name, it is used as the PostScript name and should |
| 4394 |
match what is defined in the downloaded file; if there is only one |
| 4395 |
name, it is used for both the @TeX{} name and the PostScript name. |
| 4396 |
|
| 4397 |
@end enumerate |
| 4398 |
|
| 4399 |
|
| 4400 |
@node Color |
| 4401 |
@chapter Color |
| 4402 |
|
| 4403 |
@cindex color |
| 4404 |
|
| 4405 |
@cindex Hafner, Jim |
| 4406 |
Dvips supports one-pass multi-color printing of @TeX{} documents on any |
| 4407 |
color PostScript device. Initially added by Jim Hafner, IBM Research, |
| 4408 |
@email{hafner@@almaden.ibm.com}, the color support has gone through many |
| 4409 |
changes by Tomas Rokicki. Besides the source code support itself, there |
| 4410 |
are additional @TeX{} macro files: @samp{colordvi.tex} and |
| 4411 |
@samp{blackdvi.tex}, and corresponding @samp{.sty} versions for use with |
| 4412 |
@LaTeX{}. |
| 4413 |
|
| 4414 |
In this section we describe the use of color from the document |
| 4415 |
preparer's point of view and then add some instructions on installation |
| 4416 |
for the @TeX{} administrator. |
| 4417 |
|
| 4418 |
@menu |
| 4419 |
* Color macro files:: TeX macro definitions. |
| 4420 |
* User-definable colors:: Adding your own colors. |
| 4421 |
* Color subtleties:: Subtleties in using color. |
| 4422 |
* Ted Turner:: Printing in black/white after colorizing. |
| 4423 |
* Color device configuration:: Configuring Dvips for color devices. |
| 4424 |
* Color support details:: Color support details |
| 4425 |
@end menu |
| 4426 |
|
| 4427 |
|
| 4428 |
@node Color macro files |
| 4429 |
@section Color macro files |
| 4430 |
|
| 4431 |
@cindex macros for color |
| 4432 |
@cindex color macros |
| 4433 |
|
| 4434 |
All the color macro commands are defined in @samp{colordvi.tex} (or |
| 4435 |
@samp{colordvi.sty}). To access these macros simply add to the top of |
| 4436 |
your plain @TeX{} file the command: |
| 4437 |
@example |
| 4438 |
\input colordvi |
| 4439 |
@end example |
| 4440 |
@noindent |
| 4441 |
For (the obsolete) @LaTeX{} 2.09, add the @samp{colordvi} style option as in: |
| 4442 |
@example |
| 4443 |
\documentstyle[12pt,colordvi]@{article@} |
| 4444 |
@end example |
| 4445 |
@noindent |
| 4446 |
For @LaTeX{}2e, these examples are not applicable. Instead, please see |
| 4447 |
the documentation for the graphics package |
| 4448 |
(@url{https://ctan.org/pkg/graphics}), and the epslatex document |
| 4449 |
(@url{https://ctan.org/pkg/epslatex}). |
| 4450 |
|
| 4451 |
@cindex Crayola crayon box |
| 4452 |
@cindex Pantone colors |
| 4453 |
@cindex color names, mixed case |
| 4454 |
These macros provide two basic kinds of color macros: ones for local |
| 4455 |
color changes (a few words, a single symbol) and one for global color |
| 4456 |
changes (the whole document). All the color names use a mixed case |
| 4457 |
scheme to avoid conflicts with other macros. There are 68 predefined |
| 4458 |
colors, with names taken primarily from the Crayola crayon box of 64 |
| 4459 |
colors, and one pair of macros for the user to set his own color pattern |
| 4460 |
(@pxref{User-definable colors}). You can browse the file |
| 4461 |
@samp{colordvi.tex} for a list of the predefined colors. The comments |
| 4462 |
in this file also show a rough correspondence between the crayon names |
| 4463 |
and Pantones. |
| 4464 |
|
| 4465 |
A local color command has the form |
| 4466 |
|
| 4467 |
@example |
| 4468 |
\@var{ColorName}@{this is the color @var{ColorName}@} |
| 4469 |
@end example |
| 4470 |
|
| 4471 |
@findex \@var{ColorName} |
| 4472 |
@noindent |
| 4473 |
where @var{ColorName} is the name of a predefined color, e.g., |
| 4474 |
@samp{Blue}. As shown, these macros take one argument, the text to |
| 4475 |
print in the specified color. This can be used for nested color changes |
| 4476 |
since it restores the original color state when it completes. For |
| 4477 |
example: |
| 4478 |
|
| 4479 |
@example |
| 4480 |
This text is normal but here we are \Red@{switching to red, |
| 4481 |
\Blue@{nesting blue@}, recovering the red@} and back to original. |
| 4482 |
@end example |
| 4483 |
|
| 4484 |
@noindent |
| 4485 |
@cindex color nesting level |
| 4486 |
The color nesting level has no hard limit, but it is not advisable to |
| 4487 |
nest too deeply lest you and the reader lose track of the color history. |
| 4488 |
|
| 4489 |
The global color command has the form |
| 4490 |
|
| 4491 |
@example |
| 4492 |
\text@var{ColorName} |
| 4493 |
@end example |
| 4494 |
|
| 4495 |
@noindent |
| 4496 |
@findex \text@var{ColorName} |
| 4497 |
These macros take no arguments and changes the default color from that |
| 4498 |
point on to @var{ColorName}. This of course can be overridden globally |
| 4499 |
by another such command or locally by local color commands. For example, |
| 4500 |
expanding on the example above, we might have |
| 4501 |
|
| 4502 |
@example |
| 4503 |
\textGreen |
| 4504 |
This text is green but here we are \Red@{switching to red, |
| 4505 |
\Blue@{nesting blue@}, recovering the red@} and back to |
| 4506 |
original green. |
| 4507 |
\textCyan |
| 4508 |
The text from here on will be cyan until |
| 4509 |
\Yellow@{locally changed to yellow@}. Now we are back to cyan. |
| 4510 |
@end example |
| 4511 |
|
| 4512 |
The color commands will even work in math mode and across math mode |
| 4513 |
boundaries. This means that if you have a color before going into math |
| 4514 |
mode, the mathematics will be set in that color as well. In alignment |
| 4515 |
environments like @code{\halign}, @samp{tabular} or @samp{eqnarray}, |
| 4516 |
local color commands cannot extend beyond the alignment characters. |
| 4517 |
|
| 4518 |
Because local color commands respect only some environment and |
| 4519 |
delimiter changes besides their own, care must be taken in setting |
| 4520 |
their scope. It is best not to have them stretch too far. |
| 4521 |
|
| 4522 |
At the present time there are no macros for color environments in @LaTeX{} |
| 4523 |
which might have a larger range. This is primarily to keep the @TeX{} |
| 4524 |
and @LaTeX{} use compatible. |
| 4525 |
|
| 4526 |
|
| 4527 |
@node User-definable colors |
| 4528 |
@section User-definable colors |
| 4529 |
|
| 4530 |
@cindex user-definable colors |
| 4531 |
@cindex colors, user-definable |
| 4532 |
|
| 4533 |
There are two ways for the user to specify colors not already defined. |
| 4534 |
For local changes, there is the command @code{\Color} which takes two |
| 4535 |
arguments. The first argument is four numbers between zero and one and |
| 4536 |
specifies the intensity of cyan, magenta, yellow and black (CMYK) in |
| 4537 |
that order. The second argument is the text that should appear in the |
| 4538 |
given color. For example, suppose you want the words ``this color is |
| 4539 |
pretty'' to appear in a color which is 50% cyan, 85% magenta, 40% yellow |
| 4540 |
and 20% black. You would use the command |
| 4541 |
|
| 4542 |
@example |
| 4543 |
\Color@{.5 .85 .4 .2@}@{this color is pretty@} |
| 4544 |
@end example |
| 4545 |
|
| 4546 |
For global color changes, there is a command @code{\textColor} which |
| 4547 |
takes one argument, the CMYK quadruple of relative color intensities. |
| 4548 |
For example, if you want the default color to be as above, then the |
| 4549 |
command |
| 4550 |
|
| 4551 |
@example |
| 4552 |
\textColor@{.5 .85 .4 .2@} |
| 4553 |
The text from now on will be this pretty color |
| 4554 |
@end example |
| 4555 |
|
| 4556 |
@noindent |
| 4557 |
will do the trick. |
| 4558 |
|
| 4559 |
Making a global color change in the midst of nested local colors is |
| 4560 |
highly discouraged. Consequently, Dvips will give you warning message |
| 4561 |
and do its best to recover by discarding the current color history. |
| 4562 |
|
| 4563 |
|
| 4564 |
@node Color subtleties |
| 4565 |
@section Color subtleties |
| 4566 |
|
| 4567 |
@cindex color subtleties |
| 4568 |
|
| 4569 |
Color macros are defined via @code{\special} keywords. As such, they |
| 4570 |
are put in the @samp{.dvi} file only as explicit message strings to the |
| 4571 |
driver. The (unpleasant) result is that certain unprotected regions of |
| 4572 |
the text can have unwanted color side effects. For example, if a color |
| 4573 |
region is split by @TeX{} across a page boundary, then the footers of |
| 4574 |
the current page (e.g., the page number) and the headers of the next |
| 4575 |
page can inherit that color. To avoid this effect globally, users |
| 4576 |
should make sure that these special regions of the text are defined with |
| 4577 |
their own local color commands. For example, to protect the |
| 4578 |
header and footer in plain @TeX{}, use |
| 4579 |
|
| 4580 |
@example |
| 4581 |
\headline@{\Black@{My Header@}@} |
| 4582 |
\footline@{\Black@{\hss\tenrm\folio\hss@}@} |
| 4583 |
@end example |
| 4584 |
|
| 4585 |
This warning also applies to figures and other insertions, so be careful! |
| 4586 |
|
| 4587 |
Of course, in @LaTeX{}, this is much more difficult to do because of the |
| 4588 |
complexity of the macros that control these regions. This is |
| 4589 |
unfortunate but inevitable, because @TeX{} and @LaTeX{} were |
| 4590 |
not written with color in mind. |
| 4591 |
|
| 4592 |
Even when writing your own macros, much care must be taken. The macros |
| 4593 |
that `colorize' a portion of the text work prefix the text work by |
| 4594 |
outputting one @code{\special} command to turn the color on before the |
| 4595 |
text, and outputting another @code{\special} command afterwards to |
| 4596 |
restore the original color. It is often useful to ensure that @TeX{} is |
| 4597 |
in horizontal mode before the first special command is issued; this can |
| 4598 |
be done by prefixing the color command with @code{\leavevmode}. |
| 4599 |
|
| 4600 |
|
| 4601 |
@node Ted Turner |
| 4602 |
@section Printing in black/white after colorizing |
| 4603 |
|
| 4604 |
If you have a @TeX{} or @LaTeX{} document written with color macros and |
| 4605 |
you want to print it in black and white there are two options. On all |
| 4606 |
(good) PostScript devices, printing a color file will print in |
| 4607 |
corresponding gray levels. This is useful to get a rough idea of the |
| 4608 |
colors without using expensive color printing devices. The second |
| 4609 |
option is to replace the call to input @file{colordvi.tex} with |
| 4610 |
@samp{blackdvi.tex} (and similarly for the @samp{.sty} files). So in |
| 4611 |
the above example, replacing the word @samp{colordvi} with |
| 4612 |
@samp{blackdvi} suffices. @file{blackdvi.tex} defines the color macros |
| 4613 |
as no-ops, and so will produce normal black/white printing. By this |
| 4614 |
simple mechanism, the user can switch to all black/white printing |
| 4615 |
without having to ferret out the color commands. Also, some device |
| 4616 |
drivers, particularly non-PostScript ones like screen previewers, will |
| 4617 |
simply ignore the color commands and so print in black/white. |
| 4618 |
Hopefully, in the future screen previewers for color displays will be |
| 4619 |
compatible with some form of color support. |
| 4620 |
|
| 4621 |
|
| 4622 |
@node Color device configuration |
| 4623 |
@section Color device configuration |
| 4624 |
|
| 4625 |
@cindex color configuration |
| 4626 |
@cindex configuration, of color devices |
| 4627 |
|
| 4628 |
To configure Dvips for a particular color device you need to fine tune |
| 4629 |
the color parameters to match your device's color rendition. To do this, |
| 4630 |
you will need a Pantone chart for your device. The header file |
| 4631 |
@samp{color.lpro} shows a (rough) correspondence between the Crayola |
| 4632 |
crayon names and the Pantone numbers and also defines default CMYK |
| 4633 |
values for each of the colors. Note that these colors must be defined |
| 4634 |
in CMYK terms and not RGB, as Dvips outputs PostScript color commands in |
| 4635 |
CMYK. This header file also defines (if they are not known to the |
| 4636 |
interpreter) the PostScript commands @samp{setcmykcolor} and |
| 4637 |
@samp{currentcmykcolor} in terms of a RGB equivalent so if your device |
| 4638 |
only understands RGB, there should be no problem. |
| 4639 |
|
| 4640 |
@cindex Phaser printer, used for color calibration |
| 4641 |
@cindex Tektronix Phaser printer, used for color calibration |
| 4642 |
The parameters set in this file were determined by comparing the Pantone |
| 4643 |
chart of a Tektronix Phaser printer with the actual Crayola Crayons. |
| 4644 |
Because these were defined for a particular device, the actual color |
| 4645 |
rendition on your device may be very different. There are two ways to |
| 4646 |
adjust this. One is to use the PAntone chart for your device to rewrite |
| 4647 |
@samp{color.lpro} prior to compilation and installation. A better |
| 4648 |
alternative, which supports multiple devices, is to add a header file |
| 4649 |
option in the configuration file (@pxref{Configuration file commands}) |
| 4650 |
for each device that defines, in @samp{userdict}, the color parameters |
| 4651 |
for those colors that need redefining. |
| 4652 |
|
| 4653 |
For example, if you need to change the parameters defining |
| 4654 |
@samp{Goldenrod} (approximately Pantone 109 on the Phaser) for your |
| 4655 |
device @samp{mycolordev}, do the following. In the Pantone chart for |
| 4656 |
your device, find the CMYK values for Pantone 109. Let's say they are |
| 4657 |
@samp{@{\ 0 0.10 0.75 0.03 @}}. Then create a header file named |
| 4658 |
@samp{mycolordev.pro} with the commands |
| 4659 |
|
| 4660 |
@example |
| 4661 |
userdict begin |
| 4662 |
/Goldenrod @{ 0 0.10 0.75 0.03 setcmykcolor@} bind def |
| 4663 |
@end example |
| 4664 |
|
| 4665 |
@noindent |
| 4666 |
Finally, in @samp{config.mycolordev} add the line |
| 4667 |
|
| 4668 |
@example |
| 4669 |
h mycolordev.pro |
| 4670 |
@end example |
| 4671 |
|
| 4672 |
@noindent |
| 4673 |
This will then define @samp{Goldenrod} in your device's CMYK values in |
| 4674 |
@file{userdict} which is checked before defining it in @file{TeXdict} by |
| 4675 |
@file{color.pro}. (On MS-DOS, you will have to call this file |
| 4676 |
@file{mycolordev.cfg}.) |
| 4677 |
|
| 4678 |
This mechanism, together with additions to @file{colordvi.tex} and |
| 4679 |
@file{blackdvi.tex} (and the @samp{.sty} files), can also be used to |
| 4680 |
predefine other colors for your users. |
| 4681 |
|
| 4682 |
|
| 4683 |
@node Color support details |
| 4684 |
@section Color support details |
| 4685 |
|
| 4686 |
To support color, Dvips recognizes a certain set of specials. These |
| 4687 |
specials start with the keyword @samp{color} or the keyword |
| 4688 |
@samp{background}, followed by a color specification. |
| 4689 |
|
| 4690 |
@menu |
| 4691 |
* Color specifications:: |
| 4692 |
* Color specials:: |
| 4693 |
@end menu |
| 4694 |
|
| 4695 |
|
| 4696 |
@node Color specifications |
| 4697 |
@subsection Color specifications |
| 4698 |
|
| 4699 |
@cindex color specifications |
| 4700 |
|
| 4701 |
What is a color specification? One of three things. First, it might be |
| 4702 |
a PostScript procedure as defined in a PostScript header file. The |
| 4703 |
@file{color.pro} file defines 64 of these, including @samp{Maroon}. |
| 4704 |
This PostScript procedure must set the current color to be some value; |
| 4705 |
in this case, @samp{Maroon} is defined as @samp{0 0.87 0.68 0.32 |
| 4706 |
setcmykcolor}. |
| 4707 |
|
| 4708 |
The second possibility is the name of a color model (initially, one of |
| 4709 |
@samp{rgb}, @samp{hsb}, @samp{cmyk}, or @samp{gray}) followed by the |
| 4710 |
appropriate number of parameters. When Dvips encounters such a macro, |
| 4711 |
it sends out the parameters first, followed by the string created by |
| 4712 |
prefixing @samp{TeXcolor} to the color model. Thus, the color |
| 4713 |
specification @samp{rgb 0.3 0.4 0.5} would generate the PostScript code |
| 4714 |
@samp{0.3 0.4 0.5 TeXrgbcolor}. Note that the case of zero arguments is |
| 4715 |
disallowed, as that is handled by the single keyword case |
| 4716 |
(@samp{Maroon}) above, where no changes to the name are made before it |
| 4717 |
is sent to the PostScript file. |
| 4718 |
|
| 4719 |
The third and final type of color specification is a double quote |
| 4720 |
followed by any sequence of PostScript. The double quote is stripped |
| 4721 |
from the output. For instance, the color specification |
| 4722 |
@samp{"AggiePattern setpattern} will set the `color' to the Aggie logo |
| 4723 |
pattern (assuming such exists.) |
| 4724 |
|
| 4725 |
|
| 4726 |
@node Color specials |
| 4727 |
@subsection Color specials |
| 4728 |
|
| 4729 |
We will describe @samp{background} first, since it is the simplest. The |
| 4730 |
@samp{background} keyword must be followed by a color specification. |
| 4731 |
That color specification is used as a fill color for the background. |
| 4732 |
The last @samp{background} special on a page is the one that gets |
| 4733 |
issued, and it gets issued at the very beginning of the page, before any |
| 4734 |
text or specials are sent. (This is possible because the prescan phase |
| 4735 |
of Dvips notices all of the color specials so that the appropriate |
| 4736 |
information can be written out during the second phase.) |
| 4737 |
|
| 4738 |
The @samp{color} special itself has three forms. |
| 4739 |
The first is just @samp{color} followed by a color specification. In |
| 4740 |
this case, the current global color is set to that color; the color stack |
| 4741 |
must be empty when such a command is executed. |
| 4742 |
|
| 4743 |
The second form is @samp{color push} followed by a color specification. |
| 4744 |
This saves the current color on the color stack and sets the color to be |
| 4745 |
that given by the color specification. This is the most common way to |
| 4746 |
set a color. |
| 4747 |
|
| 4748 |
The final version of the @samp{color} special is just @samp{color pop}, |
| 4749 |
with no color specification; this says to pop the color last pushed on |
| 4750 |
the color stack from the color stack and set the current color to be |
| 4751 |
that color. |
| 4752 |
|
| 4753 |
Dvips correctly handles these color specials across pages, even when the |
| 4754 |
pages are repeated or reversed. |
| 4755 |
|
| 4756 |
These color specials can be used for things such as patterns or screens |
| 4757 |
as well as simple colors. However, note that in the PostScript, only |
| 4758 |
one color specification can be active at a time. For instance, at the |
| 4759 |
beginning of a page, only the bottommost entry on the color stack is |
| 4760 |
sent; also, when a color is popped, all that is done is that the color |
| 4761 |
specification from the previous stack entry is sent. No @samp{gsave} or |
| 4762 |
@samp{grestore} is used. This means that you cannot easily mix usage of |
| 4763 |
the @samp{color} specials for screens and colors, just one or the other. |
| 4764 |
This may be addressed in the future by adding support for different |
| 4765 |
categories of color-like state. |
| 4766 |
|
| 4767 |
|
| 4768 |
@node Index |
| 4769 |
@unnumbered Index |
| 4770 |
|
| 4771 |
@printindex cp |
| 4772 |
|
| 4773 |
@bye |