Pdftex
Using TeX to Create pdf Files=
To generate pdf files from TeX, use the package pdftex. Documentation can be found in one of the directories
/local/sol/9/depot/texlive-2007/doc/pdftex/manual /local/depot/4/texlive-2007/doc/pdftex/manual
(depending on whether you are using a Solaris or Linux system, respectively).
For most latex, amstex, or tex files, you can produce a pdf file just by prepending pdf to the name of the command; e.g.,
pdflatex filename | |
or | pdfamstex filename |
or | pdftex filename |
you can then open the new file inside Adobe Acrobat Reader with the command:
acroread filename.pdf
If for any reason pdflatex fails to work (e.g., it complains about some font that you are using, or it cannot include a PostScript figure), there are alternative ways of creating pdf files:
latex filename dvipdmx filename
or
latex filename dvips -Pwww -o filename.ps filename ps2pdf filename.ps filename.pdf
There is a way to include encapsulated PostScript (eps) files when using pdflatex: you must convert them to pdf first:
epstopdf file.eps
Other image formats are also supported.
One other way to convert postscript files to pdf is to use ImageMagick's convert command:
convert file.ps file.pdf
Graphics Files and pdftex
Usually, pdftex will accept any input that tex will (and likewise for pdflatex and latex), but an exception is the handling of graphics files. Pdftex will only accept graphics files in pdf, jpeg, png, and mps (Metapost) formats. Graphics in other formats need to be converted to an acceptable format.
For example, if a LaTeX file pdftest.tex referred to a file pdftestfig.eps in Encapsulated PostScript format, you could create a dvi file in the normal way:
latex pdftest
but to create a pdf file requires an extra step to convert the eps file to pdf format:
epstopdf pdftestfig.eps pdflatex pdftest
The epstopdf command only needs to be executed once (per figure) initially, plus once every time the figure changes.
Having latex refer to one type of file and pdflatex refer to a different file type requires a little trickery within the tex file. This can be handled as in the following test file.
\documentclass{article} \usepackage{ifpdf} \ifpdf \usepackage[pdftex]{graphicx} \DeclareGraphicsExtensions{.pdf} \pdfcompresslevel=9 \else \usepackage{graphicx} \fi \begin{document} This is a test document. \includegraphics{pdftestfig} % Note the lack of an extension here End of test. \end{document}
metapost output is accepted by both (la)tex and pdf(la)tex. Unfortunately, if it contains text, it is not accepted by xdvi. See latex sample metapost and tex sample metapost for examples.
NSF FastLane
The NSF FastLane system now accepts files in many formats, including pdf, PostScript, and dvi. For best results, though, use pdftex or pdflatex to produce a pdf file.