26/10/2008 Making a Compact Beautiful PostScr…
How to make a compact beautiful PostScript
or PDF file from a TeX file
(Japanese version)
Last Modified: October 31, 2000.
There are lots of PostScript and PDF documents generated from TeX files in the Internet, but many of
them assume a fixed resolution of an output device and produce dirty results if they are displayed on a
monitor or printed by a printer of different resolution. In particular, it is well-known that the Adobe
Acrobat Reader displays resolution-dependent (bitmap) fonts very poorly. Their sizes are also large
compared to their original DVI files. The reason of those phenomena is that a PostScript or PDF file
converted from a TeX one contains lots of bitmap fonts. I explain how to
reduce the size of fonts information,
and include outline fonts instead of bitmap ones
in a PostScript or PDF file with LaTeX2e and Dvipsk. Since we often make PDF files from PS files, I
start on PS files. (A well-written explanation on the same topic can be found in the "PostScript and TeX"
section of TeX FAQ.)
How to reduce the size of fonts data included in a PostScript
TeX uses the Computer Modern fonts designed by Donald E. Knuth, and a PostScript file converted from
a TeX one usually contains the Computer Modern fonts in bitmap format. On the other hand, almost all
printers have the PostScript fonts called
Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold,
Helvetica-BoldOblique, Helvetica-Oblique, Symbol, Times-Bold, Times-BoldItalic, Times-
Italic, and Times-Roman.
If we use those fonts in TeX, we do not have to embed fonts into the PostScript file. So it becomes
smaller. They can be used as follows:
1. Install the LaTeX2e package PSNFSS. Follow instructions in
macros/latex/required/psnfss/[Link] in the Comprehensive TeX Archive
Network (CTAN).
2. Place \usepackage{times,mathptmx} into a TeX file.
3. If you use the mathptmx package and the \mathcal command, you have to install the rsfs fonts as
follows. \mathcal uses the rsfs fonts.
1. Get all *.pfb files in the directory fonts/rsfs/ps-type1/hoekwater in CTAN and
move them to a directory pointed by the variable T1FONTS in [Link].
2. Generate TFM files from *.afm files in fonts/rsfs/ps-type1/hoekwater/afm using
afm2tfm, or from *.mf files in fonts/rsfs. Move all *.tfm into a directory pointed by
the variable TFMFONTS in [Link].
Even if you have done the setup above, a few Computer Modern fonts are embedded.
[Link] 1/3
26/10/2008 Making a Compact Beautiful PostScr…
The mathptmx package does not provide bold face math italic fonts. Thus we cannot use \boldmath,
\boldsymbol, etc. If you put either of the following lines
\DeclareMathAlphabet{\bm}{OT1}{ptm}{b}{it}, or
\DeclareMathAlphabet{\bm}{OML}{cmm}{b}{it},
then $\bm{x}$ produces the bold version of $x$.
Subscripts are positioned unnaturally below by [Link] (in PSNFSS 8.1 and earlier releases) in
comparison to [Link] or the CM fonts. The reason for this phenomenon is that \fontdimen5 in
[Link] is too small. More details are found at [Link]
pr=psnfss/3279.
To solve this problem, replace $TEXMF/fonts/tfm/adobe/times/[Link] with this version.
Since this is recognized by the developer of PSNFSS, I expect it is fixed in the next release.
You might not like the typesetting of mathematics by mathptmx. Other math fonts matching the Times font
in text are MathTime and Lucida sold by Y&Y. A free clone of MathTime fonts is available from
TrueTeX.
The free TX fonts are also designed to match the Times font. They are available from the
fonts/txfonts directory at CTAN.
We usually include a photographic image to a TeX document in the EPS format. The size of the EPS file
becomes significantly smaller by using jpeg2ps.
Making a resolution-independent PostScript file
I explain how to include the Computer Modern fonts in outline format instead of bitmap one.
PostScript Type 1 is a format of outline fonts that can be understood by a PostScript printer. There are
the following 2 kinds of PostScript Type 1 version of Computer Modern fonts:
the version had been sold by Y&Y and became freely available,
and the version called BaKoMa.
Since the BaKoMa fonts deviates from the specification of Type 1 fonts and cause problems with
PDFLaTeX, I explain how to install the Y&Y fonts.
1. Get the all files ended with .pfb in the archives in the directories fonts/cm/ps-type1/bluesky
and fonts/amsfonts/ps-type1 in CTAN. Then move them into a directory pointed by the
variable T1FONTS in [Link].
2. Place the font map file [Link] into the directory in which the configuration file [Link] of
dvipsk is placed. A map file for dvips is placed at the same directory as the Y&Y fonts, but it lacks
entries of fonts lasy10 etc. and is incomplete.
3. Add the line "p +[Link]" into the file [Link].
4. The Y&Y fonts do not have some fonts available in the standard LaTeX, e.g. cmmib9. The
type1cm package instructs LaTeX to compensate missing fonts by scaling existing fonts. It can be
obtained from macros/latex/contrib/supported/type1cm in CTAN.
[Link] 2/3
26/10/2008 Making a Compact Beautiful PostScr…
DVI files compiled in the standard way cannot be converted by dvips when they use missing fonts
in Y&Y. This map file instructs dvips to scale existing fonts to missing fonts. Note that Y&Y sells
the missing type 1 fonts. The price is $75.
How to make compact beautiful PDF files
There are the 4 methods producing a PDF file from a TeX input on a UNIX environment.
1. Produce a PostScript file then convert it into the PDF format by Adobe Acrobat. If you make a
PostScript by the method above then you get a PDF file containing a few outline fonts, i.e., a
compact beautiful PDF file.
2. Produce a PostScript file then convert it into the PDF format by Ghostscript. Ghostscript before
version 6 cannot embed outline fonts in a PDF file and it converts any fonts into bitmap format. So
the resulting PDF is resolution-dependent if you use old versions.
3. Produce a PDF file directly with the PDF(La)TeX. PDFTeX can embed outline fonts.
4. dvipdfm convert DVI files into PDF files. But I have not used it and I don't know the detail of
dvipdfm.
A PDF file can contain hyperlinks. [Link] can convert \ref, \lable, table of contents, index,
etc. of LaTeX into hyperlinks in PDF. It works both PDFLaTeX and normal LaTeX. [Link] can
be obtained from macros/latex/contrib/supported/hyperref in CTAN. You also need
macros/latex/contrib/other/misc/[Link].
A PDF file can be compressed with the LZW algorithm. But by the Unisys threat, Ghostscript and
PDFTeX seem unable to compress PDF files with the LZW algorithm. Instead of the LZW algorithm, they
compress PDF files with the Deflate algorithm, which is usually better than the LZW algorithm.
TeX Resources on the Web on the TeX Users Group web page. That is a comprehensive list.
Ryutaroh Matsumoto
[Link] 3/3