Latex 2 PDF
Latex 2 PDF
Ki-Joo Kim∗
Version 0.1
April 4, 2003
Abstract
This document describes how to create high quality PDF from LATEX sources and provides some valuable tips.
Contents
1 Introduction 1
1.1 General Intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Font Issues for Best PDF Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
5 hyperref Package 5
5.1 General Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 Bookmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.1 Bookmark Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2 How to Add Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.2.3 Math Titles: • a2 + b2 = c2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.3 WWW Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.4 Internal Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
∗ mailto:kim_dot_ki-joo_at_epa_dot_gov
1. Introduction 2
7 Useful Links 10
8 Note 10
1 Introduction
1.1 General Intro
You can create a postscript file and convert it to PDF using
You can also add PDF information, WWW links, internal links, cross-references, bookmarks, and more using the
famous hyperref package that is described in Section 5.
Since PDF is already compressed, do not try to zip PDF.
mathptmx and mathpazo replace times and palatino packages, respectively. Since Helvetica and Avant Garde
are slightly bigger than the Times and Palatino, you may also load \usepackage[scaled=0.92]{helvet} after
mathptmx or mathpazo packages. These packages, parts of PSNFSS collection, are already included in your LATEX
system.
4. pdfLATEX: From LATEX to PDF 3
Alternatively you can use txfonts for Times text and math or pxfonts for Palatino text and math. Math symbols
in these packages are more comprehensive than the equivalent PSNFSS collections. If you choose full installation of
MiKTEX 2.2, you are ready to use these beautiful fonts.
\documentclass[dvips]{article}
\usepackage[dvips]{graphics,color}
\usepackage[dvips,colorlinks]{hyperref}
\documentclass[dvipdfm]{article}
\usepackage[dvips]{graphicx,color}
\usepackage[dvipdfm,colorlinks]{hyperref}
and then type latex file.tex (may be several times) and then dvipdfm file.dvi. One of the advantages of
dvipdfm is to internally handle EPS files, so you do not need to convert them to PDF figure files as in pdfLATEX.
\documentclass[pdftex]{article}
\usepackage[dvips]{graphicx,color}
\usepackage[pdftex,colorlinks]{hyperref}
and then type pdflatex file.tex (may be several times) to produce file.pdf.
• Use epstopdf package to convert EPS docs to PDF docs on demand. It needs to be loaded after \usepackage[pdftex]{graphi
• Use the epstopdf program manually to convert the EPS figures to PDF figures. Ensure that you don’t mention
the filename’s suffix in the \includegraphics commands. Add pdftex to the options in the document class
line when you run pdflatex, remove it when you run latex, or
• Use the unpsfrag command (available from http://www.gts.tsc.uvigo.es/˜fiz/unpsfrag) to convert
a LATEX document that uses the psfrag into one that doesn’t, thus letting you use pdflatex.
Figure 1 is a PDF figure converted from EPS using the epstopdf program. There is no need to calculate bounding
box information using ebb.exe.
\special{! [ /Author ()
/Title ()
/Keywords ()
/DOCINFO pdfmark}
to store the author, title, and keywords in the PDF file automatically (Note that the pdfmark command is understood
only by Adobe distiller). If you are using pdfLATEX, you can also include this information into the produced PDF file
by adding:
A better approach under LATEX is to use the hyperref package. See Section 5.
To see the content click the right mouse button on this figure. You can also move this text icon using your mouse.
You can also play sound and movie files in your PDF (You need Apple Quick Time Movie Player). See the
following example:
\leftline{%
\pdfannot width 4in height 0in depth 3in {%
/Subtype /Movie
5. hyperref Package 6
To include AVI files you can use the following command in the preamble:
\newcommand{\video}[5]{%
\vspace{#3}\hspace{#2}{\pdfannot width #4 height #5 depth 0cm {%
/Subtype /Movie /C [1 0 0] /Border [0 0 3] /Movie
<> }}}
and \video{g.avi}{4cm}{12cm}{12cm}{12cm} where the first argument is the name of the file, and the 2nd and
3rd control the location of one corner, and 4th and 5th the width and height of the box. You can control the color of
the frame and thickness by modifying /Border.
5 hyperref Package
By using the hyperref package with dvipdfm or pdflatex, you automatically get PDF files with bookmarks (if you
have a table of contents) and cross-references etc.
There is a golden rule that the hyperref package should be loaded as the last package, except when using sidewaysfigures.
Some additional options are:
• colorlinks=true: Colors the text of links and anchors. The colors chosen depend on the type of link. At present
the only types of link distinguished are citations, page references, URLs, local file references, and other links
(default=false).
• linkcolor=red: Color for normal internal links.
• anchorcolor=black: Color for anchor text.
• citecolor=green: Color for bibliographical citations in text.
• filecolor=magenta: Color for URLs which open local files.
• menucolor=red: Color for Acrobat menu items.
• pagecolor=red: Color for links to other pages
• urlcolor=cyan: Color for linked URLs.
• pdfstartview={FitB}: Set the startup page view.
– FitH : Fit whole width of page
– FitV : Fit whole height of page
– FitB : Fit whole ”Bounding Box” page
– FitBH: Fit whole width of ”Bounding Box” of page
– FitBV: Fit whole height of ”Bounding Box” of page
• pdfpagescrop={53 486 389 754}: Tells hyperref to leave cropping commands in the DVI and PDF. By cropping
you can significantly increase screen display size of PDF.
5.2 Bookmark
5.2.1 Bookmark Options
The following options (with using \hypersetup) affect bookmarks:
• bookmarks: Make bookmarks (Default: true). This option cannot be used after package has been loaded.
• bookmarksnumbered: Put section numbers in bookmarks (Default: false).
• bookmarksopen=true: Open up the bookmark tree (Default: false).
• bookmarksopenlevel: Level to which bookmarks are open (Default: \maxdimen).
• bookmarkstype: To specify which toc file to mimic (Default: toc).
• pdfpagemode: How document starts when opened (Default: None):
– None: Neither bookmarks nor thumbnails are visible.
– UseOutlines: Bookmarks are visible.
– UseThumbs: Thumbnails are visible.
– FullScreen: Full-screen mode without bars, outlines, and thumbnails.
• unicode: Creating Unicode bookmarks (Default: false). After package has been loaded, it switches between
Unicode and PDFDocEncoding.
When creating bookmarks hyperref writes them into the file filename.out. At the second run the bookmarks
are set.
where level is 0 for chapter, 1 for section, 2 for subsection, and so on. Of course, -1 is for part.
\subsubsection{Math Titles: %
\texorpdfstring{$\bullet\ aˆ2+bˆ2=cˆ2$}%
{\textbullet\ a\texttwosuperior\ + b\texttwosuperior\ = c\texttwosuperior}%
}
A complete listing of these text commands can be obtained by LATEXing the hyperref.dtx.
\url{http://www.ctan.org/}
\url{ftp://ftp.gnu.org/}
\url{mailto:[email protected]}
A more sophisticated way of www links provides the command \href{URL}{text} where URL is the address and
text is the text displayed in the document. For example, The MikTEX site. To include the graphics with a hypertext
link, use\href{URL}{fig filename}.
The www links in PDF will be in a cyan-colored box (default), but will be changed to magenta texts when the
colorlinks option is loaded as in this document.
\renewenvironment{thebibliography}[1]{%
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\chapter*{\bibname
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode‘\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty ‘thebibliography’ environment}}%
\endlist}
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\providecommand*{\phantomsection}{}
than you do not get an error message when disabling the use of hyperref.
\usepackage{pdfpages}
...
\includepdf[pages={1-10}, nup=2, scale=1.0]{imsi.pdf}
Pages of 1-10 of imsi.pdf is inserted as 2 ups into the current position. But remember that the pdfpages package
only works with pdfLATEX.
<a href="http://www.adobe.com/prodindex/acrobat/readstep.html"
target="_blank"><img src="http://www.adobe.com/images/getacro.gif"
width=88 height=31 border=0 alt="ACROBAT READER"></a>
\usepackage[pdfstartview={}]{hyperref}
\pdfcatalog{}
openaction
user {<< /S /JavaScript /JS \ExpWarnObj\space 0 R >>}
\begin{document}
test\newpage page 2
\end{document}
8. Note 11
\documentclass{article}
\usepackage[pdftex]{hyperref}
\usepackage[pdftex]{insdljs}
\begin{document}
\begin{Form} % needed for \PushButton
\section{Test of the \texttt{insDLJS} Package}
% use built in form button of hyperref
Push \PushButton[name=myButton, onclick={HelloWorld();}]{Button}
\end{Form}
\end{document}
7 Useful Links
• Effective Scientific Electronic Publishing (http://www.cl.cam.ac.uk/˜mgk25/publ-tips.html).
• Producing HTML and PDF files with LATEX (http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/
makingWWWdocs.html).
• Using LATEXto Create Quality PDF Documents over the World Wide Web (http://www.math.uakron.edu/
˜dpstory/latx2pdf.html).
• AcroTeX (by D.P.Story) (http://www.math.uakron.edu/˜dpstory/acrotex.html).
8 Note
If you find any errors or have suggestions, please let me know. My personal web page is http://www.geocities.
com/kijoo2000.