Active Image Maps

Image maps are images with active regions in which a Web-surfer can click, to send him off to another sector of cyberspace. LATEX2HTML can design either inline ``figures'' or external ones (with or without a thumbnail version) to be image-maps. However HTML requires a URL of a HTML map-file, which associates the coordinates of each active region in the map with a destination URL. Usually this map file is kept on the server machine, however HTML 3.2 also allows it to reside on the client side for faster response. Both configurations are supported by LATEX2HTML through the \htmlimage options `map=' and `usemap=' respectively.


Keeping such a map file up to date manually can be tedious, especially with dynamic documents under revision. An experimental program makemap helps automate this process. This program (which is really a Perl script) takes one mandatory argument and an optional argument. The mandatory argument is the name of a user-map file, defined below. The optional argument is the name of the directory where the HTML map file(s) are to be placed.


The best way of describing how this works is by example. Suppose a document has two figures designated to become active image-maps. The first figure includes a statement like:

\begin{figure}
\htmlimage{map=/cgi-bin/imagemap/BlockDiagram.map,...}
. . .
\end{figure}
The second figure has a line like:

\begin{figure}
\htmlimage{map=/cgi-bin/imagemap/FlowChart.map,...}
. . .
\end{figure}





A typical user-map file, named report.map, might contain the following information43:
#
#  Define the location(s) of the labels.pl file(s):
#
+report/ <URL>
#
#  Define map #1:
#
BlockDiagram.map:       
label1  rect    288,145 397,189
label2  rect    307,225 377,252
label2  default
#
#  Define map #2
#
FlowChart.map:
label3  circle  150,100 200,100
label4  default

In this file, comments are denoted by a #-sign in column 1. The line beginning with +report states that the symbolic labels are to be found in the labels.pl contained in the directory report/, and that its associated URL is as stated. Any number of external labels.pl files may be so specified. The block diagram image has two active regions. The first is a rectangle bounded by corners (288, 145) and (397, 189), while the second is a rectangle bounded by corners (307, 225) and (377, 252). These coordinates can be obtained with the aid of a program such as xv. If the user clicks in the first rectangle, it will cause a branch to the URL associated with symbolic label label1 defined in the labels.pl file found in directory report/. The single active region in the flow chart figure is a circle centred at (150, 100) and passing through point (200, 100). Clicking in this region will cause a branch to symbolic label label3. Labels label2 and label4 will be visited if the user clicks anywhere outside of the explicit regions. If any labels are not defined in any of the labels.pl files mentioned, they will be interpreted as URLs without translation.

The HTML image-maps are generated and placed in directory report/ by invoking the command: makemap report.map report .


Ross Moore
1999-03-26