home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-bin0.lha / info / dvips.info-1 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  47KB  |  831 lines

  1. This is Info file dvips.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/contrib/unixtex/dvipsk/dvips.texi.
  3. START-INFO-DIR-ENTRY
  4. * DVIps: (dvips).         DVI-to-PostScript translator.
  5. END-INFO-DIR-ENTRY
  6. File: dvips.info,  Node: Top,  Next: Why dvips,  Up: (dir)
  7. Dvips
  8. *****
  9.   This manual documents Dvips, a program to translate a DVI file into
  10. PostScript.  It corresponds to version 5.58f of the Dvipsk
  11. distribution, a slightly modified variant of the original `dvips'
  12. progam with path searching rules consistent with TeX, the GNU font
  13. utilities, and Xdvik.  Tom Rokicki wrote and maintains `dvips';
  14. `kb@cs.umb.edu' made the Dvipsk modifications.
  15. * Menu:
  16. * Why dvips::                   Why use dvips?
  17. * Using dvips::                 Minimal usage information.
  18. * Paper Size and Landscape::
  19. * Including PostScript::        Including PostScript graphics.
  20. * PostScript fonts::            Using PostScript fonts, resident or downloaded.
  21. * Invoking dvips::            Command-line options, etc.
  22. * Config File::                 Configuration file(s) and how they're found.
  23. * Font Generation::             Automatic font generation with MakeTeXPK.
  24. * Environment Variables::
  25. * Bells and Whistles::          Other nifty things
  26. * MS-DOS::                      MS-DOS support in dvips
  27. * Installation::                How to compile and install dvips.
  28. * Problems::                    Diagnosing problems.
  29. * Color::                       Using color with dvips.
  30. * Index::
  31.  -- The Detailed Node Listing --
  32. Including PostScript Graphics
  33. * Bounding Box::                The Bounding Box Comment
  34. * EPSF Macros::                 Using the EPSF Macros
  35. * Header Files::                Header Files
  36. * Literal PS::                  Literal PostScript
  37. * Literal headers::             Literal Headers
  38. * Graphics Support::            Other Graphics Support
  39. * Dynamic Creation of Graphics::
  40. Using PostScript Fonts
  41. * afm2tfm::
  42. * Changing Encodings::
  43. * Special Font Effects::
  44. * Non-resident Fonts::
  45. * Invoking Afm2tfm::
  46. Configuration File Searching
  47. * Config File Options::
  48. Diagnosing problems
  49. * Debug Options::
  50. * No Output::                   No Output At All
  51. * Small or Inverted::           Output Too Small or Inverted
  52. * Printer Errors::              Error Messages From Printer
  53. * 400 DPI::                     400 DPI Is Used Instead Of 300 DPI
  54. * Long Documents Fail::         Long Documents Fail To Print
  55. * Including Graphics Fails::    Including Graphics Fails
  56. * Unable to Generate Fonts::    Unable to Generate Fonts
  57. Using Color with dvips
  58. * Macro Files::
  59. * User Definable Colors::       User Definable Colors
  60. * Color Subtleties::            Subtleties in Using Color
  61. * Ted Turner::                  Printing in Black/White, after Colorizing
  62. * Color Configuration ::        Configuring dvips for Color Devices
  63. * Color Support Details::       Color Support Details
  64. File: dvips.info,  Node: Why dvips,  Next: Using dvips,  Prev: Top,  Up: Top
  65. Why Use dvips?
  66. **************
  67.   The `dvips' program has a number of features that set it apart from
  68. other PostScript drivers for TeX.  This rather long section describes
  69. the advantages of using dvips, and may be skipped if you are just
  70. interested in learning how to use the program.  *Note Installation::,
  71. for details of compilation and installation.
  72.   The dvips driver generates excellent, standard PostScript, that can
  73. be included in other documents as figures or printed through a variety
  74. of spoolers.  The generated PostScript requires very little printer
  75. memory, so very complex documents with a lot of fonts can easily be
  76. printed even on PostScript printers without much memory, such as the
  77. original Apple LaserWriter.  The PostScript output is also compact,
  78. requiring less disk space to store and making it feasible as a transfer
  79. format.
  80.   Even those documents that are too complex to print in their entirety
  81. on a particular printer can be printed, since dvips will automatically
  82. split such documents into pieces, reclaiming the printer memory between
  83. each piece.
  84.   The dvips program supports graphics in a natural way, allowing
  85. PostScript graphics to be included and automatically scaled and
  86. positioned in a variety of ways.
  87.   Printers with resolutions other than 300 dpi are also supported, even
  88. if they have different resolutions in the horizontal and vertical
  89. directions.  High resolution output is supported for typesetters,
  90. including an option that compresses the bitmapped fonts so that
  91. typesetter virtual memory is not exhausted.  This option also
  92. significantly reduces the size of the PostScript file and decoding in
  93. the printer is very fast.
  94.   Missing fonts can be automatically generated if METAFONT exists on
  95. the system, or fonts can be converted from `gf' to `pk' format on
  96. demand.  If a font cannot be generated, a scaled version of the same
  97. font at a different size can be used instead, although dvips will
  98. complain loudly about the poor aesthetics of the resulting output.
  99.   Users will appreciate features such as collated copies and support for
  100. `tpic', `psfig', `emtex', and `METAPOST'; system administrators will
  101. love the support for multiple printers, each with their own
  102. configuration file, and the ability to pipe the output directly to a
  103. program such as `lpr'.  Support for MS-DOS, OS/2, and VMS in addition
  104. to UNIX is provided in the standard distribution, and porting to other
  105. systems is easy.
  106.   One of the most important features is the support of virtual fonts,
  107. which add an entirely new level of flexibility to TeX.  Virtual fonts
  108. are used to give dvips its excellent PostScript font support, handling
  109. all the font remapping in a natural, portable, elegant, and extensible
  110. way.  The dvips `afm2tfm' driver even comes with its own `afm2tfm'
  111. program that creates the necessary virtual fonts and TeX font metric
  112. files automatically from the Adobe font metric files.
  113.   Source is provided and freely distributable, so adding a
  114. site-specific feature is possible.  Adding such features is made easier
  115. by the highly modular structure of the program.
  116.   There is really no reason to use another driver, and the more people
  117. use dvips, the less time will be spent fighting with PostScript and the
  118. more time will be available to create beautiful documents.  So if you
  119. don't use dvips on your system, get it today.
  120. File: dvips.info,  Node: Using dvips,  Next: Paper Size and Landscape,  Prev: Why dvips,  Up: Top
  121. Using dvips
  122. ***********
  123.   To use dvips, simply type
  124.      dvips foo
  125. where `foo.dvi' is the output of TeX that you want to print.  If dvips
  126. has been installed correctly, the document should come out of your
  127. default printer.
  128.   If you use fonts that have not been used on your system before, they
  129. may be automatically generated; this process can take a few minutes.
  130. The next time that document is printed, these fonts will already exist,
  131. so printing will go much faster.
  132.   Many options are available; they are described in a later section.
  133. For a brief summary of available options, just type
  134.      dvips
  135. File: dvips.info,  Node: Paper Size and Landscape,  Next: Including PostScript,  Prev: Using dvips,  Up: Top
  136. Paper Size and Landscape Orientation
  137. ************************************
  138.   Most TeX documents at a particular site are designed to use the
  139. standard paper size (letter size in the United States, A4 in Europe.)
  140. The dvips program defaults to these paper sizes and can be customized
  141. for the defaults at each site or on each printer.
  142.   But many documents are designed for other paper sizes.  For instance,
  143. you may want to design a document that has the long edge of the paper
  144. horizontal.  This can be useful when typesetting booklets, brochures,
  145. complex tables, or many other documents.  This type of paper orientation
  146. is called landscape orientation (the `normal' orientation is portrait).
  147. Alternatively, a document might be designed for ledger or A3 paper.
  148.   Since the intended paper size is a document design decision, and not a
  149. decision that is made at printing time, such information should be given
  150. in the TeX file and not on the dvips command line.  For this reason,
  151. dvips supports a `papersize' special.  It is hoped that this special
  152. will become standard over time for TeX previewers and other printer
  153. drivers.
  154.   The format of the `papersize' special is
  155.      \special{papersize=8.5in,11in}
  156. where the dimensions given above are for a standard letter sheet.  The
  157. first dimension given is the horizontal size of the page, and the
  158. second is the vertical size.  The dimensions supported are the same as
  159. for TeX; namely, in (inches), cm (centimeters), mm (millimeters), pt
  160. (points), sp (scaled points), bp (big points, the same as the default
  161. PostScript unit), pc (picas), dd (didot points), and cc (ciceros).
  162.   For a landscape document, the `papersize' comment would be given as
  163.      \special{papersize=11in,8.5in}
  164. An alternate specification of `landscape' is to have a special of the
  165.      \special{landscape}
  166. This is supported for backward compatibility, but it is hoped that
  167. eventually the `papersize' comment will dominate.
  168.   Of course, using such a command only informs dvips of the desired
  169. paper size; you must still adjust the `hsize' and `vsize' in your TeX
  170. document to actually use the full page.
  171.   The `papersize' special must occur somewhere on the first page of the
  172. document.
  173. File: dvips.info,  Node: Including PostScript,  Next: PostScript fonts,  Prev: Paper Size and Landscape,  Up: Top
  174. Including PostScript Graphics
  175. *****************************
  176.   Scaling and including PostScript graphics is a breeze--if the
  177. PostScript file is correctly formed.  Even if it is not, however, the
  178. file can usually be accommodated with just a little more work.  The
  179. most important feature of a good PostScript file--from the standpoint
  180. of including it in another document--is an accurate bounding box
  181. comment.
  182. * Menu:
  183. * Bounding Box::                The Bounding Box Comment
  184. * EPSF Macros::                 Using the EPSF Macros
  185. * Header Files::                Header Files
  186. * Literal PS::                  Literal PostScript
  187. * Literal headers::             Literal Headers
  188. * Graphics Support::            Other Graphics Support
  189. * Dynamic Creation of Graphics::
  190. File: dvips.info,  Node: Bounding Box,  Next: EPSF Macros,  Up: Including PostScript
  191. The Bounding Box Comment
  192. ========================
  193.   Every well-formed PostScript file has a comment describing where on
  194. the page the graphic is located, and how big that graphic is.  This
  195. information is given in terms of the lower left and upper right corners
  196. of a box just enclosing the graphic, and is thus referred to as a
  197. bounding box.  These coordinates are given in PostScript units (there
  198. are precisely 72 PostScript units to the inch) with respect to the
  199. lower left corner of the sheet of paper.
  200.   To see if a PostScript file has a bounding box comment, just look at
  201. the first few lines of the file.  (PostScript is standard ASCII, so you
  202. can use any text editor to do this.) If within the first few dozen
  203. lines there is a line of the form
  204.      %%BoundingBox: 0 1 2 3
  205. (with any numbers), chances are very good that the file is Encapsulated
  206. PostScript and will work easily with dvips.  If the file contains
  207. instead a line like
  208.      %%BoundingBox: (atend)
  209. the file is still probably Encapsulated PostScript, but the bounding
  210. box (that dvips needs to position the graphic) is at the end of the
  211. file and should be moved to the position of the line above.  This can be
  212. done with that same text editor, or with a simple Perl script.
  213.   If the document lacks a bounding box altogether, one can easily be
  214. added.  Simply print the file.  Now, take a ruler, and make the
  215. following measurements.  All measurements should be in PostScript
  216. units, so measure it in inches and multiply by 72.  Alternatively, the
  217. `bbfig' program distributed with dvips in the `contrib' directory can
  218. be used to automate this process.
  219.   From the left edge of the paper to the leftmost mark on the paper is
  220. LLX, the first number.  From the bottom edge of the paper to the
  221. bottommost mark on the paper is LLY, the second number.  From the left
  222. edge of the paper to the rightmost mark on the paper is URX, the third
  223. number.  The fourth and final number, URY, is the distance from the
  224. bottom of the page to the uppermost mark on the paper.
  225.   Now, add a comment of the following form as the second line of the
  226. document.  (The first line should already be a line starting with the
  227. two characters `%!'; if it is not, the file probably isn't PostScript.)
  228.      %%BoundingBox: LLX LLY URX URY
  229. Or, if you don't want to modify the file, you can simply write these
  230. numbers down in a convenient place and use them when you import the
  231. graphic.
  232.   If the document does not have such a bounding box, or if the bounding
  233. box is given at the end of the document, please complain to the authors
  234. of the software package that generated the file; without such a line,
  235. including PostScript graphics can be tedious.
  236. File: dvips.info,  Node: EPSF Macros,  Next: Header Files,  Prev: Bounding Box,  Up: Including PostScript
  237. Using the EPSF Macros
  238. =====================
  239.   Now you are ready to include the graphic into a TeX file.  Simply add
  240. to the top of your TeX file a line like
  241.      \input epsf
  242. (or, if your document is in LaTeX or SliTeX, add the `epsf' style
  243. option, as was done to the following line).
  244.      \documentstyle[12pt,epsf]{article}
  245. This only needs to be done once, no matter how many figures you plan to
  246. include.  Now, at the point you want to include the file, enter a line
  247. such as
  248.      \epsffile{foo.ps}
  249. If you are using LaTeX or SliTeX, you may need to add a `\leavevmode'
  250. command immediately before the `\epsffile' command to get certain
  251. environments to work correctly.  If your file did not (or does not
  252. currently) have a bounding box comment, you should supply those numbers
  253. you wrote down as in the following example:
  254.      \epsffile[100 100 500 500]{foo.ps}
  255. (in the same order they would have been in a normal bounding box
  256. comment).  Now, save your changes and run TeX and dvips; the output
  257. should have your graphic positioned at precisely the point you
  258. indicated, with the proper amount of space reserved.
  259.   The effect of the `epsffile' macro is to typeset the figure as a TeX
  260. `vbox' at the point of the page that the command is executed.  By
  261. default, the graphic will have its `natural' width (namely, the width
  262. of its bounding box).  The TeX box will have depth zero and a `natural'
  263. height.  The graphic will be scaled by any `dvi' magnification in
  264. effect at the time.
  265.   Any PostScript graphics included by any method in this document
  266. (except `bop-hook' and its ilk) are scaled by the current `dvi'
  267. magnification.  For graphics included with `epsffile' where the size is
  268. given in TeX dimensions, this scaling will produce the correct, or
  269. expected, results.  For compatibility with old PostScript drivers, it
  270. is possible to turn this scaling off with the following TeX command:
  271.      \special{! /magscale false def}
  272. Use of this command is not recommended because it will make the
  273. `epsffile' graphics the wrong size if global magnification is used in a
  274. `dvi' document, and it will cause any PostScript graphics to appear
  275. improperly scaled and out of position if a `dvi' to `dvi' program is
  276. used to scale or otherwise modify the document.
  277.   You can enlarge or reduce the figure by putting
  278.      \epsfxsize=DIMEN
  279. right before the call to `epsffile'.  Then the width of the TeX box
  280. will be DIMEN and its' height will be scaled proportionately.
  281. Alternatively you can force the vertical size to a particular size with
  282.      \epsfysize=DIMEN
  283. in which case the height will be set and the width will be scaled
  284. proportionally.  If you set both, the aspect ratio of the included
  285. graphic will be distorted but both size specifications will be honored.
  286.   By default, clipping is disabled for included EPSF images.  This is
  287. because clipping to the bounding box dimensions often cuts off a small
  288. portion of the figure, due to slightly inaccurate bounding box
  289. arguments.  The problem might be subtle; lines around the boundary of
  290. the image might be half their intended width, or the tops or bottoms of
  291. some text annotations might be sliced off.  If you want to turn
  292. clipping on, just use the command
  293.      \epsfclipon
  294. and to turn clipping back off, use
  295.      \epsfclipoff
  296.   A more general facility for sizing is available by defining the
  297. `epsfsize' macro.   You can redefine this macro to do almost anything.
  298. This TeX macro is passed two parameters by `epsffile'.  The first
  299. parameter is the natural horizontal size of the PostScript graphic, and
  300. the second parameter is the natural vertical size.  This macro is
  301. responsible for returning the desired horizontal size of the graph (the
  302. same as assigning `epsfxsize' above).
  303.   In the definitions given below, only the body is given; it should be
  304. inserted in
  305.      \def\epsfsize#1#2{BODY}
  306. Some common definitions are:
  307. `epsfxsize'
  308.      This definition (the default) enables the default features listed
  309.      above, by setting `epsfxsize' to the same value it had before the
  310.      macro was called.
  311. `0pt'
  312.      This definition forces natural sizes for all graphics by setting
  313.      the width to zero, which turns on horizontal scaling.
  314.      This forces natural sizes too, by returning the first parameter
  315.      only (the natural width) and setting the width to it.
  316. `hsize'
  317.      This forces all graphics to be scaled so they are as wide as the
  318.      current horizontal size.  (In LaTeX, use `textwidth' instead of
  319.      `hsize'.)
  320. `0.5#1'
  321.      This scales all figures to half of their natural size.
  322. `\ifnum#1>\hsize\hsize\else#1\fi'
  323.      This keeps graphics at their natural size, unless the width would
  324.      be wider than the current `hsize', in which case the graphic is
  325.      scaled down to `hsize'.
  326.   If you want TeX to report the size of the figure as a message on your
  327. terminal when it processes each figure, give the command
  328.      \epsfverbosetrue
  329. File: dvips.info,  Node: Header Files,  Next: Literal PS,  Prev: EPSF Macros,  Up: Including PostScript
  330. Header Files
  331. ============
  332.   Often in order to get a particular graphic file to work, a certain
  333. header file might need to be sent first.  Sometimes this is even
  334. desirable, since the size of the header macros can dominate the size of
  335. certain PostScript graphics files.  The dvips program provides support
  336. for this with the `header=' special command.  For instance, to ensure
  337. that `foo.ps' gets downloaded as part of the header material, the
  338. following command should be added to the TeX file:
  339.      \special{header=foo.ps}
  340. The dictionary stack will be at the `userdict' level when these header
  341. files are included.
  342.   For these and all other header files (including the headers required
  343. by dvips itself and any downloaded fonts), the printer VM budget is
  344. debited by some value.  If the header file has, in its first 1024 bytes,
  345. a line of the form
  346.      %%VMusage: MIN MAX
  347. then the maximum value is used.  If it doesn't, then the total size of
  348. the header file in bytes is used as an approximation of the memory
  349. requirements.
  350. File: dvips.info,  Node: Literal PS,  Next: Literal headers,  Prev: Header Files,  Up: Including PostScript
  351. Literal PostScript
  352. ==================
  353.   For simple graphics, or just for experimentation, literal PostScript
  354. graphics can be included.  Simply use a `\special' beginning with a
  355. double quote (`"') (no closing `"').
  356.   For instance, the following (simple) graphic:
  357. was created by typing:
  358.      \vbox to 100bp{\vss % a bp is the same as a PostScript unit
  359.      \special{" newpath 0 0 moveto 100 100 lineto 394 0 lineto
  360.      closepath gsave 0.8 setgray fill grestore stroke}}
  361.   [ There is a picture of a triangle on hardcopy printouts and in the
  362. PostScript file generated by `dvips'.  (You are responsible for leaving
  363. space for such literal graphics.) Literal graphics are discouraged
  364. because of their nonportability.
  365. File: dvips.info,  Node: Literal headers,  Next: Graphics Support,  Prev: Literal PS,  Up: Including PostScript
  366. Literal Headers
  367. ===============
  368.   Similarly, you can define your own macros for use in such literal
  369. graphics through the use of literal macros.  Literal macros are defined
  370. just like literal graphics, only you begin the special with an
  371. exclamation point instead of a double quote.  These literal macros are
  372. included as part of the header material in a special dictionary called
  373. `SDict'.  This dictionary is the first one on the PostScript dictionary
  374. stack when any PostScript graphic is included, whether by literal
  375. inclusion or through the `epsffile' macros.
  376. File: dvips.info,  Node: Graphics Support,  Next: Dynamic Creation of Graphics,  Prev: Literal headers,  Up: Including PostScript
  377. Other Graphics Support
  378. ======================
  379.   There are other ways to include graphics with dvips.  One is to use an
  380. existing package, such as `emtex', `psfig', `tpic', or `METAPOST', all
  381. of which `dvips' supports.
  382.   Other facilities are available for historical reasons, but their use
  383. is discouraged, in hope that some `sane' form of PostScript inclusion
  384. shall become standard.  The main advantage of the `epsffile' macros is
  385. that they can be adapted for whatever form of special eventually becomes
  386. standard, and thus only minor modifications to that one file need to be
  387. made, rather than revising an entire library of TeX documents.
  388.   Most of these specials use a flexible key and value scheme:
  389.      \special{psfile=FILENAME.PS[KEY=VALUE]*}
  390. This will download the PostScript file called `filename.ps' such that
  391. the current point will be the origin of the PostScript coordinate
  392. system.  The optional key/value assignments allow you to specify
  393. transformations on the PostScript.
  394.   The possible keys are:
  395. `hoffset'
  396.      The horizontal offset (default 0)
  397. `voffset'
  398.      The vertical offset (default 0)
  399. `hsize'
  400.      The horizontal clipping size (default 612)
  401. `vsize'
  402.      The vertical clipping size (default 792)
  403. `hscale'
  404.      The horizontal scaling factor (default 100)
  405. `vscale'
  406.      The vertical scaling factor (default 100)
  407. `angle'
  408.      The rotation (default 0)
  409. `clip'
  410.      Enable clipping to the bounding box
  411.   The dimension parameters are all given in PostScript units.  The
  412. `hscale' and `vscale' are given in non-dimensioned percentage units,
  413. and the rotation value is specified in degrees.  Thus
  414.      \special{psfile=foo.ps hoffset=72 hscale=90 vscale=90}
  415. will shift the graphics produced by file `foo.ps' right by one inch and
  416. will draw it at 0.9 times normal size.  Offsets are given relative to
  417. the point of the special command, and are unaffected by scaling or
  418. rotation.  Rotation is counterclockwise about the origin.  The order of
  419. operations is to rotate the figure, scale it, then offset it.
  420.   For compatibility with older PostScript drivers, it is possible to
  421. change the units that `hscale' and `vscale' are given in.  This can be
  422. done by redefining `@scaleunit' in `SDict' by a TeX command such as
  423.      \special{! /@scaleunit 1 def}
  424. The `@scaleunit' variable, which is by default 100, is what `hscale'
  425. and `vscale' are divided by to yield an absolute scale factor.
  426.   All of the methods for including graphics we have described so far
  427. enclose the graphic in a PostScript save/restore pair, guaranteeing that
  428. the figure will have no effect on the rest of the document.  Another
  429. type of special command allows literal PostScript instructions to be
  430. inserted without enclosing them in this protective shield; users of this
  431. feature are supposed to understand what they are doing (and they
  432. shouldn't change the PostScript graphics state unless they are willing
  433. to take the consequences).  This command can take many forms, because it
  434. has had a torturous history; any of the following will work:
  435.      \special{ps:TEXT}
  436.      \special{ps::TEXT}
  437.      \special{ps::[begin]TEXT}
  438.      \special{ps::[end]TEXT}
  439. (with longer forms taking precedence over shorter forms, when they are
  440. used).  Note that `ps::' and `ps::[end]' do not do any positioning, so
  441. they can be used to continue PostScript literals started with `ps:' or
  442. `ps::[begin]'.  There is also the command
  443.      \special{ps: plotfile FILENAME}
  444. which will copy the commands from FILENAME verbatim into the output
  445. (but omitting lines that begin with %).  An example of the proper use
  446. of literal specials can be found in the file `rotate.tex' which makes
  447. it easy to typeset text turned 90 degrees.
  448.   To finish off this section, the following examples are presented
  449. without explanation:
  450.      \def\rotninety{\special{ps:currentpoint currentpoint translate 90
  451.      rotate neg exch neg exch translate}}\font\huge=cmbx10 at 14.4truept
  452.      \setbox0=\hbox to0pt{\huge A\hss}\vskip16truept\centerline{\copy0
  453.      \special{ps:gsave}\rotninety\copy0\rotninety\copy0\rotninety
  454.      \box0\special{ps:grestore}}\vskip16truept
  455.   [ There are 4 `A' characters, each rotated 90 degrees about a
  456. common center point ]
  457.      \vbox to 2truein{\special{ps:gsave 0.3 setgray}\hrule height 2in
  458.      width\hsize\vskip-2in\special{ps:grestore}\font\big=cminch\big
  459.      \vss\special{ps:gsave 1 setgray}\vbox to 0pt{\vskip2pt
  460.      \line{\hss\hskip4pt NEAT\hss}\vss}\special{ps:0 setgray}%
  461.      \hbox{\raise2pt\line{\hss NEAT\hss}\special{ps:grestore}}\vss}
  462.   [ There is a big gray box with the word `NEAT' inside in big letters ]
  463.   Some caveats are in order when using the above forms.  Make sure that
  464. each `gsave' on a page is matched with a `grestore' on the same page.
  465. Do not use `save' or `restore'.  Use of these macros can interact with
  466. the PostScript generated by dvips if care is not taken; try to
  467. understand what the above macros are doing before writing your own.
  468. The `\rotninety' macro especially has a useful trick that appears again
  469. and again.
  470. File: dvips.info,  Node: Dynamic Creation of Graphics,  Prev: Graphics Support,  Up: Including PostScript
  471. Dynamic Creation of PostScript Graphics Files
  472. =============================================
  473.   PostScript is an excellent page description language--but it does
  474. tend to be rather verbose.  Compressing PostScript graphics files can
  475. often reduce them by more than a factor of five.  For this reason, if
  476. the filename parameter to one of the graphics inclusion techniques
  477. starts with a backtick (``'), the filename is instead interpreted as a
  478. command to execute that will send the actual file to standard output.
  479. Thus,
  480.      \special{psfile="`zcat foo.ps.Z"}
  481. will include the uncompressed version of `foo.ps'.  Since such a
  482. command is not accessible to TeX, if you use this facility with the
  483. `EPSF' macros, you need to supply the bounding box parameter yourself,
  484. as in
  485.      \epsffile[72 72 540 720]{"`zcat screendump.ps.Z"}
  486. to include `screendump.ps'.  Of course, the commands to be executed can
  487. be anything, including using a file conversion utility such as `tek2ps'
  488. or whatever is appropriate.
  489.   This extension is not portable to other DVI-to-PostScript translators.
  490. File: dvips.info,  Node: PostScript fonts,  Next: Invoking dvips,  Prev: Including PostScript,  Up: Top
  491. Using PostScript Fonts
  492. **********************
  493.   Thanks to Donald E. Knuth, the dvips driver now supports PostScript
  494. fonts through the virtual font capability.  PostScript fonts are (or
  495. should be) accompanied by a font metric file such as `Times-Roman.afm',
  496. which describes characteristics of a font called Times-Roman.  To use
  497. such fonts with TeX, we need `tfm' files that contain similar
  498. information. These can be generated from `afm' files by running the
  499. program `afm2tfm', supplied with dvips.  This program also creates
  500. virtual fonts with which you can use normal plain TeX conventions.  See
  501. Donald E. Knuth, `TUGboat' v. 11, no. 1, Apr. 1990, pp. 13-23, "Virtual
  502. Fonts: More Fun for Grand Wizards", for a general introduction to
  503. virtual fonts.
  504.   Non-resident downloaded PostScript fonts tend to use a great deal of
  505. printer virtual memory.  PostScript printers typically have between
  506. 130,000 and 400,000 bytes of available virtual memory; each downloaded
  507. font will require approximately 30,000 bytes of that.  For many
  508. applications, bitmapped fonts work much better, even at typesetter
  509. resolutions (with the `-Z' option).
  510.   Even resident PostScript fonts can take a fair amount of memory, but
  511. less with this release of dvips than previously.  Also, bitmapped fonts
  512. tend to image faster than PostScript fonts.
  513. * Menu:
  514. * afm2tfm::
  515. * Changing Encodings::
  516. * Special Font Effects::
  517. * Non-resident Fonts::
  518. * Invoking Afm2tfm::
  519. File: dvips.info,  Node: afm2tfm,  Next: Changing Encodings,  Up: PostScript fonts
  520. The Afm2tfm Program
  521. ===================
  522.   In its simplest use, `afm2tfm' converts an Adobe `afm' file (e.g.,
  523. `Times-Roman.afm') into a `raw' TeX TFM file (say, `rptmr.tfm' with the
  524. command
  525.      afm2tfm Times-Roman rptmr
  526. This file is raw because it does no character remapping; it simply
  527. converts the character information on a one-to-one basis to TeX
  528. characters *with the same code*.  (It would be better to have eschewed
  529. the use of the `r' prefix in favor of using a variant letter to specify
  530. the encoding; but we didn't think of that at the time, and it's too
  531. late to change existing fonts.  *Note Top: (fontname)Top.)
  532.   In the following examples, we will use the font Times-Roman to
  533. illustrate the conversion process.  For the standard 35 LaserWriter
  534. fonts, however, it is highly recommended that you use the supplied
  535. `tfm' and `vf' files that come with dvips, as these files contain some
  536. additional changes that make them work better with TeX than they
  537. otherwise would.
  538.   Standard PostScript fonts have a different encoding scheme from that
  539. of plain TeX. Although both schemes are based on ASCII, special
  540. characters such as ligatures and accents are handled quite differently.
  541. Therefore we obtain best results by using a `virtual font' interface,
  542. which makes TeX see a standard TeX encoding for the PostScript font.
  543. Such a virtual font can be obtained, for example, by the command
  544.      afm2tfm Times-Roman -v ptmr rptmr
  545. This produces two files as output, namely the `virtual property list'
  546. file `ptmr.vpl', and the raw font metric file `rptmr.tfm'.  (The upper
  547. case `-V' also produces a `vpl' file, but maps a set of small caps into
  548. the lower case alphabet.) To use the font in TeX, you should first run
  549.      vptovf ptmr.vpl ptmr.vf ptmr.tfm
  550. and then install the virtual font file `ptmr.vf' where Dvips will see
  551. it, and install `ptmr.tfm' and `rptmr.tfm' where TeX and Dvips will see
  552. them.
  553.   You can also make more complex virtual fonts by editing `ptmr.vpl'
  554. before running `vptovf'; such editing might add the uppercase Greek
  555. characters in the standard TeX positions, for instance.  (This has
  556. already been done for the font files that come with Dvips.)  Once this
  557. has been done, you're all set. You can use code like this in TeX
  558. henceforth:
  559.      \font\myfont = ptmr at 12pt
  560.      \myfont Hello, I am being typeset in 12-point Times-Roman.
  561.   Thus we have two fonts, one actual (`rptmr', which is analogous to
  562. the font in the printer) and one virtual (`ptmr', which has been
  563. remapped to the standard TeX encoding (almost), and has typesetting
  564. know-how added. You could also say
  565.      \font\PTR = rptmr at 10pt
  566. and typeset directly with that, but then you would have no ligatures or
  567. kerning, and you would have to use Adobe character positions for
  568. special letters like the ligature 'AE'.  The virtual font called `ptmr'
  569. not only has ligatures and kerning, and most of the standard accent
  570. conventions of TeX, it also has a few additional features not present
  571. in the Computer Modern fonts. For example, it includes all the Adobe
  572. characters (such as the Polish ogonek and the French guillemots).  The
  573. only things you lose from ordinary TeX text fonts are the dotless `j'
  574. (which can be hacked into the VPL file with literal PostScript specials
  575. if you have the patience) and uppercase Greek letters (which just don't
  576. exist unless you buy them separately).
  577.   The remapped `p*' fonts mostly follow plain TeX conventions for
  578. accents.  The exceptions: the Hungarian umlaut (which is at position
  579. `0x7D' in `cmr10', but position `0xCD' in `ptmr'); the dot accent (at
  580. positions `0x5F' and `0xC7', respectively); and `\AA', which neds
  581. different tweaking.  In order to use these accents with PostScript
  582. fonts or in math mode when `\textfont0' is a PostScript font, you will
  583. need to use the following definitions.  These definitions will not work
  584. with the Computer Modern fonts for the relevant accents.  They are
  585. already part of the distributed `psfonts.sty' for use with LaTeX.
  586.      \def\H#1{{\accent"CD #1}}
  587.      \def\.#1{{\accent"C7 #1}}
  588.      \def\dot{\mathaccent"70C7 }
  589.      \newdimen\aadimen
  590.      \def\AA{\leavevmode\setbox0\hbox{h}\aadimen\ht0
  591.        \advance\aadimen-1ex\setbox0\hbox{A}\rlap{\raise.67\aadimen
  592.        \hbox to \wd0{\hss\char'27\hss}}A}
  593.   These PostScript fonts can be scaled to any size.  Go wild!  Using
  594. PostScript fonts, however, does use up a great deal of the printer's
  595. memory and it does take time.  You may find downloading bitmapped fonts
  596. (possibly compressed) to be faster than using the built-in PostScript
  597. fonts!
  598. File: dvips.info,  Node: Changing Encodings,  Next: Special Font Effects,  Prev: afm2tfm,  Up: PostScript fonts
  599. Changing a Font's Encoding
  600. ==========================
  601.   The `afm2tfm' program also allows you to specify a different encoding
  602. for a PostScript font.  This can be done at two levels.
  603.   You can specify a different output encoding with `-t'. This only
  604. applies when you are building a virtual font, and it tells `afm2tfm' to
  605. attempt to remap the font to match the output encoding as closely as
  606. possible.  In such an output encoding, you can also specify ligature
  607. pairs and kerning information that will be used in addition to the
  608. information in the `afm' file.
  609.   You can also specify a different PostScript encoding with `-p'.  This
  610. changes both the raw `tfm' file created by Afm2tfm and the `vf' and
  611. `tfm' files created by VPtoVF.  It also requires that the encoding file
  612. be downloaded as part of any document that uses this font.  This is the
  613. only way to access characters in a PostScript font that are neither
  614. encoded in the `afm' file nor built from other characters (constructed
  615. characters).  For instance, `Times-Roman' contains the extra characters
  616. `trademark' and `registered' (among others) that can only be accessed
  617. through such a PostScript reencoding.  Any ligature or kern information
  618. specified in the PostScript encoding is ignored by `afm2tfm'.
  619.   To combine the effects of `-p' and `-t', use `-T'.  If you make
  620. regular use of a private non-standard reencoding `-T' is usually the
  621. better idea, since you can get unexpected inconsistencies in mapping
  622. otherwise.
  623.   Afm2tfm's encoding files have precisely the same format as an
  624. encoding vector in any PostScript font.  Specifically:
  625.      % Comments are ignored, unless the first word after the percent sign
  626.      % is LIGKERN -- see below.
  627.      /MyEncoding [ /Alpha /Beta /Gamma /Delta ...
  628.           /A /B ... /Z % exactly 256 entries, each with a / at the front
  629.           /wfooaccent /xfooaccent /yfooaccent /zfooaccent ] def
  630.   Comments, which start with a percent sign and continue until the end
  631. of the line, are ignored unless they start with `LIGKERN'.  The first
  632. `word' of the file must start with a forward slash (a PostScript
  633. literal name) and defines the name of the encoding.  The next word must
  634. be an left bracket `['.  Following that must be precisely 256 character
  635. names; use `/.notdef' for any that you do not want defined.  Finally,
  636. there must be a matching right bracket `]'.  A final `def' token is
  637. optional.  All names are case sensitive.
  638.   Any ligature or kern information is given in the comments.  If the
  639. first word after the percent sign is `LIGKERN', then the entire rest of
  640. the line is parsed for ligature and kern information.  This ligature
  641. and kern information is given in groups of words, each group of which
  642. must be terminated by a semicolon (with a space before and after it,
  643. unless it occurs at the end of a line.)
  644.   In these `LIGKERN' statements, three types of information may be
  645. specified.  These three types are ligature pairs, kerns to remove or
  646. ignore, and the character value of this font's boundary character.
  647. Which of the types the particular set of words corresponds to is
  648. automatically determined by the allowable syntax.
  649.   Throughout a `LIGKERN' statement, the boundary character is specified
  650. as `||'.
  651.   To set the boundary character value, a command such as `|| = 39 ;'
  652. must be used.
  653.   To indicate a kern to remove, give the names of the two characters
  654. (without the leading slash) separated by `{}', as in `one {} one ;'.
  655. This is similar to the way you might use `{}' in a TeX file to turn off
  656. ligatures or kerns at a particular location.  Either or both of the
  657. character names can be given as `*', which is a wild card matching any
  658. character; thus, all kerns can be removed with `* {} * ;'.
  659.   To specify a ligature, specify the names of the pair of characters,
  660. followed by the ligature `operation' (as in METAFONT), followed by the
  661. replacing character name.  Either (but not both) of the first two
  662. characters can be `||' to indicate a word boundary.
  663.   Normally the `operation' is `=:' meaning that both characters are
  664. removed and replaced by the third character, but by adding `|'
  665. characters on either side of the `=:', you can specify which of the two
  666. leading characters to retain.  In addition, by suffixing the ligature
  667. operation with one or two `>' signs, you can indicate that the ligature
  668. scanning operation should skip that many characters before proceeding.
  669. This works just like in METAFONT.  A typical ligature might be
  670. specified with `ff i =: ffi ;'.  A more convoluted ligature is `one one
  671. |=:|>> exclam ;' which indicates that every pair of adjacent `1''s
  672. should be separated by an exclamation point, and then two of the
  673. resulting characters should be skipped over before continuing searching
  674. for ligatures and kerns.  You cannot give more `>''s in an ligature
  675. operation as you did `|', so there are a total of eight possible
  676. ligature operations:
  677.      =: |=: |=:> =:| =:|> |=:| |=:|> |=:|>>
  678. The default set of ligatures and kerns built in to `afm2tfm' can be
  679. specified with:
  680.      % LIGKERN question quoteleft =: questiondown ;
  681.      % LIGKERN exclam quoteleft =: exclamdown ;
  682.      % LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ;
  683.      % LIGKERN quoteleft quoteleft =: quotedblleft ;
  684.      % LIGKERN quoteright quoteright =: quotedblright ;
  685.      % LIGKERN space {} * ; * {} space ; 0 {} * ; * {} 0 ;
  686.      % LIGKERN 1 {} * ; * {} 1 ; 2 {} * ; * {} 2 ; 3 {} * ; * {} 3 ;
  687.      % LIGKERN 4 {} * ; * {} 4 ; 5 {} * ; * {} 5 ; 6 {} * ; * {} 6 ;
  688.      % LIGKERN 7 {} * ; * {} 7 ; 8 {} * ; * {} 8 ; 9 {} * ; * {} 9 ;
  689. File: dvips.info,  Node: Special Font Effects,  Next: Non-resident Fonts,  Prev: Changing Encodings,  Up: PostScript fonts
  690. Special Font Effects
  691. ====================
  692.   Afm2tfm can do other manipulations as well.  For example, to make an
  693. obliqued variant of Times Roman:
  694.      afm2tfm Times-Roman -s .167 -v ptmro rptmro
  695. which creates `ptmro.vpl' and `rptmro.tfm'.  To use this, put the line
  696.      rptmro Times-Roman ".167 SlantFont"
  697. into `psfonts.map'.  Then `rptmro' (our name for the obliqued Times)
  698. will act as if it were a resident font, although it is actually
  699. constructed from Times-Roman via the PostScript routine `SlantFont'
  700. (which slants everything 1/6 to the right, in this case).
  701.   Similarly, you can get an expanded font with
  702.      afm2tfm Times-Roman -e 1.2 -v ptmrre rptmrre
  703. and by recording the pseudo-resident font
  704.      rptmrre Times-Roman "1.2 ExtendFont"
  705. in `psfonts.map'.
  706.   You can also create a small caps font with a command such as
  707.      afm2tfm Times-Roman -V ptmrc rptmrc
  708. This will generate a set of small caps mapped into the usual lower case
  709. positions and scaled down to 0.8 of the normal cap dimensions.  You can
  710. also specify the scaling as something other than the default 0.8:
  711.      afm2tfm Times-Roman -c 0.7 -V ptmrc rptmrc
  712.   It is unfortunately not possible to increase the width of the small
  713. caps independently of the rest of the font.  If you want a really
  714. professional looking set of small caps you will have to make up a
  715. custom pair of ``tfm'' and ``vpl'' files using the `-e' option, change
  716. the name and checksum of the D 1 font in `ptmrc.vpl' to match the
  717. customized raw `tfm', and replace the small caps at the lower case
  718. mappings with the small caps in the customized file.  You can then
  719. throw away the customized `vpl' file, but not the customized `tfm'.
  720. That must be identified with an appropriate line in `psfonts.map'.
  721.   To change the `PaintType' in a font from filled (0) to outlined (2),
  722. you can add `"/PaintType 2 store"' to `psfonts.map', as in the
  723. following:
  724.      rphvrl   Helvetica "/PaintType 2 store"
  725.   If you change the PostScript encoding of a font, you must specify the
  726. input file as a header file, as well as give a reencoding command.  For
  727. instance, let us say we are using Times-Roman reencoded according to
  728. the encoding `MyEncoding' (stored in the file `myenc.enc') as `rptmrx'.
  729. In this case, our `psfonts.map' entry would look like
  730.      rptmrx Times-Roman "MyEncoding ReEncodeFont" <myenc.enc
  731.   The `afm2tfm' program prints out the precise line you need to add to
  732. `psfonts.map' to use that font, assuming the font is resident in the
  733. printer; if the font is not resident, you must add the header command
  734. to download the font yourself.  Each identical line only needs to be
  735. specified once in the `psfonts.map' file, even though many different
  736. fonts (small caps variants, or ones with different output encodings)
  737. may be based on it.
  738. File: dvips.info,  Node: Non-resident Fonts,  Next: Invoking Afm2tfm,  Prev: Special Font Effects,  Up: PostScript fonts
  739. Non-resident PostScript Fonts
  740. =============================
  741.   If you want to use a non-printer-resident PostScript font for which
  742. you have a `pfb' or `pfa' file (an Adobe Type 1 font program), you can
  743. make it act like a resident font by putting a `<' sign and the name of
  744. the `pfb' or `pfa' file just after the font name in the `psfonts.map'
  745. file entry. For example,
  746.      rpstrn StoneInformal <StoneInformal.pfb
  747. will cause dvips to include `StoneInformal.pfb' in your document as if
  748. it were a header file, whenever the pseudo-resident font StoneInformal
  749. is used in a document.  Similarly, you can generate transformed fonts
  750. and include lines like
  751.      rpstrc StoneInformal <StoneInformal.pfb ".8 ExtendFont"
  752. in `psfonts.map', in which case `StoneInformal.pfb' will be loaded
  753. whenever StoneInformal-Condensed is used. Each header file is loaded at
  754. most once per document.
  755.   If you are using a `pfb' file that is also has a different PostScript
  756. encoding, you need to download multiple header files in `psfonts.map'.
  757. If, for instance, `Optima' was both non-resident and you wanted to
  758. reencode it in PostScript with `MyEncoding' stored in `myenc.enc', you
  759. need:
  760.      rpstrnx Optima "MyEncoding ReEncodeFont" <myenc.enc <Optima.pfb
  761.   When using PFB files, dvips is smart enough to unpack the binary PFB
  762. format into printable ASCII so there is no need to perform this
  763. conversion yourself.  In addition, it will scan the font to determine
  764. its memory usage, as it would for any header file.
  765.   Here is a brief description of the contents of `psfonts.map'.  If a
  766. line is empty or begins with a space, percent, asterisk, semicolon, or
  767. hash mark, it is ignored.  Otherwise, the line is separated into words,
  768. where words are separated by spaces or tabs, except that if a word
  769. begins with a double quote, it extends until the next double quote or
  770. the end of the line.  If a word starts with a less than character, it is
  771. treated as a font header file (or a downloaded PostScript font).  There
  772. can be more than one such header for a given font.  If a word starts
  773. with a double quote, it is a special instruction for generating that
  774. font.  Otherwise it is a name.  The first such name is the TFM file that
  775. a virtual font file can refer to.  If there is another name, it is used
  776. as the PostScript name; if there is only one name, it is used for both
  777. the TeX name and the PostScript name.
  778. File: dvips.info,  Node: Invoking Afm2tfm,  Prev: Non-resident Fonts,  Up: PostScript fonts
  779. Invoking Afm2tfm
  780. ================
  781.   The command line switches to `afm2tfm' are:
  782. `-c RATIO'
  783.      See `-V'; overrides the default ratio of 0.8 for the scaling of
  784.      small caps.
  785. `-e RATIO'
  786.      All characters are stretched horizontally by the stated ratio; if
  787.      it is less than 1.0, you get a condensed font.
  788.      This option forces all character codes in the output `vpl' file be
  789.      given as octal values; this is useful for symbol or other
  790.      special-purpose fonts where character names such as `A' have no
  791.      meaning.
  792. `-p FILE'
  793.      This specifies a file to use for the PostScript encoding of the
  794.      font.  This file must also be mentioned as a header file for the
  795.      font in `psfonts.map', and that ligature and kern information in
  796.      this file is ignored.
  797. `-T FILE'
  798.      This option specifies that FILE is to be used for both the
  799.      PostScript and target TeX encodings of the font.
  800. `-t FILE'
  801.      This specifies a file to use for the target TeX encoding of the
  802.      font.  Ligature and kern information may also be specified in this
  803.      file; the file need not be mentioned in `psfonts.map'.
  804. `-s SLANT'
  805.      All characters are slanted to the right by SLANT.  If SLANT is
  806.      negative, the letters slope to the left (or they might be upright
  807.      if you start with an italic font).
  808.      This option indicates that `afm2tfm' should use only those
  809.      characters that are required by the output encoding, and no
  810.      others.  Normally, `afm2tfm' tries to include both characters that
  811.      fit the output encoding and any additional characters that might
  812.      exist in the font.  This option forbids those additional
  813.      characters from being added.
  814. `-v FILE'
  815.      Generate a virtual property list `vpl' file as well as a `tfm'
  816.      file.
  817. `-V FILE'
  818.      Same as `-v', but the virtual font generated is a small caps font
  819.      obtained by scaling uppercase letters by 0.8 to typeset lowercase.
  820.      This font handles accented letters and retains proper kerning.
  821.   Here are the `CODINGSCHEMES' that result from the various possible
  822. choices for reencoding.
  823. `default encoding'
  824.           (CODINGSCHEME TeX text + AdobeStandardEncoding)
  825. `-p DC.enc'
  826.           (CODINGSCHEME TeX text + DCEncoding)
  827. `-t DC.enc'
  828.           (CODINGSCHEME DCEncoding + AdobeStandardEncoding)
  829. `-T DC.enc'
  830.           (CODINGSCHEME DCEncoding + DCEncoding)
  831.