Next: 9.2 Separate handling of .gif/.jpg/.png and .ps input Up: 9 Templates Previous: 9 Templates

## 9.1 Flexible inclusion of figures in different graphics formats

Unfortunately, no single graphics input format is supported by all three of LATEX, pdflatex, and LATEX2HTML.

Table 2: Graphics Support
Package Input Format Output Format
LATEX .eps, .ps .dvi, .ps
pdflatex .jpg, .pdf, .png, .tif .pdf
LATEX2HTML same as LATEX .gif/.png, .html

This complicates production of graphics-rich documents if Postscript, PDF and HTML output are all required. It is possible however to code a LATEX figure environment call so that the same source text brings in different graphics files as needed by the different compilers. The following template shows how to do this with \usepackage{graphicx} included in the document preamble:

\begin{figure}[thp]
\begin{center}
\includegraphics[width=4in]{fig1}
\caption{Caption text.}
\label{fig:labeltext}
\end{center}
\end{figure}


\includegraphics will search for the file fig1.eps when LATEX is run, either directly or by running LATEX2HTML. LATEX2HTML will convert the input fig1.eps graphic into a .gif or .png file using the LATEX engine, then the dvips, Ghostscript and netpbm utilities. The same \includegraphics call will also search for whichever of fig1.pdf or fig1.jpg are in the source directory if pdflatex is run to produce .pdf output.

The example shown requests that the graphic be reproduced with a width of 4 inches. includegraphics also lets you specify a scale factor, angle of rotation, image width, and/or image height, for example:

\includegraphics[scale=0.5]{<filename>}
\includegraphics[angle=45]{<filename>}
\includegraphics[width=2in]{<filename>}
\includegraphics[totalheight=4in]{<filename>}
\includegraphics[scale=0.5,totalheight=4in]{<filename>}


Next: 9.2 Separate handling of .gif/.jpg/.png and .ps input Up: 9 Templates Previous: 9 Templates

Home | Contact Us | Directories | Site Map | Help | Search

2001-06-08