Last modified on 14 May 2010, at 20:01

ETD Guide/Students/From LaTeX

Generally speaking, there are several possibilities for producing PDF document from a LaTeX document.

Using Postscript and scalable fonts for PDFEdit

"One of the most confusing issues in both Postscript and PDF is the handling of different types of fonts. A PDF-producing application can deal with a font in one of three ways: First it can take the entire font and embed it in the file; second it can make a subset; or third it can simply embed some summary details about the font (such as its name, metrics, its encoding, its type - sans serif, symbol, for example - and clues about its design) and rely on the display application to show something plausible. This last strategy is preferred for documents that are to be delivered on the Web, since it creates the smallest files. The display application can work again in several ways. It can try to find the named fonts on the local system; it can simply substitute fonts as intelligently as possible; or it can use Multiple Master fonts to mimic the appearance of the original font." (from Goosens; Rahtz: The LaTeX Web Companion, page 29)

The default installation of dvips uses fonts with a fixed resolution (.pk fonts) encoded as 300dpi (dots per inch) bitmaps. This is unnoticeable for printing; however, the resulting PDF files are barely legible when scaled down to today's screen resolutions (typically 72dpi). These fonts are embedded in Postscript Output as Type 3 fonts. Acrobat Distiller cannot handle those fonts, because there are no font descriptors available. It leaves them embedded in PDF files and renders them very badly, although printing those documents doesn't make too many differences, if the original resolution was high enough.

Therefore it is necessary to install Postscript Type 1 fonts (True Type) for the dvips program. Many commonly used fonts have been converted to Type 1 fonts, e.g.: All Computer Modern family fonts, all fonts from the American Mathematical Society, the St. Mary's Road symbol fonts, the RSFS script fonts, the TIPA phonetic fonts and the XY-pic fonts.

The Type 1 Computer Modern fonts are provided by Virginia Tech and part of this guide (cmps.tgz / cmps.tar.gz). These files are about 5 MB. To install the fonts you have to…

On standard LINUX systems they are already installed:

1. Copy all files which are in the gz-archive under the directory pfb into the directory, in which dvips looks for fonts, e.g. /usr/local/teTex/texmf/fonts.

2. In the directory e.g. /usr/local/teTex/texmf/dvips/misc there is a file psfonts.map. Please add the content of the files cmfonts.map, cyrfonts.map, eufonts.map,and lafonts.map to that file. They are provided with this cmps.tgz archive.

3. The config.ps file is usually used for defining the resolution. This is irrelevant, because dvips now uses the scalable fonts instead of the bitmapped pk fonts.

4. The afm und pfm directory in the archive is not used by dvips.


To obtain a ps-file which uses Postscript fonts and is convertible into PDF you have to run the following command sequence:

1. latex mydissertation.tex.

2. bibtex mydissertation.aux if bibtex is used.

3. latex mydissertation.tex.

4. dvips -P cmz mydissertation.dvi: This produces a file dissertation.ps that is printable on a printer, or convertible into PDF.

5. If Acrobat Distiller is installed on the system "distill mydissertation.ps" which produces a PDF file: mydissertation.pdf.


Producing Rich PDFEdit

Producing a WWW-readable PDF is just the first part of a PDF production. It is more sophisticated to produce a PDF file that takes advantage of the hypertext features of PDF and adds links and cross- references to a PDF file.

You can use the Adobe Exchange software under Windows/Macintosh to add links, etc., to a ready produced PDF file, or you can produce those features directly from LaTeX using the Hyperref-package. This package has been developed by Sebastian Rahtz and uses the outcome of the Hypertex project.

This package extends the capabilities of the LaTeX cross-referencing commands (TOC,bibliographies, etc.) to produce \special commands that a driver can turn into hypertext links. It also defines new commands for LaTeX.

For using hyperref a global option can be used within the LaTeX file:

\documentclass[dvips]{article}

\usepackage{hyperref}


In order to produce PDF-information, it is possible to insert title and author information that are then displayed in the PDF file as follows:

In LaTeX:

\documentclass[dvips]{article}

\usepackage[

pdfauthor={Susanne Dobratz},

pdftitle={ Test of the pdftex Package },

pdfcreator={pdftex},

pdfsubject={electronic publishing in LaTeX},

pdfkeywords={keyword1,keyword2}

]{hyperref}


