pdflatex
This page contains a simple recipe to create PDF from your latex
sources using pdflatex without doing much effort and in such a way that you
still can compile your file using latex. It is assumed that you have a LinuX
like OS, unless otherwise stated. Everything works best with Acrobat Reader.
latex file compiles the file.tex to file.dvi. Correspondingly
pdflatex file
generates file.pdf. Note that the file extension tex is not
required. In its simplest form, pdflatex does not require any source
code modification. However you also do not get bookmarks or other pdf
features (see bookmarks). Furthermore, if
you include encapsulated postscript or if you include postscript specific
usepackages like pstricks, pdflatex may fail, since postscript
cannot be included directly (see graphics).
The latex package hyperref
automatically creates
bookpdflatexmarks corresponding to your sections. Using this package also
creates hyperlinks following your \cite
and \ref
references. Include this package as the last used package in the document
preamble:
\usepackage{hyperref}
The default coloring and surrounding of hyperlinks
(e.g. a light green box around http links) can be changed.
Example:
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
Here is more
hyperref documentation.
You can set the information fields in the generated PDF file
\pdfinfo{
/Title (Why the system crashed)
/Author (me)
/Keywords (XML Java OOA/OOD Corba COM)
}
This info shows up in page information, this is a field specific for acrobat reader.
Other hyperref commands are the following:
\href{http://www.math.rug.nl/~jacob}{Homepage}
|
creates a http link. |
\href{file:target#page.1}{target.pdf on page
1} |
link to the file target.pdf and is opened at page 1. |
\href{file:target#TestTarget}{target.pdf at anchor
TestTarget} |
same as previous but now opens at anchor TestTarget. This anchor should be
put into target.tex at a desired location: \hypertarget{TestTarget}{hi} |
\href{run:app}{run application app} |
starts application app |
\texorpdfstring{\pi-calucus}{pi-calculus}
|
in pdf bookmarks (generated for sections) we cannot
use tex-symbols. This command produces the pi-symbol in the tex-article,
as well in the bookmark |
Pdflatex cannot include encapsulated postscript directly. But
you can use a Perl utility to convert the encapsulated postscript to PDF:
epstopdf file.eps
reads in file.eps and writes the content of it to file.pdf. It is convenient to put the following in your .bashrc file:
eps2pdf ()
{
for arg;
do
echo "$arg => ${arg/eps/pdf}";
epstopdf $arg;
done
}
since now multiple files can be used. For instance,
eps2pdf *.eps
converts all eps-files in the current directory into pdf.
New: Heiko Oberdiek has written a nice style-file epstopdf.sty so that
this al happens automatically! It works with both graphics and graphicx
package. What is required:
The command epstopdf
should be available
Use 'pdflatex -shell-escape' file to complile your file
Use \usepackage[pdftex]{graphics}
(or
graphicx
)
Use \usepackage{epstopdf}
Make sure that the style file epstopdf is on the LaTeX search path: for LinuX,
create an environment variable TEXINPUTS
as follows. Put the
following line in your .bashrc file:
TEXINPUTS=.:PATH_TO_YOUR_STYLE_FILES//:
The '//' at the end makes LaTeX to recurse into all the subdirectories. Note
the colon at the end! For win32 machines, an executable epstopdf.exe
is available. This
requires ghostscript to be installed on your system. See http://www.agh.edu.pl/pub/tex/support/epstopdf/
for more information.
Do not include the file extension of the figures:
\includegraphics{figure}
is sufficient; both LaTeX and latex2html automatically search for figure.eps
while pdlatex searches for figure.pdf.
With pdflatex, other graphics types can be used, but that you have to
declare. Put the following just after \documentclass
in your
source file:
\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi
\newcommand{\pdfgraphics}{\ifpdf\DeclareGraphicsExtensions{.pdf,.jpg}\fi}
Now pdflatex also searches for jpg files if you use \pdfgraphics
command right after \begin{document}
. According to the
manual it is also possible to include tif, gif and png images
as well, but I don't no how. Simply extending the
\DeclareGrphicsExtentions
does not work. It is also convenient to put the \pdfinfo
command into this:
\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi
\newcommand{\pdfgraphics}{\ifpdf\DeclareGraphicsExtensions{.pdf,.jpg}\fi}
\ifpdf\pdfinfo{/Title (Why the system crashed)
/Author (me)
/Keywords (XML Java OOA/OOD Corba COM)\fi
Now the file compiles with either LaTeX or pdflatex.
Do not use PostScript specific command like psfrag
and
pstrics
to generate your figure. They are not portable! If you
want to use mathematical expressions in your figure, I advise you to use
xfig
and choose Combined PS/LaTeX (both parts)
to
export your figure. It generates file.pstex and
file.pstex_t. Just use LaTeX mathematical expressions in xfig and don't
forget to set special flag for the text. Then the LaTeX mathematical
expressions go into file.pstex_t and the others are saved into
file.pstex, which you need to rename to file.eps. You can convert
this file.eps file into PDF file using epstopdf. You also need to
delete the file extension .pstex in \includegraphics
command in the top of file.pstex_t file. In your LaTeX file you use
\input{file.pstex_t}
instead of
\includegraphics{file.pstex_t}
to include a figure.
For more information about xfig
, please refer to the help menu in xfig.
All Figures in a separate folder |
If you want to keep all your graphics in a separate folder, use
\graphicspath{{mygraphics/}}
instead of including all graphics giving an absolute path.
List of figures seems broken with pdflatex and hyperref.
I try to find a solution. ;-) |
Solution found on page :
http://www.tug.org/pipermail/pdftex/1999-August/005357.html
=> Delete all .aux .toc .lof .lot files and compile again.
Then you should get correct .lof, (.toc, ...) files.
Making slides with pdflatex is not hard. A lot of thinks works with both latex
and pdflatex. A very simple example:
\documentclass{seminar}
\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi
\usepackage{slidesec,fancybox}
\usepackage{RuG2e}
\usepackage[pdfmode=None,colorlinks]{hyperref}%pdfpagemode=None no left
%navigation bar
\ifpdf\pdfcatalog{/PageMode /FullScreen}%start directly maximized and
\fi %in Full screen mode
\slideframe{Oval}
\begin{document}
\begin{slide}
\textcolor{blue}{\wapen}
\textcolor{red}{hi, colors are also available. This only works if the
optional argument colorlinks of hyperref is invoked}
textcolor{blue}{\balk}
\end{slide}
\end{document}
Of course you can include more pdf stuff. It is possible to create
'powerpoint'-like slides with the use of ppower4, including dynamical effects.
A very nice package that does not require any postprocessing as ppower4 does is
texpower. Check
out the following example or code. The total example is
available in zip-format. For IWInet users, a total package called IWIpress is
available, inluding a manual and RuG-logo's.
Summarizing the above comes down to the following:
\documentclass[a4wide]{article}
%%Create new if environment
\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi
%%
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
\ifpdf\pdfinfo{/Title (Why the system crashed)
/Author (me)
/Keywords (XML Java OOA/OOD Corba COM)
}
\usepackage[pdftex]{graphics}
\usepackage{epstopdf}
\else\usepackage{graphics}\fi
\begin{document}
\begin{figure}
\incudegraphics{picture}
\end{figure}
\end{document}
and then compile with either 'latex' or 'pdflatex -shell-escape'.
A very nice editor is available for the K-desktop environment running under
Linux:
ktexmaker2. A lot of things are all intergrated in one simple
editor. Integrated is for example:
compile with latex or pdflatex via a button or from a menu.
dvips
ps2pdf
latex2html
bibtex
idx
Very usefull is for instance that errors can be dealt with one at the time by
choosing 'next latex error' and clicking on the linenumber displayed is
sufficient to jump to that line in the file. You do not have to search
for the error in the tex-file. The cycle compile latex->preview dvi->...
works best. If the file is compiled with pdflatex and previewed with
e.g. acroread, to see the changes made the file must be reopened. It is also
possible to:
select vertical or horizontal textblocks ('toggle vertical/horizontal
selection' in menu 'edit')
use multiple files for one document
make very easily a bib file.
view the structure of your file, displayed in a left sidebar. It shows for
instance sections and used labels. This is usefull for navigation. What is
showed in this side bar can be altered.
use wizards for inserting tables and arrays of appropriate dimension
the menu's 'latex', 'math','greek' and 'wizard' gives the possibility to
insert various latex commands without typing a single character
inserting the brackets for an array environment, e.g. a matrix
(un)comment a whole selected block
ordinary editor things like copy,cut and paste, check spelling (in most
Linux applications selecting is already copying it and paste is pressing middle
mouse button)
And a whole lot more is possible. For MS Windows systems, a very popular editor
is winedit. It is much
older then
ktexmaker2 and is even more
advanced. For instance it is even possible to create your own menus, enlarge
existing menus (create your own latex environment and put it into some
menu).
PDFLaTeX page of
TeX User's Group web site.
Local latex information
List of
available packages on CTAN
ktexmaker2 page
WinEdit page
All
LaTeX-commands
Examples:
A
simple example.
An
advanced example.
The following explains the map files:
http://gemini.iti.informatik.tu-darmstadt.de/~kehr/doc/TeX2PDF/TeX2PDF.html