How to Create pdf Files Using LATEX and pdfLATEX - Tulane-Math

How to Create pdf Files Using LATEX and pdfLATEX - Tulane-Math
How to Create pdf Files Using
LATEX and pdfLATEX
Michael Mislove
Department of Mathematics
Tulane University
New Orleans, LA 70118
USA
Email: mislove@tulane.edu
Abstract
This is a short set of instructions on what is needed to create PostScript and pdf files
that support active hyperlinks from LATEX source files. I describe how to obtain and
use some simple utilities that are available for use with normal LATEX2, and also
how to build a copy of pdfLATEX for UNIX installations. The main purpose of these
instructions is explain how to acquire and install the software needed to create files
for publication in the electronic series Electronic Notes in Theoretical Computer
Science, which is published on the web at the URL http://www.elsevier.nl/locate/entcs.
1
Introduction
This short note provides instructions on how to obtain and install the software that is needed for creating PostScript and pdf files that include active
hyperlinks which viewed using Ghostview or GSview for PostScript files, and
c
Adobe’s Acrobat
or another pdf viewer, such as xpdf for viewing pdf files.
The instructions detail which versions of the necessary utilities are needed to
make everything work smoothly. We outline these in terms of the system on
which the LATEX implementation is running – either Windows or some flavor of
UNIX, such as Linux. We do not have detailed instructions about Macintosh
implementations, but we believe they would not be much different from the
UNIX instructions, especially as the MacOS gravitates more and more toward
UNIX.
2
What’s this all about?
With the advent of the World Wide Web, hyperlinks – embedded links to
other material on the web – have become a standard way of referencing ma-
Mislove
terial available on the web. Anyone who uses the web is accustomed to these
links which allow the user to click on an item to follow a link to some reference
material, bring up an email program with an addressee’s address pre-encoded,
or that have similar effects. 1 One area where this technology is being used
more and more is in electronic publishing, and as scientific journals lean more
and more toward electronic dissemination, we can expect this trend to grow.
One example is the area of electronic publications which are available exclusively on the web. And, as authors do more and more of the work of preparing
papers for publication in such series using computer typesetting programs such
as LATEX, it is important to keep installations of the requisite programs as upto-date as possible, to take advantage of new advances in this technology. In
this short article, I outline what is needed to implement hyperlinks that allow
smooth transitions within a document when it is viewed online, as well as to
link your document to other material on the web. My comments are confined
to how to do this using LATEX as the computer typesetting package. Word proc
c
cessing packages such as Microsoft Word
or Sun’s StarOffice
have similar
features that can be utilized for this purpose.
3
What’s Needed?
3.1
The Basics
The basic programs that are needed to create PostScript files and pdf files
from LATEX that support active hyperlinks when viewed online are:
•
•
a recent version of LATEX2 (1999 or later), including
a recent version of the hyperref package. This must be at least version
6.69d, which was issued in March, 2000,
•
the public versions of Adobe’s Type1 fonts. These are scalable fonts which
ensure good images when translated into a pdf file and viewed on screen.
Recent distributions of the TEX package include these fonts – you can see
if there is a Type1 subdirectory among your font file directory for TEX.
•
a recent version of dvips which includes the “-z” and the “-P pdf” options
(any recent version of LATEX2 will include this).
These utilities are all that is needed to prepare a dvi file and a PostScript file
that support active hyperlinks. In particular, the hyperref package automatically makes cross-references within a document prepared with LATEX active
when viewed with an appropriate viewer, and it also is easy to encode hyperlinks to other material on the web so that they become active as well. Take a
look at the hyperref documentation that comes with the package to see how
to do this.
1
My email address mislove@tulane.edu is encoded in this way – clicking on it will allow
you to send me an email automagically.
2
Mislove
3.2
Creating The Files
Creating the dvi file
To create a dvi file that has hyperlinks embedded, you can use LATEX2
and be sure to include the command \usepackage{hyperref}. As the hyperref documentation says, you should load this package last in order to give
hyperref the best chance of succeeding. There is ample documentation in the
package to indicate how to properly markup hyperlinks. Actually, internal
cross-references and footnotes, etc. are automagically active when compiled
with hyperref, so it’s only the hyperlinks to external documents that require
special commands. Running LATEX or pdfLATEX on the source file will produce
a dvi file that has the hyperlinks active.
Creating a PostScript file
To create a PostScript file that has active hyperlinks embedded in it, just
invoke dvips with the “-z” option to create a ps file, as in
dvips -z paper.dvi -o paper.ps
This will create a file paper.ps with active hyperlinks from the file paper.dvi.
Creating pdf Files
Creating a pdf file with active hyperlinks from the file paper.dvi requires
two commands: The first is
dvips -z -P pdf paper.dvi -o paper.ps
This creates a PostScript file that has fonts especially good for translation to
a pdf file. 2 To create that file, you can use the program ps2pdf, as in
ps2pdf paper.ps
and the result will be a pdf file with active hyperlinks.
You also can use utilities that translate directly from dvi to pdf files. One
such is dvipdfm, which is available on the web at http://gaspra.kettering.
edu/dvipdfm/. There is an rpm file containing the precompiled binary for
Linux systems, and this utility is already included in the MiKTEX package for
Windows. But note that dvipdfm will not translate PostScript into pdf, so if
your dvi has embedded PostScript or calls EPS files, then you will either have
to use dvips followed by ps2pdf as described above, or else pdfLATEX, which
we next describe.
pdfLATEX
A last way to create pdf files directly from LATEX source files is to use the
program pdfLATEX. This has the advantage of using the correct Type1 fonts for
on screen viewing, as well as creating bookmarks throughout the document
for each section. On the other hand, pdfLATEX requires extra work if you
2
While this PostScript file can be viewed with any PostScript viewer, the output on the
screen is not as good as using the command dvips -z.
3
Mislove
want to include EPS graphics files in your document. A fuller description of
this is included in the exampdf.tex file that accompanies the ENTCS generic
package.
3.3
Viewing the Files
To view the files you have created that have active hyperlinks, you also need
•
for dvi files, a recent dvi viewer that supports active hyperlinks,
•
for PostScript files, a recent version of Ghostscript and a viewer, which
either is Ghostview or GSview.
•
c
for pdf files, either Adobe’s Acrobat
Reader or another pdf viewer, such
as xpdf. GSview and some other PostScript viewers also have the capability
of viewing pdf files, but their current implementation of hyperlinks is not
as well-developed as pdf viewers.
4
How to get and install the needed files
4.1
Windows
With Windows, installation is a snap – most programs include an automagic
installation procedure, and MiKTEX and related software are no exception.
The Basics
If you are using Windows as your operating system, then an excellent LATEX
package that contains all these components is MiKTEX, which is available
from the nearest CTAN site. The basic CTAN site is http://www.ctan.org.
This package is updated regularly, and it also contains the other components
mentioned below that are needed to prepare pdf files with active hyperlinks.
c is one that supports active hyperlinks.
The dvi viewer Yap
Viewers
Ghostview and GSview are available at the Ghostscript home page http://
www.cs.wisc.edu/˜ghost
c
For pdf files, you can obtain Adobe’s Acrobat
Reader from Adobe at
http://www.adobe.com/readstep.html.
Editors
Using LATEX really requires having an editor that understands LATEX and
that supports easy use of its features, and built-in calls to other programs for
viewing files, etc. For Windows, one such program is WinEdt, which can be
found at http://www.winedt.com. The program is shareware, which in the
Windows world means you can use it free for a limited time, and then you
have to purchase a license to avoid an annoying and increasingly more frequent
4
Mislove
reminder that you haven’t registered the product (and bought a license). It’s
worth checking out if you haven’t tried it.
4.2
UNIX
For UNIX installations, unfortunately the most popular TEX package – teTEX
– is not routinely updated, and so you may have to do some work to obtain
the needed utilities. If your current installation has a recent version of LATEX
– one from 1999 or later, then you already should be able to create dvi files
and PostScript files that have active hyperlinks. If you need to update your
installation, the best place to start searching for a newer version of teTEX
is package is CTAN, http://www.tug.org/teTEX. TEX is a large package for
UNIX systems, and the installation is straightforward, although not entirely
without pitfalls. If you aren’t accustomed to compiling and installing software
from scratch on your system, it’s probably best that you contact your system
administrator and ask her or him to update the installation for you.
Even if you have the most recent version of teTEX (as of this writing,
the more recent stable version is 1.0.7), you may have to update both LATEX
and certainly pdfLATEX. LATEX was undergoing a semiannual update, but
has recently switched to an annual update. For information about the latest
release, look at http://www.latex-project.org.
pdfLATEX
For pdfLATEX, the source and binary distributions are available on the ftp
site of the developer, Han The Than, ftp://ftp.muni.cz/pub/tex/local/cstug/
thanh/pdftex/. There are precompiled binaries for some systems available on
the site, and if there is one for your system, then you can simply download
the .zip file, unpack it using unzip, and then consult the instruction manual
pdftex-*.pdf, which includes instructions on where to place the binaries
and how to build the format file for pdfLATEX (this is not included in the
precompiled version; see the instructions below for building your own version
of pdfLATEX ix ).
If there is no precompiled binary for your system, than you will need to
compile the updated version for your own UNIX system, and then install the
resulting binaries and associated files. Unfortunately, the instructions on the
site assume some familiarity with the process, and so some instructions are
not included. Here is a complete list of how to update your current version of
pdfLATEX:
(i) Download the latest version of the pdftex source from the site. Everything
that’s needed for this is contained in the file named pdftex-nnnnn.tgz.
(ii) Unpack the file in some working directory using the command tar xzvf
pdftex-nnnnn.tgz.
(iii) Move to the resulting src directory and run ./configure --datadir=
5
Mislove
/where/your/texmf/directory/is/located, where the directory does
not include texmf, but only the path that leads to it. For example, on
Redhat Linux, the directory is /usr/share.
(iv) Move to the directory texk/web2c and run the command make pdftexbin.
(v) Backup the existing versions of pdfetex and pdftex on your system.
You’ll need to locate these using whereis or which – on Redhat Linux,
they’re in /usr/bin.
(vi) When make is complete, move the files pdfetex and pdftex to the directory where TEX binaries are located.
(vii) Backup the existing pdfetex.fmt, pdfetex.pool, pdflatex.fmt, pdftex.fmt and pdftex.pool files. These are located in the /texmf/web2c
subdirectory of the directory you gave as --datadir in step (ii) above.
(viii) Move the new pdfetex.fmt, pdfetex.pool, pdftex.fmt and pdftex.
pool files to the /texmf/web2c subdirectory of --datadir directory.
(ix) Create a new pdfLATEX for your system from the new pdftex by using
the command pdftex -ini -fmt=pdflatex latex.ltx.
(x) Move pdflatex.fmt to the /texmf/web2c subdirectory of the directory
you gave as --datadir in step (ii) above.
(xi) Test your new installation.
Viewers
Ghostscript and various associated PostScript viewers are available for
UNIX systems from the site http:// www.cs.wisc.edu/˜ghost. Unfortunately,
even the most recent versions don’t yet support hyperlinks completely. For
example, I have just installed the most recent version of Ghostscript and of
GSview on my Linux workstation – version 7.00 of the former and version 4.00
of the latter – and yet neither my version of Xdvi nor this version of GSview
react properly when I click on hyperlinks. The former crashes (gracefully?),
and the latter simply brings up a dialog box that says the link is “unknown”.
But I suspect these problems will soon be overcome, and I will be able to
access hyperlinks embedded in the dvi and PostScript files I create.
c
For pdf files, you can obtain Adobe’s Acrobat
Reader from Adobe at
http://www.adobe.com/readstep.html.
6
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising