Penguin
Note: You are viewing an old revision of this page. View the current version.

These are some hints to make your use of pdflatex(1) more productive...

Version

As you may be aware, the version numbers for Τεχ are converging towards Pi, and pdflatex does the same. Although it may not look like much, there is quite a bit of difference between pdflatex version "3.14159-13d (Web2C 7.3.1)" (the "old stable" version) and version "Version 3.14159-1.10b (Web2C 7.4.5)" (the more recent version). This fixes a number of bugs. I copied a binary of the newer version from Debian Woody onto a Slackware 8 box, and the binary worked, but I needed to use the newer pdflatex.fmt file as well (you can merely copy this into your document directory).

Using the graphicx Package

graphicx can take an option specifying pdftex or dvips, depending on which you are planning on using. You can use a conditional macro to include the right option depending on which processor is being used. Put this in the header of the main .tex file:

\ifx\pdfoutput\undefined
\usepackage[dvips]{graphicx}
\else
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
\fi

pdflatex can import images in PNG, TIF, PDF, GIF, or JPG image formats, but not PS. Now, by default, normal latex uses .ps or .eps for including images. However, you can get your images to work with both latex and pdflatex with little modification to your .tex source files.

1. (This assumes you already have .ps or .eps figures for use with latex). Use the ps2pdf(1) command (which is part of the gs-common package in Debian) to convert each .ps or .eps image into a .pdf image
$ for f in .{ps,eps} ; do ps2pdf $f ${f%.}.pdf ; done

2. Include the following little snippet after your \begin{document}:

% if using pdflatex, we must use our .pdf images instead of .(e?)ps
\ifx\pdfoutput\undefined
\else
\DeclareGraphicsExtensions{.pdf,.gif,.jpg} % the formats we have images in
\fi

(there's probably a better way to do that, but this works :p)

Now, if you do

\includegraphics[width=\textwidth]{figure}

then latex will look for "figure.ps" or "figure.eps", and pdflatex will look for "figure.pdf", "figure.gif", or "figure.jpg". If you have one of each list then both latex and pdflatex will work with the same input file.

Using pdflatex to make slides

You can make slides by using the seminar package:

\documentclass[a4, landscape]{seminar}

However, pdftex and seminar don't play nicely together (your text appears in only a quarter of the page), so there is a little trick you can do to force the correct page dimensions. In the header of your file, try the following (this example is in combination with the above hints):

\ifx\pdfoutput\undefined
\usepackage[dvips]{graphicx}
\else
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
%%%%%%%%
% to fix problems making landscape seminar pdfs
% Letter...
%\pdfpagewidth=11truein
%\pdfpageheight=8.5truein
% A4
\pdfpagewidth=297truemm % your milage may vary....
\pdfpageheight=210truemm
\pdfhorigin=1truein     % default value(?), but doesn't work without
\pdfvorigin=1truein     % default value(?), but doesn't work without
\fi

PDF metadata

Inside a block that is only read for pdflatex (and not normal latex), you can put a block to set the metadata inside the PDF file:

\pdfinfo
{ /Title (My Masterpiece)
  /Creator (YourName)
  /CreationDate (D:YYYYMMDDhhmmss) % this is the format used by pdf for date/time
  /Subject (...)
  /Keywords (...)
}

epstopdf package and command

There is an epstopdf command to convert eps images to pdf for use with pdflatex. Threre is also an epstopdf package which will automate this for you.

\usepackage{graphicx}
\usepackage{epstopdf}

See http://www.tug.org/pipermail/latex2html/2001-March/001062.html