next up previous contents index
Next: Creating Presentations Up: Problems with Bookmarks Previous: Problems with Bookmarks   Contents   Index


Source Compatibility Between LATEX and pdfLATEX

Ideally your document would compile equally well with LATEX and pdfLATEX. The main problem in this respect is the inclusion of graphics. The simple solution is to systematically drop the file extension from includegraphics commands. They will then automatically look for a file of a suitable format in the current directory. All you have to do is create appropriate versions of the graphics files. LATEX will look for .eps, and pdfLATEX will try to include a file with the extension .png, .pdf, .jpg or .mps (in that order).

For the cases where you want to use different code for the PDF version of your document, you can simply add the package ifpdf5.8 to your preamble. Chances are that you already have it installed; if not then you're probably using MiKTEX which will install it for you automatically the first time you try to use it. This package defines the special command ifpdf that will allow you to write conditional code easily. In this example, we want the PostScript version to be black and white due to the printing costs but we want the PDF version for online viewing to be colourful.

In the example above I have included the hyperref package even in the non-PDF version. The effect of this is to make the href command work in all cases, which saves me from wrapping every occurrence into a conditional statement.

Note that in recent TEX distributions (TEXLive for example), the normal TEX program is actually pdfTEX it will automatically switch between producing pdf and dvi according to the settings in the document class. If you use the code above then you can still use the pdflatex command to get pdf output and latex for normal dvi output.


next up previous contents index
Next: Creating Presentations Up: Problems with Bookmarks Previous: Problems with Bookmarks   Contents   Index
David Barreda Tena 2007-09-12



Alojamiento con 500GB de espacio y 5000GB de ancho de banda por 4 euros al mes
Cómo contratar servicios de hosting con Dreamhost
Descuento, promocode para dreamhost de $50