Make your own free website on
Next: 9 Graphics With Frills   Previous: 7 Options for the Adobe / PDF Document

8 Basic Graphics

In this section we will describe some basic code for dealing with JPEG graphics; in the next section we will look at some more advanced options and tweaks. Once again we refer the reader to example.tex.

For an alternative approach to graphics, which works for EPS files, see Appendix A.

8.1 Assumptions

Location of the Graphic

Throughout this section we will assume that we wish to include a JPEG graphic called graph.jpg which lives in the subdirectory graphics of the directory where the source LATEX file lives.

Bounding Box

Furthermore we assume that we have run the program EBB on the JPEG to create a bounding box. (EBB is a small utility program helpfully supplied with DVIPDFM). To run it on our test graphic type ebb graph.jpg at the DOS prompt. This produces a file called If this file is left in the graphics directory, LATEX will pick it up automatically (assuming the dvipdfm option is in the documentclass -- otherwise you will need to use the bb option of \includegraphics).

8.2 Basic Code

The basic code required to insert graph.jpg into our document is as follows:
  \caption{This is an included JPEG}

Note that for more than one graphic it is easy to write a macro to perform the inclusion - see example.tex for example macros. Figure 9.5 in this document is an example of what the included graphics can look like.

8.3 Explanation and Cautions

The code of Section 8.2 works as follows:
  • The \caption and the \centering are optional.
  • The dummy makeimage environment is some kind of trick or workaround. It is vital that it is included and that nothing goes inside it, otherwise LATEX2HTML tends to go off on one of its conversion forays, and other things go wrong. Speaking personally, it seems extraordinary that this kind of thing is not mentioned in the LATEX2HTML manual.
  • Due to the way LATEX2HTML has been written, \includegraphics always spawns some kind of conversion process, even if it is unnecessary or ridiculous. Thus we have to use \includegraphics to get the graphic into the DVI / PDF version of the document, and \htmladdimg to get it into the HTML version. This latter command sucessfully bypasses LATEX2HTML's format conversion (usually!).
  • The \latex isolates the \includegraphics from LATEX2HTML to prevent any conversion of graphics formats. The \html similarly isolates the \htmladdimg from the PDF document: in theory it should not be needed, but the PDF document goes wrong if it is omitted. Note also, should you try to modify this code, that whereas the \latex can be replaced by a latexonly environment, it goes wrong if you try to replace the \html with a corresponding htmlonly environment. It's a funny old world.
  • Note the subtle differences in the two specifications of the path for the graphic. LATEX2HTML by default creates a subdirectory for all the bits of the HTML document, and so the path for the graphic in the \htmladdimg has to be specified relative to this subdirectory.

If LATEX complains `File graphics/ not found' then you have forgotten to run EBB on the graph.jpg -- see Section 8.1.

Back Home Up Next

Charles Clayton 2000. Please use this information at your own risk.



Hit Counter