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:
- Install the LaTeX2e package PSNFSS.
Follow instructions in
macros/latex/required/psnfss/00readme.txt
in the
Comprehensive TeX Archive Network
(CTAN).
- Place
\usepackage{times,mathptmx} into a TeX file.
- If you use the
mathptmx package and
the \mathcal command, you have to install the rsfs fonts
as follows. \mathcal uses the rsfs fonts.
- 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 texmf.cnf.
- 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 texmf.cnf.
Even if you have done the setup above,
a few Computer Modern fonts are embedded.
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 mathptmx.sty
(in PSNFSS 8.1 and earlier releases) in comparison to
mathptm.sty or the CM fonts. The reason for this phenomenon is
that \fontdimen5 in zptmcm7y.tfm
is too small.
More details are found
at http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=psnfss/3279.
To solve this problem,
replace $TEXMF/fonts/tfm/adobe/times/zptmcm7y.tfm
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:
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.
- 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 texmf.cnf.
- Place the font map file
yandy.map into the directory
in which the configuration file
psfonts.map 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.
- Add the line "p +yandy.map" into the file
config.ps.
- 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.
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.
- 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.
- 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.
- Produce a PDF file directly with the
PDF(La)TeX.
PDFTeX can embed outline
fonts.
- 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.
hyperref.sty can convert
\ref, \lable,
table of contents, index, etc. of LaTeX into
hyperlinks in PDF. It works both PDFLaTeX and normal LaTeX.
hyperref.sty can be obtained from
macros/latex/contrib/supported/hyperref in CTAN.
You also need macros/latex/contrib/other/misc/url.sty.
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
ryutaroh@ss.titech.ac.jp