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