This looks in PDF like this:

%PDF-1.2

%âãÏÓ

1 0 obj

<<

/CreationDate (D:191010522170228)

/Keywords (keyword1,keyword2)

/Creator (pdftex)

/Title (Test of the pdftex Package)

/Producer (dvips + Distiller)

/Author (Susanne Dobratz)

/Subject (electronic publishing in LaTeX)

>>


The usual \label and \autoref commands are used to produce hyperlinks. The \autoref-command replaces therefore the usual \ref-command in LaTeX. So the following document structures are automatically referenced, if a \label has been applied. This also automatically produces Adobe-PDF bookmarks and hyperlinks to chapters, sections, etc. if the LaTeX command \tableofcontents is used.

Within the LaTeX file there are some additional user macros available to produce hyperlinks:

\href{url}{text} The text is used a hyperlink to the url . This URL must be a full URL (like http://www.cybertheses.org)
\hyperbaseurl{url} A base url is established, prepended to other specified URLs to make it easier to write PDF documents.
\hyperimage{image url} The image referenced by the image url is inserted.
\hyperdef{category}

{name}{text}

A target area of the document (text) is marked and given the name category.name
\hyperref{url}{category}

{name}{text}

The text is made into a link to url#category.name
\hyperref[label]{text} The text becomes a link point to a point established with a \label command (using the symbolic name label).


It is even possible to use Acrobat specific commands, e.g.menu options to navigate etc., like in this example from Sebastian Rahtz:

\usepackage{fancyhdr}

\pagestyle{fancy}

\cfoot{\NavigationBar}

\newcommand{\Navigationbar}{%

\Acrobatmenu{PrevPage}{previous}~

\Acrobatmenu{NextPage}{next}~

\Acrobatmenu{FirstPage}{first}~

\Acrobatmenu{LastPage}{last}~

\Acrobatmenu{GoBack}{back}~

\Acrobatmenu{Quit}{quit}%}


For further information and help, we recommend the book by Goosens/ Rahtz: The LaTeX Web Companion.

The \special commands that are added by using the LaTeX macros have to be interpreted by DVI drivers or viewers in order to produce PDF links.

The following DVI drivers are supported by the hyperref package:

  • hypertex
  • dvips - writes \special commands to Postscript tailored for dvips
  • dvipsone - writes \special commands to Postscript tailored for dvipsone
  • pdftex - writes commands for pdftex, and produces PDF directly
  • dvipdfm - writes \special commands to be used for Mark Wicks' DVI to PDF driver dvipdfm
  • dviwindo - writes \special commands to be used for Y&Y's Windows previewer. It interprets them as jumps within the previewer
  • vtex - writes \special commands, which are interpreted as hypertext jumps for MicroPress'HTML and PDF producing TeX variants

Using PDFTeXEdit

PDFTex is a variant of Tex that produces directly a PDF output. Usually a Latex or Tex system produces a DVI output. PDFTex can also produce DVI output.

You may use pdfTex instead of LaTex using macro packages as context or hyperref or others to write the actual document.

"When producing DVI output, for which one can use pdfTex as well as any other Tex, part of the job is delegated to the DVI postprocessor, either by directly providing this program with commands, or by means of \specials. Because pdfTex directly produces the final format, it has to do everything itself, from handling color, graphics, hyperlink support, font-inclusion, up to page imposition and page manipulation. As a direct result, when on uses a high level macro package, the macros that take care of these features have to be set up properly.

Currently all mainstream macro packages offer pdfTex support in on way or the other. When using such a package, it makes sense to turn on this support in the appropriate way, otherwise one cannot be sure if things are set up right." (from the pdfTex User manual at http://www.tug.org/applications/pdftex/pdftexman.pdf).

The following main macro packages support pdfTex: for LaTeX users the hyperref package by Sebastian Rahtz the standard LaTeX graphics and color packages have pdfTex options the ConTeXt macro package by Hans Hagen has extended support for pdfTex

Literature and Sources: http://www.tug.org/applications/pdftex/ Michael Goosens; Sebastian Rahtz: The LaTeX Web Companion, Addison-Wesley, 1999: ISBN: 0-201- 43311-7


Next Section: Preparing for conversion to SGML/XML