TeX Frequently Asked Questions

Why do my PostScript graphics, which appear fine in my LaTeX documents, disappear when I process the document through pdfLaTeX?

The tools pdfTeX and pdfLaTeX cannot handle PS graphics, but can handle PNG graphics and PDF graphics. You can convert your PS and EPS files to PDF as follows:

ps2pdf myimage.ps myimage.pdf
or
ps2pdf myimage.eps myimage.pdf
But you may discover you get better results (fewer bounding box issues) if you convert your PS files to PNG, although this has the drawback that you are going from a vector format to a bitmap format (however, your original PS file may already contain merely bitmap graphics, even though PS itself can handle more than just that).
ps2img -aaliastext -antialias myimage.ps
ps2img -aaliastext -antialias myimage.eps
Hint: If you are using LaTeX and want your TeX files to work both in LaTeX and in pdfLaTeX, leave the extension off in the \includegraphics command. In other words, instead of
\includegraphics{myimage.ps}
simply put
\includegraphics{myimage}

Then LaTeX will use myfile.ps whereas pdfLaTeX will use myfile.png or myfile.pdf (whichever it can find).

How do I include scanned images in my LaTeX document?

First of all, you need to know how to use a scanner, which is not covered here. If you are scanning a photograph, be sure to save it in JPEG format. If you are scanning line art (precisely drawn diagrams) or a page of text from a book, be sure to save it in PNG format.

(Note that scanner settings can drastically affect the file size. For example, if you are scanning a page of black and white text from a book, increase the contrast and lower the bits per pixel to 1 or 2, or perhaps post-process your image manually in a drawing program. The point is that you want the regions of the page that appear white to your eyes to all have a single pixel value of true white, as opposed to being a mixture of colors that may all appear like white to your eyes but to the computer are a complicated mixture of data. You might also change the image storage model from true color to indexed, the latter with as small a pallette of colors as possible. The overall point: the simpler the image data, the more successful the PNG compression algorithm will be!)

Once you have a PNG or JPEG, you could convert it to PS and then include the PS graphic in the usual fashion. However, our users have had poor experience with this approach in the past, so we do not recommend it. Instead, we suggest you read below on how to include a PNG or JPEG in your pdfLaTeX document.

How do I include graphics files in my pdfLaTeX document?

For PS and EPS graphics:

As explained above, pdfLaTeX can't handle these formats. They must be converted to PDF format.

For TIFF graphics:

Convert TIFF to PNG as follows, and then see below on importing PNG into pdfLaTeX.

tifftopnm myimage.tiff > myimage.pnm
pnmtopng myimage.pnm > myimage.png

For BMP graphics:

Convert BMP to PNG as follows, and then see below on importing PNG into pdfLaTeX.

bmptoppm myimage.bmp > myimage.ppm
pnmtopng myimage.ppm > myimage.png

For PNG or JPEG graphics:

Unlike LaTeX, pdfLaTeX can handle PNG and JPEG images just fine. For example, you can use:

\usepackage{graphicx}
...
...
\includegraphics{myimage.png}

Note, however, that you can only process this document with pdfLaTeX:

pdflatex myfile.tex
The result will be myfile.pdf, which you can preview using Acrobat Reader or GhostView or xpdf:
acroread myfile.pdf
gv myfile.pdf
xpdf myfile.pdf

In other words, to use bitmap graphics, we suggest you stop using TeX/LaTeX and DVI files, and instead only use pdfTeX/pdfLaTeX and PDF files.


Navigation tree for section Computer Support