Make your own free website on Tripod.com
Next: A. EPS Graphics   Previous: 8 Basic Graphics


9 Graphics With Frills

In this section we describe a few options for included graphics.

9.1 ALT Text

ALT Text for Images

The HTML ALT option provides some alternative text if the graphic fails to load, which also, in some browsers, appears as a tool tip. To get this in our HTML document, modify the code given in Section 8.2 so that the appropriate line reads:
 \html{\htmladdimg[ALT="Your ALT text"]{../graphics/graph.jpg}}

Note that in general any valid HTML markup can go in the optional argument for \htmladdimg.

ALT Text for Equations

The ALT text can also be set in equations. By default LATEX2HTML uses the LATEX source of the equation as the ALT text , which is pretty meaningless for most readers, so it is useful to either suppress it by specifying a null string, or to give something more helpful. In the case of equations, the ALT text is specified with a \htmlimage command (rather than with a \htmladdimg command) as in the following example:
\begin{equation}
  \htmlimage{ALT="An important equation"}
  \label{eqn1}
  e^{i\pi}=-1
\end{equation}
which gives:
An important equation (1)

If you are reading this in Internet Explorer, holding your mouse over the equation should produce a tool tip `An important equation'.

9.2 Borders

To stick a border round the image -- in both the PDF and HTML versions -- we modify two lines of the code in Section 8.2 as follows:

\latex{\fbox{\includegraphics{graphics/graph.jpg}}}

\html{\htmladdimg[BORDER="1"]{../graphics/graph.jpg}}

9.3 Scaling

Sometimes it is useful to scale images. To make the image four inches wide in both the PDF and HTML versions, for example, use:

\latex{\includegraphics[width=4in]{graphics/graph.jpg}}}

\html{\htmladdimg[WIDTH="4in"]{../graphics/graph.jpg}}

Unfortunately it does not seem possible to get LATEX2HTML to correctly generate a WIDTH="50%" type of construction, which would match the scale=0.5 option of \includegraphics. This is presumably another bug or oversight.

9.4 Caption Placing

In the PDF version, the caption will be above the image if the \caption comes before the \includegraphics; otherwise it will be below. LATEX2HTML is not sensitive to this, however.

9.5 Example

As an example, Figure 9.5 is a scaled, boxed image with ALT text. Further examples may be found in example.tex.

Figure 1: A scaled boxed JPEG image. It should be four inches wide in both the PDF and HTML versions. In the HTML version, holding your mouse over it will produce the tooltip: `A graphic'.

A Graphic

Note that the \includegraphics and \htmladdimg commands have many other useful options; they are explained in the hyperref and LATEX2HTML documents.


Back Home Up Next




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

 

 

Hit Counter