1\begin{htmlonly}
2\documentclass[dvips,a4paper]{article}
3\usepackage{html,htmllist,makeidx,longtable}
4\input manhtml.tex
5%
6\input{features.ptr}    % Input counters and section
7\end{htmlonly}
8\startdocument
9%
10%\section{Special Features\label{sec:fea}\index{features}}%
11\label{sec:fea}%
12\index{environments}\index{special features}
13\index{special considerations}\html{\\}\noindent
14This {section} describes major features available for processing
15documents using \latextohtml.
16Firstly the means whereby \latextohtml{} can be configured to produce output
17for the \htmlref{different versions}{versions} of \texttt{HTML}
18is discussed\latex{ in Section~\ref{versions}}.
19Following this is a description\latex{, in Section~\ref{internat},}
20of how to \htmlref{use languages}{internat} other than English.
21The options available with the \htmlref{creation and reuse of images}{imgcon},
22are presented\latex{ in Section~\ref{imgcon}},
23for those situations where a textual representation is inadequate or undesirable.
24
25There are several strategies available for the \htmlref{presentation
26of mathematics}{maths} according to the desired version of \texttt{HTML}.
27These are discussed in some detail\latex{, in Section~\ref{maths}}.
28Environments such as \env{figure}, \env{table}, \env{tabular}
29and \env{minipage} have \htmlref{special features}{sec:figs}%
30\latex{ which are discussed in Section~\ref{sec:figs}}.
31Other supported packages are \hyperref{listed}{listed in Table~}{}{styles}.
32
33
34\subsection{Variation with HTML Versions\label{versions}}%
35%\section{Variation with HTML Versions\label{versions}}%
36\index{HTML@\texttt{HTML}!an evolving standard}%
37\index{HTML@\texttt{HTML}!basic version, 2.0 }%
38\index{HTML@\texttt{HTML}!current version, 3.2 }%
39\index{HTML@\texttt{HTML}!future version, 4.0 }%
40\html{\\}\noindent
41The Hypertext Mark-up Language (\texttt{HTML}) is an evolving standard,
42with different versions supporting different features.
43In order to make your documents viewable by the widest possible audience,
44you should use the most advanced \texttt{HTML} version with widely-accepted usage.
45
46Currently the most advanced is \HTMLIV.
47However this has only recently become an officially recommended version.
48Not all of its features are fully implemented in popular browsers,
49and the level of usage is unclear.
50Hence the default version for \latextohtml, version 98.1 remains at \HTMLIII.
51Further work is required before \latextohtml{} can fully exploit the
52features available using \HTMLIV.
53
54\index{iso-latin1@ISO--Latin--1|see{\htmlref{character set}{IIIcharset}}}%
55\index{iso-8879@ISO--8879|see{\htmlref{character set}{IIIcharset}}}%
56\index{character set!ISO-8879@ISO--8879 (ISO--Latin--1)}%
57\index{HTML@\texttt{HTML}!interactive forms}%
58\index{HTML@\texttt{HTML}!image-maps}%
59This provides support for alignment of headings, images and text
60(including text-flow around images), tables with separate captions
61and alignment of rows and columns, variable sizes and colors for
62text and color or patterns for the background
63as well as images, server-side image-maps, interactive forms,
64and the minimal typographic elements (bold, italic and teletype)
65that were supported already in \texttt{HTML} version 2.0\,.
66Furthermore, \texttt{HTML} version 3.2
67adheres to the \htmladdnormallink{ISO--Latin--1}%
68{http://www.w3.org/hypertext/WWW/MarkUp/html-spec_9.html\#SEC9.7.2}
69(ISO--8879) character set.
70
71\medskip\noindent
72\textbf{Note: }Although many people still use old browsers
73that implement only features available with \texttt{HTML} 2.0,
74this is \emph{not} a good reason to limit translation of documents
75to using only these effects. Most of the translation done by \latextohtml{}
76will still give acceptable results on older browsers.
77The deficiencies due to lack of super/subscripts, tables
78and some alignment effects should eventually convince such users
79to overcome the inertia, and update their browsers to later versions that
80correctly support these effects.
81
82\medskip\noindent
83Sometimes it is known that the audience, for which a specific document
84is intended, has limited browser capabilities.
85Or perhaps special extended capabilities are known to be available.
86The \latextohtml{} translation may be customised to suit the
87available functionality.
88
89\medskip\noindent
90Other \texttt{HTML} versions and extensions
91supported by \latextohtml\ are described below.
92See the description of the \Cs{html\_version} command-line
93\hyperref[page]{option switch}{option switch, on page~}{}{cs_htmlversion}.
94%
95\begin{htmllist}\htmlitemmark{RedBall}
96%begin{latexonly}
97\addtolength{\leftskip}{15pt}
98%end{latexonly}
99\index{HTML@\texttt{HTML}!Version 2.0}%
100\item[Version 2.0\label{html20}]
101This provides only the functionality of the \texttt{HTML} 2.0 standard.
102There is little provision for aligning headings, paragraphs or images
103nor for super/sub-scripts to be generated. Images are created for tables
104and other environments that use \HTMLtag{TABLE} tags with \HTMLiii;
105e.g. \env{eqnarray} and \env{equation} with equation numbering.
106
107\index{HTML@\texttt{HTML}!Version 2.1, now `i18n' extension}%
108\index{Unicode|see{\htmlref{character set}{IIIcharset}}}%
109\index{iso-10646@ISO--10646!Unicode}%
110\index{iso-10646@ISO--10646!|see{\htmlref{character set}{IIIcharset}}}%
111\index{iso-10646@ISO--10646!bidirectional languages}%
112\index{character set!ISO-10646@ISO--10646 (Unicode)}%
113\index{iso-8859-1@ISO--8859--1!no longer used}%
114\item[i18n (internationalised fonts) \strikeout{Version 2.1}]
115This extension (formerly known as \texttt{HTML} version 2.1)
116provides extensions for \htmlref{internationalisation}{internat}.
117Most importantly, the default character set is no longer ISO--8859--1
118but \htmladdnormallink{ISO--10646}%
119{http://ds.internic.net/internet-drafts/draft-ietf-html-i18n-05.txt} (Unicode).
120This is a 16-bit character set and can thus display a much larger set of characters.
121There are also provisions for bidirectional languages
122(e.g. in Arabic the text is written from right to left,
123but numerals from left to right), and provisions in \texttt{HTML}
124to determine the character set and the language used.
125
126Not all of the symbols are available in \TeX, \latextohtml,
127or any browser yet available.
128However the `\texttt{i18n}' extension to \latextohtml\ is in preparation
129for when such browsers do become available, and such characters
130will be required in Web-accessible documents.
131
132
133\index{HTML@\texttt{HTML}!Version 2.2, now `table' extension}%
134\index{HTML@\texttt{HTML}!HTML3 Tables@\texttt{HTML3} Table Model }%
135\index{tables!as HTML mark-up@as \texttt{HTML} mark-up}%
136\index{Netscape@\textsl{Netscape Navigator}!HTML3 Tables@\texttt{HTML3} Tables}%
137\item[tables (\texttt{HTML3} model)\label{tables3}\strikeout{Version 2.2}]
138Although \texttt{HTML} 3.2 implements tables using \HTMLtag{TABLE} tags,
139the capabilities available to specify details of the table-layout
140are not as extensive as were originally proposed in the
141\htmladdnormallink{\texttt{HTML3} Table Model}%
142{http://www.w3.org/pub/WWW/TR/WD-tables}.
143This extension (formerly referred to as \texttt{HTML} version 2.2)
144provides the full capabilities of this model.
145
146Note that current browsers may not correctly interpret all
147the features of tables constructed using this extension.
148Tables will be constructed, perhaps with some cells mis-aligned
149or without the desired merging of adjacent cells, etc.
150This feature was already available in many \texttt{HTML} browsers,
151including \appl{Netscape Navigator} V1.2, so should be still
152available with later versions of these browsers.
153
154
155\index{HTML@\texttt{HTML}!Version 3.0}%
156\item[\texttt{HTML} 3.0\label{html30}]
157This version of \texttt{HTML} was never accepted to become
158a recognised standard; perhaps because some of its models
159were ``too advanced'' at the time
160(notably the \htmlref{\texttt{HTML-Math}}{math3}
161and the \htmlref{Table Model}{tables3}).
162The proposed \htmladdnormallink{\texttt{HTML} 3.0}%
163{http://www.w3.org/pub/WWW/MarkUp/html3/}
164``standard'' was withdrawn and re-drafted to create
165the \texttt{HTML} 3.2 standard which is in current use.
166Standard textual formatting features, including centering, flush-right,
167flush-left and underlining are among the features retained.
168
169
170\index{HTML@\texttt{HTML}!Version 3.0, \texttt{HTML-Math} model}%
171\index{HTML@\texttt{HTML}!Version 3.1, now `math' extension}%
172\index{Arena@\textsl{Arena}!math mark-up}\index{CERN!Arena@\textsl{Arena}}%
173\index{browser!Arena@\textsl{Arena}}%
174\item[math (\texttt{HTML3} model) \strikeout{Version 3.1}]
175This extension (formerly referred to as \texttt{HTML} version 3.1)
176adds support for the \htmladdnormallink{\texttt{HTML-Math} model}%
177{http://www.w3.org/pub/WWW/MarkUp/html3/maths.html/}, originally
178part of the proposed \texttt{HTML} 3.0 standard, see \htmlref{above}{html30}.
179The only \htmlref{available browser}{http://www.yggdrasil.com/Products/Arena}
180which can display this mark-up is \appl{Arena}.
181Originally developed by the \htmladdnormallink{World Wide Web Consortium}%
182{http://www.w3.org/Arena} as a test-bed browser,
183it is no longer supported by them.
184
185\index{mathematics!MathML}
186There has been a recent proposal for a Mathematical Markup Language
187(\htmladdnormallink{\texttt{MathML}}%
188{http://www.w3.org/pub/WWW/TR/WD-math-970515})
189from the W3C \htmladdnormallink{Math Working Group}%
190{http://www.w3.org/pub/WWW/Markup/Math/}.
191This would suggest that the \texttt{HTML-Math} model is unlikely
192ever to be adopted; better things being expected in the near future
193using \texttt{MathML}.
194
195See also \hyperref{another page}{Section~}{}{maths} for a discussion
196the the mechanisms available with \latextohtml{} for handling
197mathematical equations and expressions.
198\end{htmllist}
199
200
201
202
203\subsection{Internationalisation\label{internat}}%
204%\section{Internationalisation\label{internat}}%
205\index{languages}\index{extensions!languages}\html{\\}%
206A special variable \fn{\$LANGUAGE\_TITLES}
207in the initialisation or configuration files determines the language
208in which some section titles will appear. For example setting it to
209\begin{quote}
210\begin{verbatim}
211$LANGUAGE_TITLES = 'french';
212\end{verbatim}
213\end{quote}
214will cause \latextohtml{} to produce ``Table des mati{\`e}res'' instead of
215``Table of Contents''.
216Furthermore, the value of the \Lc{today} command is presented in a format
217customary in that language.
218
219\index{languages!french}\index{languages!english}\index{languages!german}%
220\index{languages!spanish}\index{languages!finnsh}%\index{languages!slovene}%
221\html{\\}%
222Languages currently supported are
223\env{finnish}, \env{french}, \env{english}, \env{german}
224 and \env{spanish}.
225It is trivial to add support for another language by creating a file
226in the \fn{styles/} subdirectory,
227or by adding to the file \fn{latex2html.config}.
228As a guide, here is the entry for French titles:
229%begin{latexonly}
230\begin{small}
231%end{latexonly}
232\begin{verbatim}
233sub french_titles {
234    $toc_title = "Table des mati\\`eres";
235    $lof_title = "Liste des figures";
236    $lot_title = "Liste des tableaux";
237    $idx_title = "Index";
238    $ref_title = "R\\'ef\\'erences";
239    $bib_title = "R\\'ef\\'erences";
240    $abs_title = "R\\'esum\\'e";
241    $app_title = "Annexe";
242    $pre_title = "Pr\\'eface";
243    $fig_name = "Figure";
244    $tab_name = "Tableau";
245    $part_name = "Partie";
246    $prf_name = "Preuve";
247    $child_name = "Sous-sections";
248    $info_title = "\\`Apropos de ce document...";
249    @Month = ('', 'janvier', "f\\'evrier", 'mars', 'avril', 'mai',
250              'juin', 'juillet', "ao\\^ut", 'septembre', 'octobre',
251              'novembre', "d\\'ecembre");
252    $GENERIC_WORDS = "a|au|aux|mais|ou|et|donc|or|ni|car|l|la|le|les"
253        . "|c|ce|ces|un|une|d|de|du|des";
254}
255\end{verbatim}
256%begin{latexonly}
257\end{small}
258%end{latexonly}
259Notice how the backslash needs to be doubled, when a macro is needed
260(for accented characters, say).
261Also, the \texttt{\$GENERIC\_WORDS} are a list of short words to be excluded
262when filenames are specially requested to be created from section-headings.
263In order to provide full support for another language you may also
264replace the navigation buttons which come with \latextohtml{}
265(by default in English) with your own.
266As long as the new buttons have the same file-names as the old ones,
267there should not be a problem.
268
269
270\subsubsection{Alternate Font Encodings\label{fontEncodings}}%
271%
272\index{extension!options}%
273\html{\\}%
274\latextohtml{} can interpret input using 8-bit fonts,
275provided it is told which font-encoding is being used.
276This can be done by appending an ``extension'' option
277to the \Cs{html\_version} command-line switch; e.g.
278%
279%begin{latexonly}
280\begin{small}
281%end{latexonly}
282\begin{verbatim}
283 latex2html -html_version 3.2,latin2 ....  myfile.doc
284\end{verbatim}
285%begin{latexonly}
286\end{small}
287%end{latexonly}
288declares that any 8-bit characters in the \LaTeX\ source
289within the file \texttt{myfile.doc} are to be interpreted
290according to the ISO--8859--2 (ISO-Latin2) font encoding,
291rather than the default of ISO--8859--1 (ISO-Latin1).
292
293Furthermore, ISO--10646 (Unicode) entities can be embedded within
294the output produced by \latextohtml.
295For this a further ``extension'' option is appended; viz.
296%
297%begin{latexonly}
298\begin{small}
299%end{latexonly}
300\begin{verbatim}
301 latex2html -html_version 3.2,latin2,unicode ....  myfile.doc
302\end{verbatim}
303%begin{latexonly}
304\end{small}
305%end{latexonly}
306declares that the input is ISO-Latin2, but that 8-bit characters
307be output as the corresponding Unicode number.
308For example, e.g. the Polish {\L} would become \texttt{\&\#321;}.
309Otherwise the browser might render the character as \pounds %\mbox{\pounds},
310which is the character in the corresponding place for ISO-Latin1.
311The input encodings that are recognised are listed in
312\hyperref{the following table}{Table~}{}{tab_encodings}.
313
314\begin{table}
315\begin{center}
316\begin{tabular}{|>{\ttfamily}lcl|}%\hline
317\multicolumn{1}{c}{\textbf{extension}}
318&\multicolumn{1}{c}{\textbf{notes}}
319&\multicolumn{1}{c}{\textbf{encoding}}\\\hline
320unicode & (partial)& ISO--10646 (Unicode)\\
321latin1 & (default) & ISO--8859--1 (ISO-Latin-1) \\
322latin2 &  & ISO--8859--2 (ISO-Latin-2) \\
323latin3 &  & ISO--8859--3 (ISO-Latin-3) \\
324latin4 &  & ISO--8859--4 (ISO-Latin-4) \\
325latin5 &  & ISO--8859--9 (ISO-Latin-5) \\
326latin6 &  & ISO--8859--10 (ISO-Latin-6)\\\hline
327\end{tabular}
328\caption{Supported Font-encodings\label{tab_encodings}}
329\end{center}
330\end{table}
331
332If multiple extension options are requested, then later ones
333override earlier ones.\html{\\}
334Only in rare circumstances should it be necessary to do this.
335For example, if the latter encoding does not define characters
336in certain places, but an earlier encoding does so, and these
337characters occur within the source.
338In this case the \texttt{unicode} extension ought to be loaded also,
339else browsers may get quite confused about what to render.
340
341
342\subsubsection{Multi-lingual documents, using Images\label{multilang}}%
343%
344Some multi-lingual documents can be constructed, when all the languages
345can be presented using characters from a single font-encoding,
346as discussed in the \hyperref{previous section}{Section~}{}{fontEncodings}.
347
348Another way to present multiple languages within a Web document is to
349create images of individual letters, words, sentences, paragraphs
350or even larger portions of text, which cannot be displayed within
351the chosen font-encoding.
352This is a technique that is used with \IndicHTML, for presenting
353traditional Indic language scripts within Web pages.
354For these the \LaTeX\ source that is to be presented as an image
355needs special treatment using a ``pre-processor''.
356For the special styles defined in \IndicHTML, running the preprocessor
357is fully automated, so that it becomes just another step
358within the entire image-generation process.
359
360\medskip
361
362The technique of using images, can be used with \emph{any} font
363whose glyphs can be typeset using \TeX{} or \LaTeX.
364Using \TeX's \Lcs{font} command, a macro is defined to declare
365the special font required;
366e.g. for Cyrillic characters, using the Univ. of Washington font:
367%begin{latexonly}
368\begin{small}
369%end{latexonly}
370\begin{verbatim}
371 \font\wncyr = wncyr10
372\end{verbatim}
373%begin{latexonly}
374\end{small}
375%end{latexonly}
376
377\noindent
378Now use this font switch immediately surrounded by braces:
379%begin{latexonly}
380\begin{small}
381%end{latexonly}
382\begin{verbatim}
383 published by {\wncyr Rus\-ski\char26\ \char23zyk}.
384\end{verbatim}
385%begin{latexonly}
386\end{small}
387%end{latexonly}
388to get:
389\begin{center}
390 published by {\wncyr Rus\-ski\char26\ \char23zyk}.
391\end{center}
392
393
394\subsection{Mathematics\label{maths}}
395%\section{Mathematics\label{maths}}
396%
397There are various different ways in which \latextohtml{} can handle
398mathematical expressions and formulas:
399\begin{itemize}
400\item
401give a textual representation (``simple'' math);
402\item
403make an image of the complete formula or expression;
404\item
405combination of textual representation and images of
406sub-expressions;
407\item
408\texttt{SGML}-like representation built using abstract ``entities'';\\
409e.g. for the \texttt{HTML-Math} model, or for \texttt{MathML}.
410%
411\end{itemize}
412Which is the most appropriate normally depends on the context,
413or importance of the mathematics within the entire document.
414What \latextohtml{} will produce depends upon
415\begin{enumerate}
416\item
417the version of \texttt{HTML} requested;
418\item
419whether or not the special `\texttt{math}' \htmlref{extension}{} has been loaded;
420\item
421whether the \Cs{no\_math} \htmlref{command-line option}{nomath}
422has been specified, or (equivalently) the \fn{\$NO\_SIMPLE\_MATH}
423\htmlref{variable}{nomath} has been set in an initialisation file.
424\end{enumerate}
425%
426The strategies used to translate math expressions are summarised
427in \hyperref{the table below}{Table~}{}{mathconv3} for \texttt{HTML} 3.0+
428and \hyperref{the subsequent table}{Table~}{}{mathconv2} for \texttt{HTML} 2.0.
429
430\begin{table}[ht]
431\begin{center}
432\begin{tabular}{|c|c|p{6cm}|}
433\hline
434\textbf{`math'} & \textbf{switch} &\textbf{\hfill strategy adopted\hfill~}\\ \hline
435 not loaded & --- & textual representation where possible,\newline
436  else image of whole expressions\\ \hline
437 not loaded & \Cs{no\_math} & always generates an image of the whole\newline
438 expression/environment\\ \hline
439 loaded & --- &
440uses entities and \HTMLtag{MATH} tags; e.g. for \texttt{HTML-Math}
441 (or \texttt{MathML} in future)\\ \hline
442 loaded & \Cs{no\_math} & textual representation where possible,
443 with~images~of sub-expressions \\ \hline
444\end{tabular}
445\caption{Mathematics translation strategies,
446 for \texttt{HTML} versions 3.0 and 3.2,\protect\newline
447 using \protect\HTMLtag{SUP} and \protect\HTMLtag{SUB} tags
448 and \protect\HTMLtag{TABLE}s}
449\label{mathconv3}
450\end{center}
451\end{table}
452
453
454Using the \Cs{no\_math} switch is best for having a consistent
455style used for all mathematical expressions, whether inline or in displays.
456The images are of especially good quality when ``anti-aliasing''
457is being used (see \hyperref[page]{here}{page~}{}{cs_aaliastext}),
458provided the browser is set to have a light background colour.
459(When set against a gray or dark background, these images can become
460rather faint and hard to read.)
461
462The final strategy \hyperref{above}{in Table~}{}{mathconv3},
463using \Cs{no\_math} is the preferred method for good quality
464mathematics with \texttt{HTML} version 3.2~. It combines the browser's
465built-in fonts with the best quality images, when needed.
466To obtain it use the command-line option switches:
467\begin{quote}
468\texttt{ -no\_math -html\_version 3.2,math }
469\end{quote}
470This is what was used when creating\latex{ the \texttt{HTML} version of}
471this manual. For a more detailed discussion of processing mathematics
472using this strategy see the online document by the present author,
473entitled \htmladdnormallinkfoot{``Mathematics with \latextohtml''}%
474{http://www-texdev.ics.mq.edu.au/l2h/mathdocs/}.
475Examples \htmlref{below}{ex-aalias} show how to generate an image
476of a whole environment, even with these options in force.
477
478\bigskip
479\noindent
480Since the \texttt{HTML} 2.0 standard does not include
481superscripts and subscripts, via the \HTMLtag{SUP} and \HTMLtag{SUB} tags,
482the options are more limited. In this case creating images of sub-expressions
483is not so attractive, since virtually the whole expression would
484consist of images in all but the simplest of cases.
485
486\begin{table}[hbt]
487\begin{center}
488\begin{tabular}{|c|c|p{6cm}|}\hline
489\textbf{`math'} & \textbf{switch} &\textbf{\hfill strategy adopted\hfill~}\\ \hline
490 not loaded & --- & textual representation where possible,\newline
491 else image of whole expressions\\ \hline
492 not loaded & \Cs{no\_math} & always generates an image of\newline
493the whole expression or environment\\ \hline
494 loaded & --- &
495entities and \HTMLtag{MATH} tags for~\texttt{HTML-Math}\\ \hline
496 loaded & \Cs{no\_math} & always generates an image of the whole\newline
497 expression or environment \\ \hline
498\end{tabular}
499\caption{Mathematics translation strategies,
500for \texttt{HTML} version 2.0\label{mathconv2}}
501\end{center}
502\end{table}
503\medskip \htmlrule
504\index{numbered equations}\index{equations!numbered}%
505\index{equations!right-justified}\html{\\}%
506
507\noindent
508Here are some examples of mathematical expressions and environments
509processed by \latextohtml{} using different strategies.
510They are automatically numbered \dots
511\begin{equation}\label{eq:demo}
512 \Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
513 \frac{1}{2}h^2\frac{\partial^2\Phi}{\partial x^2} +
514 \frac{1}{6}h^3\frac{\partial^3\Phi}{\partial x^3} + \,\ldots\,\Bigr)_{l,m,n}
515\end{equation}
516\dots\ with some gratuitously {\'a}c{\c c}{\"e}nted text in-between \dots
517%
518\index{equations!array}%
519\index{eqnarray@\env{eqnarray} environment!example}%
520%
521\begin{eqnarray}
522\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
523\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}} \nonumber \\
524+ \frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}} = -I_{l,m,n}(v)\;.
525\end{eqnarray}
526The latter example uses an \env{eqnarray} environment
527and the \Lc{nonumber} command to suppress
528the equation number on the upper line.
529
530\medskip\noindent
531%
532\latexhtml{In the on-screen version of these equations}{Notice how}
533simple alphabetic characters that are not part of fractions appear
534in the (italiced) text-font selected using the browser's controls.
535This may appear slightly different from the same symbol being used
536within a fraction, or other mathematical construction requiring an image
537to be generated. This is most apparent with the letter `h' in the
538first equation and the subscripts at the end of the second equation.
539
540\index{image generation!using htmlimage@using \Lc{htmlimage}}
541
542By inserting an \verb|\htmlimage{}| command into a \env{math},
543\env{equation} or \env{displaymath} environment, a single image
544will be created for the whole environment. For an \env{eqnarray}
545environment, this will lead to having a single separate image
546for each of the aligned portions.
547The argument to \Lc{htmlimage} need not be empty, but may contain
548information which is used to affect characteristics of the resulting
549image. An example of how this is used is given \htmlref{below}{ex:aalias},
550and a fuller discussion of the allowable options is given in
551\hyperref{the next section}{Section~}{}{imgcon}.
552
553
554\index{scale-factors!for math images}%
555\paragraph*{Scale-factors for Mathematics.\label{mathscales}}
556%
557When an image is to be made of a mathematical formula or expression,
558it is generally made at a larger size
559than is normally required on a printed page.
560This is to compensate for the reduced resolution of a computer screen
561compared with laser-print.
562The amount of this scaling is given by the
563value of a configuration variable \fn{\$MATH\_SCALE\_FACTOR},
564by default set to 1.6 in \fn{latex2html.config}.
565A further variable \fn{\$DISP\_SCALE\_FACTOR} is used with
566`displayed math' equations and formulas.
567This value multiplies the \fn{\$MATH\_SCALE\_FACTOR}
568to give the actual scaling to be used.
569The main purpose of this extra scaling is to allow some clarity in
570super/subscripts etc.
571
572
573\index{anti-aliasing!comparison}%
574\paragraph*{Anti-aliased Images.\label{ex:aalias}}
575\hyperref{Here are}{Figure~}{ shows}{eq:pics} the same equations
576as \htmlref{previously}{eq:demo}, this time as images of the
577complete contents of the \env{equation} environment,
578and complete aligned parts of rows in an \env{eqnarray}.
579\begin{latexonly}
580These are images, as they would appear if the \texttt{HTML} page
581were to be printed from the browser. A scaling of 60\% has been
582applied to counteract the combined effects of the \fn{\$MATH\_SCALE\_FACTOR}
583of 1.4 and \fn{\$DISP\_SCALE\_FACTOR} of 1.2,
584used for the \texttt{HTML} version of this manual.
585\end{latexonly}
586For a comparison, the second group of images use anti-aliasing effects,
587whereas the first image does not; a 600\,dpi printing is probably necessary
588to appreciate the difference in quality. Compare these images with those in
589\hyperref{a later section}{Section~}{}{printqual}.
590
591\smallskip\noindent\index{anti-aliasing!requires@requires \appl{Ghostscript} 4.03}
592\textbf{Note: }To generate anti-aliased images using \appl{Ghostscript}
593requires version 4.03 or later.
594
595\begin{figure}[hb]
596\begin{makeimage}
597\end{makeimage}
598\begin{htmlonly}
599\begin{equation}
600\htmlimage{no_antialias}
601\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
602\frac{1}{2}h^2\frac{\partial^2\Phi}{\partial x^2} +
603\frac{1}{6}h^3\frac{\partial^3\Phi}{\partial x^3} + \,\ldots\,\Bigr)_{l,m,n}
604\end{equation}
605\begin{eqnarray}
606\htmlimage{}
607\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
608\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}} \nonumber \\
609+ \frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}} = -I_{l,m,n}(v)\;.
610\end{eqnarray}
611\end{htmlonly}
612%
613\begin{latexonly}
614\begin{equation}
615 \setbox1=\hbox{\scalebox{.6}{\includegraphics{psfiles/eqn1.ps}}}
616 \lower.5\ht 1\box1
617\end{equation}
618\begin{eqnarray}
619 \nonumber
620 \setbox1=\hbox{\scalebox{.6}{\includegraphics{psfiles/eqarrA1.ps}}}
621 \lower.5\ht1 \box1&&\\
622 \setbox1=\hbox{\scalebox{.6}{\includegraphics{psfiles/eqarrB1.ps}}}
623 \lower.5\ht1 \box1&&
624\end{eqnarray}
625\end{latexonly}
626\caption{Images of equation displays, at normal screen resolution}\label{eq:pics}
627\end{figure}
628
629\noindent
630These images of the whole environment were created
631using the \Lc{htmlimage} command, to suppress the extended parsing
632that usually occurs when the `\texttt{math}' extension is loaded; viz.
633%
634%begin{latexonly}
635\begin{small}
636%end{latexonly}
637\begin{verbatim}
638\begin{equation}
639\htmlimage{no_antialias}
640\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
641...
642\end{equation}
643%
644\begin{eqnarray}
645\htmlimage{}
646\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
647...
648\end{eqnarray}
649\end{verbatim}
650%begin{latexonly}
651\end{small}
652%end{latexonly}
653Further aspects of the options available when generating images
654are discussed in \htmlref{the next section}{imgcon}, in particular
655with regard to the quality of \htmlref{printed images}{printqual}.
656
657
658
659\index{mbox@\Lc{mbox} command with math!generates an image}%
660\paragraph*{The \Lc{mbox} command.}
661Another way to force an image to be created of a mathematical expression,
662when global settings are not such as to do this anyway,
663is via the \Lc{mbox} command having math delimiters within its argument.
664
665Normally \Lc{mbox} is used to set a piece of ordinary text within a
666mathematics environment. It is not usual to have math delimiters
667\texttt{\$...\$} or \Lc{(}...\Lc{)} within the argument of an \Lc{mbox}.
668Whereas earlier versions of \latextohtml{} simply ignored the \Lc{mbox}
669command (treating its argument as normal text),
670the presence of such delimiters now results in an image being
671generated of the \emph{entire contents} of the \Lc{mbox}.
672It is not necessary for there to be any actual mathematics inside
673the \Lc{mbox}'s contents;\html{\\}
674e.g. \verb|\mbox{...some text...${}$}|
675will cause an image to be created of the given text.
676
677
678\index{parbox@\Lc{parbox} command!generates an image}%
679\paragraph*{The \Lc{parbox} command.}
680The \Lc{parbox[}\Meta{align}\verb|]{|\Meta{width}\verb|}{|\Meta{text}\verb|}|
681command also generates an image of its contents,
682except when used within a \env{tabular} environment, or other
683similar table-making environment.
684Here the important aspect is the width specified for the given
685piece of text, and any special line-breaks or alignments that
686this may imply. Hence to get the best effect, \LaTeX{} is used
687to typeset the complete \Lc{parbox}, with its specified width,
688alignment and contents, resulting in an image.
689
690
691\index{heqn.sty@\texttt{heqn.sty} style-file}%
692\index{package!heqn@\env{heqn}}\index{heqn@\env{heqn} package}%
693\index{eqnarray@\env{eqnarray} environment}%
694\index{equation@\env{equation} environment}\html{\\}%
695\paragraph*{The \env{heqn} package.}
696%
697If you need \texttt{HTML} 2.0 compatible Web pages,
698and have a document with a great many displayed equations,
699then you might try using the \env{heqn} package.
700Inclusion of the \fn{heqn.sty} file has absolutely
701no effect on the printed version of the article,
702but it does change the way in which \latextohtml{} translates
703displayed equations and equation arrays.
704It causes the equation numbers of the \env{equation}
705environment to be moved outside of the images themselves,
706so that they become order-independent and hence recyclable.
707Images that result from the \env{eqnarray} environment are also recyclable,
708so long as their equation numbers remain unchanged from the previous run.
709
710\index{nonumber@\Lc{nonumber}}%
711\index{package!html@\env{html}}%
712\index{html@\env{html} package}\html{\\}%
713The \Lc{nonumber} command is recognised
714in each line of the equation array, to suppress the equation number.
715A side-effect of this approach is that equation numbers will
716appear on the left side of the page.
717The \env{heqn} package requires the \env{html} package.%
718
719\smallskip\noindent
720Using \texttt{HTML} Version 3.2 the \env{heqn} package is quite redundant,
721since equation numbers are placed in a separate \HTMLtag{TABLE} cell
722to the mathematical expressions themselves.
723It is \emph{not} required and should \emph{not} be requested, since this will
724override some of the improved functionality already available.
725
726
727
728
729\subsection{Figures and Image Conversion\label{imgcon}%
730%\section{Figures and Image Conversion\label{imgcon}%
731\index{images@images\protect\label{IIIimages}}}%
732\tableofchildlinks*\htmlrule
733%
734\noindent
735\latextohtml{} converts equations, special accents, external \PS\
736files, and \LaTeX{}  environments it cannot directly translate into
737inlined images. This section describes how it is possible to control
738the final appearance of such images. For purposes of discussion \dots
739\begin{itemize}
740\item
741``small images'' \index{images!small images}\html{\\}%
742refers to inline math expressions, special accents and
743any other \LaTeX{} command which causes an image to be generated; while \dots
744\item
745``figures'' \index{images!figures}\html{\\}%
746applies to image-generating \LaTeX{} environments
747(e.g. \env{makeimage}, \env{figure}, \env{table} (with \texttt{HTML} 2.0),
748 and displayed math environments when required to generate images, etc.).
749\end{itemize}
750
751\index{images!math scale-factor}%
752\index{images!display scale-factor}%
753\index{images!figure scale-factor}%
754\index{images!scale-factor, default 1.6}\html{\\}%
755\noindent
756The size of all ``small images'' depends on a configuration variable
757\fn{\$MATH\_SCALE\_FACTOR} which specifies how much to enlarge or
758reduce them in relation to their original size in the \PS\
759version of the document.
760For example a scale-factor of 0.5 will make all images half as big,
761while a scale-factor of 2 will make them twice as big.
762Larger scale-factors result in longer processing times and larger
763intermediate image files. A scale-factor will only be effective
764if it is greater than 0.
765The configuration variable \fn{\$FIGURE\_SCALE\_FACTOR} performs
766a similar function for ``figures''.
767Both of these variables are initially set to have value 1.6.
768
769A further variable \fn{\$DISP\_SCALE\_FACTOR} is used with
770`displayed math' equations and formulas;
771this value multiplies the \fn{\$MATH\_SCALE\_FACTOR}
772to give the actual scaling used.
773With the improved clarity of anti-aliased images, a scaling of 1.6
774may be a little excessive for inline images.
775Accordingly this manual actually uses values of 1.4 and 1.2 respectively,
776for \fn{\$MATH\_SCALE\_FACTOR} and \fn{\$DISP\_SCALE\_FACTOR}.
777These go well with the browser's text-font set at 14\,pt.
778The next larger size of 17\,pt is then used for the \HTMLtag{LARGE} tags
779in displayed equations.
780
781\index{images!extra scaling}%
782\index{images!improved print quality}%
783\index{extra scaling of images}\html{\\}%
784
785A further variable \fn{\$EXTRA\_IMAGE\_SCALE} allows images to be created
786at a larger size than intended for display.
787The browser itself scales them down to the intended size,
788but has the extra information available for a better quality print.
789This feature is also available with single images. It is discussed,
790with examples, \hyperref{on the next page}{in Section~}{}{printqual}.
791
792
793\index{htmlimage@\Lc{htmlimage}}%
794\index{html.sty@\texttt{html.sty} style-file}%
795\index{figures!fine control}%
796\paragraph*{\Lc{htmlimage\char123}\Meta{options}\texttt{\char125}\label{htmlimage}}
797%
798For finer control, several parameters affecting the conversion
799of a single image can be controlled
800with the command \Lc{htmlimage}, which is defined in \fn{html.sty}.
801With version \textsc{v97.1} use of this command has been extended to allow
802it to control whether an image is generated or not
803for some environments,
804as well as specifying effects to be used when creating this image.
805
806If an \Lc{htmlimage} command appears within any environment
807for which creating an image is a possible strategy (though not usual,
808due to loading of extensions, say), then an image will indeed be
809created. Any effects requested in the \Meta{options} argument will be used.
810Having empty \Meta{options} still causes the image to be generated.
811
812This ability has been used within this manual, for example with the
813mathematics images in \hyperref{the previous section}{Figure~}{}{eq:pics}.
814
815\medskip\noindent
816The \Meta{options} argument is a string separated by commas.
817\index{images!options}\html{\\}%
818Allowable options are:
819%
820\index{images!scale}%
821\index{figures!arbitrarily scaled}%
822\begin{itemize}
823\item \texttt{scale=}\Meta{scale-factor}\\
824allows control over the size of the final image.
825
826\index{images!external}\label{external}%
827\index{images!inlined by default}%
828\index{images!hypertext link}%
829\item \texttt{external}\\
830will cause the image not to be inlined;
831instead it will be accessible via a hyperlink.
832
833\index{thumbnail}\index{images!thumbnail}%
834\index{thumbnail!implies external}%
835\index{thumbnail!ignores scale-factors}%
836\label{thumbnail}%
837\item \texttt{thumbnail=}\Meta{scale-factor}\\
838will cause a small inlined image to be placed in the caption.
839The size of the thumbnail depends on the \Meta{scale-factor},
840as a factor of the `natural size' of the image, ignoring
841any \fn{\$FIGURE\_SCALE\_FACTOR} or \fn{\$MATH\_SCALE\_FACTOR}, etc.
842which may be applicable to the full-sized version of the image.
843Use of the `\texttt{thumbnail=}' option implies
844the `\texttt{external}' option.
845
846\index{images!image-map}%
847\index{images!server-side image-map}%
848%
849\item \texttt{map=}\Meta{server-side image-map URL}\\
850specifies that the image is to be made into an
851\htmladdnormallink{active image-map}%
852{http://wintermute.ncsa.uiuc.edu:8080/map-tutorial/image-maps.html}.
853(See \hyperref{another section}{Section~}{}{ImageMaps} for more information.)
854
855\index{images!client-side image-map}\html{\\}%
856
857\item \texttt{usemap=}\Meta{client-side image-map URL}
858same as previous item, but with the image-map processed by the client.
859(See \hyperref{another section}{Section~}{}{ImageMaps} for more information.)
860
861\index{images!flip option}
862\index{figures!oriented}\index{tables!oriented}\html{\\}%
863
864\item \texttt{flip=}\Meta{flip\_option}\\
865specifies a change of orientation of the
866electronic image relative to the printed version.
867The \Meta{flip\_option} is any single command recognised by
868the \fn{pnmflip} \htmladdnormallink{graphics utility}{%
869http://s.pi1.physik.uni-stuttgart.de/cgi-bin/man2html.ksh?Name=pnmflip#toc2}.
870The most useful of these include:
871\begin{itemize}
872%
873\item `\texttt{rotate90}' or `\texttt{r90}'~
874This will rotate the image clockwise by $90^\circ$.
875%
876\item `\texttt{rotate270}' or `\texttt{r270}'~
877This will rotate the image counterclockwise by $90^\circ$.
878%
879\item `\texttt{leftright}'~
880This will flip the image around a vertical axis of rotation.
881%
882\item `\texttt{topbottom}'~
883This will flip the image around a horizontal axis of rotation.
884\end{itemize}
885%
886\index{images!alignment}\index{equations!alignment}%
887\index{HTML@\texttt{HTML}!Version 3.0}%
888\item \texttt{align=}\Meta{alignment}\\
889specifies how the \env{figure} will be aligned.
890The choices are:
891`\texttt{top}', `\texttt{bottom}', `\texttt{middle}', `\texttt{left}',
892`\texttt{right}' and `\texttt{center}'.
893
894The `\texttt{middle}' option specifies that the image is to be
895left-justified in the line, but centered vertically.
896The `\texttt{center}' option specifies that it should also
897be centered horizontally.
898This option is valid only if the \texttt{HTML} version
899is \texttt{3.0} or higher.
900The default alignment is `\texttt{bottom}'.%
901
902\index{images!transparent}%
903\index{transparent images!override defaults}%
904%
905\item \texttt{transparent}, \texttt{no\_transparent}
906 or \texttt{notransparent}\\
907specify that a transparent background should (not) be used with this image,
908regardless of the normal behaviour for similar images.
909
910\index{images!anti-alias}%
911\index{anti-aliasing!override defaults}%
912\item \texttt{antialias}, \texttt{no\_antialias}
913 or \texttt{noantialias}\\
914specify that anti-aliasing should (not) be used with this image,
915regardless of the normal behaviour for similar images.
916
917\index{images!extra scaling}%
918\item \texttt{extrascale=}\Meta{scale-factor}\\
919is used mainly used with a \Meta{scale-factor} of 1.5 or 2, when it is
920important to get printed versions of the completed \texttt{HTML} pages.
921The image is created scaled by the amount specified, but it is embedded
922in the \texttt{HTML} page with attributes to the \HTMLtag{IMG} of
923\texttt{HEIGHT=...} and \texttt{WIDTH=...},
924indicating the \emph{unscaled} size.
925A browser is supposed to display the image at the requested size
926by scaling the actual image to fit,
927effectively imposing its own anti-aliasing.
928Some examples of this effect are show
929\hyperref{here}{later, in Section~}{}{printqual}.
930This effect can be applied to all images in a document by setting
931the \fn{\$EXTRA\_IMAGE\_SCALE} \htmlref{variable}{ximagescale}.
932However it may be desirable to also turn off ``anti-aliasing''\index{anti-aliasing},
933as these effects serve similar purposes but need not work well together.
934Furthermore different browsers may give results of different quality.
935It may be necessary to experiment a little,
936in order to find the combination that works best at your site.
937
938\index{images!specified width or height}%
939\item \texttt{height=}\Meta{dimen}\quad
940 and\quad\texttt{width=}\Meta{dimen}\\
941are used to specify exactly the size to be occupied by the image
942on the \texttt{HTML} page. The value(s) given this way overrides
943the natural size of the image and forces the browser to shrink or
944stretch the image to fit the specified size.
945The \Meta{dimen} can be given as either (i) a number (of points);
946or (ii) with any of the units of $\mathrm{cm, mm, in, pt}$;
947or (iii) fraction of \Lc{hsize} or \Lc{textwidth},
948to become a percentage of the browser window's width,
949or of \Lc{vsize} or \Lc{textheight} for a percentage height.
950
951\noindent
952\textbf{Note:} images whose sizes are modified in this way may not
953be acceptable for
954\hyperref{image-recycling}{image-recycling, (see page~}{)}{recycling}.
955Instead they may need to be generated afresh on each run of \latextohtml{}
956through the same source document.
957%
958\end{itemize}
959
960\medskip\noindent
961In order to be effective the \Lc{htmlimage} command
962and its options must be placed \emph{inside the environment}
963on which it will operate.
964Environments for alignment and changing the font size do not
965generate images of their contents. Any \Lc{htmlimage}
966command may affect the surrounding environment instead;
967e.g. within a \env{table} or \env{figure} environment,
968but does not apply to a \env{minipage}.
969
970When the \Lc{htmlimage} command occurs in an inappropriate
971place, the following message is printed among the warnings
972at the end of processing.
973The actual command is shown, with its argument;
974also the environment name and identifying number, if there is one.
975%
976\begin{quote}
977\begin{small}
978\begin{verbatim}
979The command "\htmlimage" is only effective inside an environment
980which may generate an image (e.g. "{figure}", "{equation}")
981 center92: \htmlimage{ ... }
982\end{verbatim}
983\end{small}
984\end{quote}
985
986
987\subsubsection{An Embedded Image Example\index{images!embedded image}}%
988%\subsection{An Embedded Image Example\index{images!embedded image}}%
989%
990\index{thumbnail}\html{\\}%
991The effect of the \LaTeX{}  commands below can be seen in the
992\htmlref{thumbnail sketch of Figure}{fig:example} \ref{fig:example}.
993A~5\,pt border has also been added around the thumbnail,
994using \Lc{htmlborder} \htmlref{command}{htmlborder};
995this gives a pseudo-3D effect in some browsers.
996%begin{latexonly}
997\begin{small}
998%end{latexonly}
999\begin{verbatim}
1000\begin{figure}
1001    \htmlimage{thumbnail=0.5}
1002    \htmlborder{5}
1003    \centering \includegraphics[width=5in]{psfiles/figure.ps}
1004    \latex{\addtocounter{footnote}{-1}}
1005    \caption{A sample figure showing part of a page generated by
1006       \latextohtml{} containing a customised navigation panel
1007       (from the \htmladdnormallink
1008        {CSEP project\latex{\protect\footnotemark}}
1009        {http://csep1.phy.ornl.gov/csep.html}).}\label{fig:example}
1010\end{figure}
1011\latex{\footnotetext{http://csep1.phy.ornl.gov/csep.html}}
1012\end{verbatim}
1013%begin{latexonly}
1014\end{small}
1015%end{latexonly}
1016
1017\index{figures}%
1018\index{figure@\env{figure} environment}%
1019\index{environment!figure@\env{figure}}%
1020\index{Computer~Science~Education~Project!CSEP}%
1021\begin{figure}[hbt]
1022    \htmlimage{thumbnail=0.5}
1023    \htmlborder{5}
1024    \centering \includegraphics[width=5in]{psfiles/figure.ps}
1025    \latex{\addtocounter{footnote}{-1}}%
1026    \caption{A sample figure showing part of a page generated by
1027       \protect\latextohtml{} containing a customised navigation panel
1028       (from the \htmladdnormallink
1029        {CSEP project\protect\latex{\protect\footnotemark}}%
1030        {http://csep1.phy.ornl.gov/csep.html}).}\label{fig:example}
1031\end{figure}
1032\latex{\footnotetext{\protect\latex{http://csep1.phy.ornl.gov/csep.html}}}%
1033
1034\index{htmlimage@\Lc{htmlimage}!overrides configuration}%
1035
1036\noindent
1037The \Lc{htmlimage} command is also often useful to cancel-out the
1038effect of the configuration variable \fn{\$FIGURE\_SCALE\_FACTOR}.
1039For example to avoid resizing a color screen snap despite
1040the value of \fn{\$FIGURE\_SCALE\_FACTOR} it is possible to
1041use \verb|\htmlimage{scale=0}|\,.
1042
1043
1044\subsubsection{Image Sharing and Recycling\label{recycling}}%
1045%\subsection{Image Sharing and Recycling\label{recycling}}%
1046\index{images!recycling}\index{images!sharing}%
1047It is not hard too see how reasonably sized papers,
1048especially scientific articles, can require
1049the use of many hundreds of external images.  For this reason,
1050image sharing and recycling is of critical importance.
1051In this context, ``sharing'' refers to the use of one
1052image in more than one place in an article.  ``Recycling''
1053refers to the use of an image left over from a previous
1054run of \latextohtml.  Without this ability, every instance of an
1055image would have to be regenerated each time even the
1056slightest change were made to the document.
1057
1058\index{images!thumbnail}\index{thumbnail}%
1059\index{images!small images}%
1060\index{images!image-maps}%
1061\index{images!order-sensitive}%
1062\index{images!order-insensitive}%
1063\index{equations!array}%
1064\index{environment!\env{equation}}\index{environment!eqnarray@\env{eqnarray}}%
1065\index{eqnarray@\env{eqnarray} environment}\html{\\}%
1066%
1067All types of images can be shared.  These include ``small images''
1068and figures with or without \htmlref{thumbnails}{thumbnail}
1069and \htmlref{image-maps}{ImageMaps}.
1070Furthermore, most images can also be reused.  The only
1071exception are those which are \emph{order-sensitive},
1072meaning that their content depends upon their location.
1073Examples of order-sensitive images are \env{equation}
1074and \env{eqnarray} environments,
1075when \Cs{html\_version 2.0} has been specified;
1076this is because their figure numbers are part of the image.
1077
1078\index{figures!captions}%
1079\index{tables!captions}\html{\\}%
1080
1081Figures and tables with captions, on the other hand,
1082are order-insensitive because the figure numbers
1083are not part of the image itself.%
1084Similarly when \HTMLiii{} code is being produced, equation
1085numbers are no longer part of the image.
1086Instead they are placed in a separate cell of a \HTMLtag{TABLE}.
1087So most images of mathematical formulas can be reused also.%
1088
1089
1090\subsubsection{Quality of Printed Images\label{printqual}}
1091%\subsection{Quality of Printed Images\label{printqual}}
1092%
1093\begin{htmlonly}
1094Since it is often desirable to get a good quality print on paper
1095directly from the browser, \hyperref{here are}{Figure~}{ shows}{eq:pics15}
1096the same equations as \hyperref[page]{earlier}{on page~}{}{eq:pics}.
1097This time the `\texttt{extrascale=}' option has been used with a value of 1.5\,.
1098More than twice the number of pixels are available,
1099for a cost of approximately 1.7 times the disk-space\footnote{This figure
1100varies with the graphics format used, and the complexity of the actual image.}.
1101
1102\end{htmlonly}
1103
1104\begin{figure}[hb]
1105\begin{htmlonly}
1106\begin{makeimage}
1107\end{makeimage}
1108\begin{equation}
1109\htmlimage{no_antialias,extrascale=1.5}
1110\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
1111\frac{1}{2}h^2\frac{\partial^2\Phi}{\partial x^2} +
1112\frac{1}{6}h^3\frac{\partial^3\Phi}{\partial x^3} + \,\ldots\,\Bigr)_{l,m,n}
1113\end{equation}
1114\begin{eqnarray}
1115\htmlimage{extrascale=1.5}
1116\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
1117\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}} \nonumber \\
1118+ \frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}} = -I_{l,m,n}(v)
1119\end{eqnarray}
1120\end{htmlonly}
1121%
1122\begin{latexonly}
1123\begin{equation}
1124 \setbox1=\hbox{\scalebox{.4}{\includegraphics{psfiles/eqn15.ps}}}
1125 \lower.5\ht1\box1
1126\end{equation}%
1127\begin{eqnarray}
1128 \nonumber
1129 \setbox1=\hbox{\scalebox{.4}{\includegraphics{psfiles/eqarrA15.ps}}}
1130 \lower.5\ht1 \box1&&\\
1131 \setbox1=\hbox{\scalebox{.4}{\includegraphics{psfiles/eqarrB15.ps}}}
1132 \lower.5\ht1 \box1&&
1133\end{eqnarray}
1134\end{latexonly}
1135\caption{Displayed math environments with \emph{extra-scale} of 1.5}
1136\label{eq:pics15}%
1137\end{figure}
1138
1139\begin{latexonly}
1140\noindent
1141Since it is often desirable to get a good quality print on paper
1142directly from the browser, \hyperref{here are}{Figure~}{ shows}{eq:pics15}
1143the same equations as \hyperref[page]{earlier}{on page~}{}{eq:pics}.
1144This time the `\texttt{extrascale=1.5}' option has been used. This value of 1.5
1145means that more than twice the number of pixels are available,
1146for a cost of approximately 1.7 times the disk-space\footnote{This figure
1147varies with the graphics format used, and the complexity of the actual image.}.
1148\end{latexonly}
1149\noindent
1150On-screen these images appear slightly blurred or indistinct.
1151However there can be marked improvement in the print quality,
1152when printed from some browsers; others may show no improvement at all.
1153The ``anti-aliasing'' helps on-screen. In the printed version
1154jagged edges are indeed softened, but leave an overall fuzziness.
1155
1156
1157\hyperref{Here are}{Figure~}{ shows}{eq:pics2}
1158the same equations yet again; this time with `\texttt{extrascale=2.0}'.
1159Now there are 4~times the pixels at a cost of roughly 2.45~times the disk space.
1160Compared with the previous images (having 1.5~times extra-scaling),
1161there is little difference in the on-screen images.
1162Printing at 300\,dpi shows only a marginal improvement;
1163but at 600\,dpi the results are most satisfying, especially when
1164scaled to be comparable with normal 10\,pt type\latex{, as here}.
1165
1166\begin{figure}[ht]
1167\begin{htmlonly}
1168\begin{makeimage}
1169\end{makeimage}
1170\begin{equation}
1171\htmlimage{no_antialias,extrascale=2}
1172\Phi_{l+1,m,n} = \Bigl(\Phi+h\frac{\partial\Phi}{\partial x} +
1173\frac{1}{2}h^2\frac{\partial^2\Phi}{\partial x^2} +
1174\frac{1}{6}h^3\frac{\partial^3\Phi}{\partial x^3} + \,\ldots\,\Bigr)_{l,m,n}
1175\end{equation}
1176\begin{eqnarray}
1177\htmlimage{extrascale=2}
1178\frac{\Phi_{l+1,m,n}-2\Phi_{l,m,n}+\Phi_{l-1,m,n}}{h^{2}} +
1179\frac{\Phi_{l,m+1,n}-2\Phi_{l,m,n}+\Phi_{l,m-1,n}}{h^{2}} \nonumber \\
1180+ \frac{\Phi_{l,m,n+1}-2\Phi_{l,m,n}+\Phi_{l,m,n-1}}{h^{2}} = -I_{l,m,n}(v)\;.
1181\end{eqnarray}
1182\end{htmlonly}
1183%
1184\begin{latexonly}
1185\begin{equation}
1186 \setbox1=\hbox{\scalebox{.3}{\includegraphics{psfiles/eqn2.ps}}}
1187 \lower.5\ht1 \box1
1188\end{equation}
1189\begin{eqnarray}
1190 \nonumber
1191 \setbox1=\hbox{\scalebox{.3}{\includegraphics{psfiles/eqarrA2.ps}}}
1192 \lower.5\ht1 \box1&&\\
1193 \setbox1=\hbox{\scalebox{.3}{\includegraphics{psfiles/eqarrB2.ps}}}
1194 \lower.5\ht1 \box1&&
1195\end{eqnarray}
1196\end{latexonly}
1197\caption{Displayed math environments with \emph{extra-scale} of 2.0}
1198\label{eq:pics2}
1199\end{figure}
1200
1201
1202
1203\subsection{Figures, Tables and Arbitrary Images\label{sec:figs}}
1204%\section{Figures, Tables and Arbitrary Images\label{sec:figs}}
1205\index{tables}%
1206\index{environment!arbitrary}\index{arbitrary environments}\html{\\}%
1207This section is to explain how the translator handles figures, tables
1208and other environments.
1209Compare the paper with the online version.
1210
1211When the common version of \texttt{HTML} was only 2.0, then almost all
1212complicated environments were represented using images. However with
1213\texttt{HTML} 3.2, there is scope for sensible layout of tables,
1214and proper facilities for associating a caption with a figure or table.
1215To take advantage of this, the \env{figure} environment now has its
1216contents placed within \HTMLtag{TABLE} tags; any caption is placed
1217as its \HTMLtag{CAPTION}.
1218
1219For consistency with former practice, the contents of the \env{figure}
1220environment are usually represented by generating an image.
1221This is frequently exactly what is required; but not always.
1222\hyperref[page]{In another section}{On page~}{}{makeimage} it is
1223described how to use the \env{makeimage} environment,
1224defined in the \fn{html.sty} package, to determine just which parts (if any)
1225of a \env{figure} environment's contents should be made into images,
1226the remainder being treated as ordinary text, etc.
1227
1228\medskip
1229\index{table@\env{table} environment}%
1230\index{environment!table@\env{table}}\html{\\}%
1231\paragraph*{\env{table} and \env{tabular} environments.}
1232
1233Similarly the \env{makeimage} environment can be used within
1234a \env{table}, though usually this is used with a \env{tabular}
1235or other table-making environment, such as \env{tabbing} or
1236\env{longtable} or \env{supertabular}.
1237Here is a simple example, from the \LaTeX{} \htmlcite{`blue book'}{lamp:latex}.
1238
1239\begin{table}[hbt]
1240\begin{center}
1241\begin{tabular}{||l|lr||}   \hline
1242gnats   &       gram    &       \$13.65  \\ \cline{2-3}
1243        &       each    &        .01    \\ \hline
1244gnu     &       stuffed &        92.50
1245                \\  \cline{1-1} \cline{3-3}
1246emur    &               &       33.33   \\ \hline
1247armadillo       & frozen        &       8.99 \\ \hline
1248\end{tabular}
1249\caption{A sample table taken from \protect\cite{lamp:latex}%}
1250\index{table@\env{table} environment}%
1251\index{environment!table@\env{table}}}%
1252\label{tab}
1253\end{center}
1254\end{table}
1255
1256\begin{htmlonly}
1257When using \texttt{ -html\_version 2.0} to get code compatible
1258with the \texttt{HTML} 2.0 standard, an image is made of the
1259table, as follows:
1260%
1261\begin{table}[ht]
1262\begin{center}
1263\begin{makeimage}
1264\begin{tabular}{||l|lr||}   \hline
1265gnats   &       gram    &       \$13.65  \\ \cline{2-3}
1266        &       each    &        .01    \\ \hline
1267gnu     &       stuffed &        92.50
1268                \\  \cline{1-1} \cline{3-3}
1269emur    &               &       33.33   \\ \hline
1270armadillo       & frozen        &       8.99 \\ \hline
1271\end{tabular}
1272\end{makeimage}
1273\caption{Alternate view of the table from \protect\cite{lamp:latex}}
1274\label{tab:alt}
1275\end{center}
1276\end{table}
1277\end{htmlonly}
1278%
1279%begin{latexonly}
1280\noindent
1281Table~\ref{tab:alt} is a screen-shot of how the resulting table appears on-screen,
1282using a typical browser supporting \HTMLiii.
1283Here it is scaled down by 70\% to compensate for the 14\,pt fonts being used when
1284the screen-shot was taken.
1285%
1286\begin{table}[ht]
1287\begin{center}
1288 \scalebox{.7}{\includegraphics{psfiles/table.ps}}
1289\caption{Alternate view of the table from \protect\cite{lamp:latex}}
1290\label{tab:alt}
1291\end{center}
1292\end{table}
1293%end{latexonly}
1294
1295\medskip
1296\index{minipage@\env{minipage} environment}%
1297\index{environment!minipage@\env{minipage}}\html{\\}%
1298\paragraph*{\env{minipage} environments.}
1299
1300The special feature of \env{minipage} environments is in the
1301way \Lc{footnote} and \Lc{footnotemark} commands are handled.
1302These are numbered separately from the rest of the footnotes
1303throughout the document, and the notes themselves are collected together
1304to be displayed at the end of the \env{minipage}'s contents.
1305
1306\medskip
1307\begin{minipage}{.9\textwidth}
1308%begin{latexonly}
1309\renewcommand{\thempfootnote}{\alph{mpfootnote}}
1310%end{latexonly}
1311\begin{tabular}{|l|l|} \hline
1312\textbf{Variable} & \textbf{Meaning} \\ \hline
1313none      & none                   \\
1314Jacobi    & $m$-step Jacobi iteration\footnote[1]{one footnote} \\
1315SSOR      & $m$-step SSOR iteration\footnotemark[1] \\
1316IC        & Incomplete Cholesky factorization\footnote[2]{another footnote} \\
1317ILU       & Incomplete LU factorization\footnotemark[2] \\ \hline
1318\end{tabular}
1319\end{minipage}
1320
1321\bigskip\noindent
1322The code used for this example was as follows\footnote{%
1323Thanks to John Turner \Email{turner@lanl.gov} for this example,
1324which was used in developing
1325code to handle \env{minipage} environments correctly.}
1326%begin{latexonly}
1327\begin{small}
1328%end{latexonly}
1329\begin{verbatim}
1330\begin{minipage}{.9\textwidth}
1331\renewcommand{\thempfootnote}{\alph{mpfootnote}}
1332\begin{tabular}{|l|l|} \hline
1333\textbf{Variable} & \textbf{Meaning} \\ \hline
1334none      & none                   \\
1335Jacobi    & $m$-step Jacobi iteration\footnote[1]{one footnote} \\
1336SSOR      & $m$-step SSOR iteration\footnotemark[1] \\
1337IC        & Incomplete Cholesky factorization\footnote[2]{another footnote} \\
1338ILU       & Incomplete LU factorization\footnotemark[2] \\ \hline
1339\end{tabular}
1340\end{minipage}
1341\end{verbatim}
1342%begin{latexonly}
1343\end{small}
1344%end{latexonly}
1345
1346\bigskip\noindent
1347\textbf{Warning: }
1348With some figures, especially when containing graphics imported using
1349\Lc{includegraphics} or other special macros, the background color
1350may come out as a shade of grey, rather than white or transparent.
1351This is due to a setting designed to enhance anti-aliasing of text
1352within images; e.g. for mathematics.
1353To alleviate this possible problem, the \Cs{white} command-line option
1354can be used, to ensure a white background for images of \env{figure}
1355environments.
1356Alternatively, set the \fn{\$WHITE\_BACKGROUND}
1357\hyperref{variable}{variable (see section }{)}{cs_white}.
1358
1359
1360\subsection{Document Classes and Options\label{sec:cls}}
1361\tableofchildlinks*
1362\index{document class}%
1363In general the standard \LaTeX{} document-classes:
1364\texttt{article}, \texttt{report}, \texttt{book}, \texttt{letter}, \texttt{slides}
1365are translated by \latextohtml{} in the same way.
1366Currently the only real difference is with the display of section-numbering,
1367when the \htmlref{\Cs{show\_section\_numbers}}{showsecnums} switch is used,
1368and when numbering of \htmlref{theorem-like environments}{theoremenvs}
1369is linked to section-numbering.
1370
1371\index{document class!loads file@loads a \texttt{.perl} file}%
1372\index{document class!options}%
1373
1374These differences are achieved using a mechanism that automatically loads a file:
1375\fn{article.perl}, \fn{report.perl}, \fn{book.perl}, \fn{letter.perl}, \fn{slides.perl}
1376according to the requested document-class.
1377These files contain \Perl{} code and are located in the \fn{styles/} directory.
1378If a file of the same name exists in the working directory, this will be loaded
1379instead.
1380
1381Typically such files \texttt{\Meta{class}.perl} contain code to define subroutines
1382or sets values for variables that will affect how certain translations are performed.
1383There can be code that is executed only when specific class-options are specified
1384along with the chosen document-class.
1385For example, the \fn{foils.perl} implementation of \FoilTeX's \env{foils} class
1386defines code create a new sub-section for each `foil'.
1387It also has code which allows \latextohtml{} to ignore those of \FoilTeX's special
1388formatting commands that have no relevance when constructing an \texttt{HTML} page.
1389
1390\medskip
1391\index{document class!loads file}%
1392\index{class-option!loads file}%
1393
1394Any options given on the \Lc{documentclass} or \Lc{documentstyle} line
1395may also cause a file containing \Perl{} code to be loaded.
1396Such a file is named \texttt{\Meta{option}.perl} for the appropriate \Meta{option}.
1397When such a file exists, in the local directory or in the \fn{styles/} directory,
1398it typically contains \Perl{} code to define subroutines or set values for variables
1399that will affect how certain translations are performed.
1400There can be code that is executed only for specific document-classes.
1401
1402Since the files for class-options are loaded after those for the document-class,
1403it is possible for the \texttt{\Meta{option}.perl} file to contain code that overrides
1404settings made within the document-class file.
1405
1406\medskip\index{class-option!specific file}%
1407If a file named \texttt{\Meta{class}\_\Meta{option}.perl} happens to exist for
1408a given combination of document-class \Meta{class} and class-option \Meta{option},
1409then this will be loaded.
1410When such a file exists, reading and executing its contents is done,
1411rather than executing any \Meta{class}\_\Meta{option} specific information
1412that may be contained in  \texttt{\Meta{class}.perl} or \texttt{\Meta{option}.perl}~.
1413
1414\medskip
1415Currently there are no special option or class-option files provided with
1416the \latextohtml{} distribution. It is hoped that users will identify ways
1417that specific features can be improved or adapted to specific classes of documents,
1418and will write such files themselves, perhaps submitting them for general distribution.
1419
1420\bigskip
1421\textbf{Note: }
1422This mechanism for handling code specific to different document classes
1423and class-options is more general than that employed by \LaTeXe.
1424New options can be defined for document-classes generally, or for specific classes,
1425without the need to have corresponding \texttt{.sty} or \texttt{.clo} files.
1426\LaTeX{} simply notes the existence of unusupported options---processing is not
1427interrupted.
1428
1429
1430
1431\subsection{Packages and Style-Files\label{sec:sty}}
1432%\section{Packages and Style-Files\label{sec:sty}}
1433\tableofchildlinks*
1434\index{support!for specific style-files}%
1435\index{support!for german language}\html{\\}%
1436%
1437Similar to the document-class mechanism described in
1438\hyperref{the previous section}{Section}{}{sec:cls},
1439\latextohtml{} provides a mechanism whereby the code to translate specific
1440packages and style-files is auto\-matic\-ally loaded, if such code is available.
1441For example, when use of a style such as \fn{german.sty}
1442is detected in a \LaTeX{} source document, either by
1443\begin{itemize}
1444\item
1445a \Lc{usepackage} command of \LaTeXe;
1446\item
1447an option to the \Lc{documentstyle} command of \LaTeX\,2.09\,;
1448\item
1449an explicit \Lc{input} or \Lc{include} command;
1450\end{itemize}
1451the translator looks for a corresponding \texttt{.perl} file
1452having the same file-name prefix;
1453e.g. the file \fn{\$LATEX2HTMLDIR/styles/german.perl}.
1454If such a \texttt{.perl} file is found,
1455then its code will be incorporated with the main script,
1456to be used as required.
1457
1458\index{extensions!examples}\html{\\}%
1459
1460This mechanism helps to keep the core script smaller, as well as making
1461it easier for others to contribute and share solutions on
1462how to translate specific style-files.
1463The current distribution includes the files to support the styles
1464listed in \hyperref{the table below}{Table~}{}{styles}.
1465These provide good examples of how you can create
1466further extensions to \latextohtml.%
1467
1468\index{style-files}\index{packages}%
1469%\begin{htmlonly}
1470%\begin{table}
1471%\end{htmlonly}
1472\begin{center}
1473%\begin{tabular}{|c|p{3in}|}
1474\begin{longtable}{|c|l|}
1475\caption{Supported \protect\latextohtml\ packages and style-files.}
1476\\\hline
1477\endhead
1478\hline
1479\endfoot
1480\label{styles}
1481\texttt{.perl}~file &\hfill\textbf{Description}\hfill\hfill~\\\hline
1482\env{\bf alltt}\index{environment!alltt@\env{alltt}}\index{alltt@\env{alltt} environment}%
1483 & Supports the \LaTeXe's \env{alltt} package.\label{alltt}\\
1484\env{\bf amsfonts}\index{package!AMSfonts@\env{amsfonts}}\index{AMS@\AmS-\LaTeX!amsfonts@\env{amsfonts} package}%
1485 & provides recognition of the special \AmS\ font symbols.\label{amsfonts}\\
1486\env{\bf amsmath}\index{package!AMSmath@\env{amsmath}}\index{AMS@\AmS-\LaTeX!amsmath@\env{amsmath} package}%
1487 & same as \fn{amstex.perl}.\label{amsmath}\\
1488\env{\bf amssymb}\index{package!AMSsymb@\env{amssymb}}\index{AMS@\AmS-\LaTeX!amssymb@\env{amssymb} package}%
1489 & same as \fn{amsfonts.perl}.\label{amssymb}\\
1490\env{\bf amstex}\index{package!AMStex@\env{amstex}}\index{AMS@\AmS-\LaTeX!amstex@\env{amstex} package}%
1491 & Supports much of the \AmS-\LaTeX{} package (not yet complete).\label{amstex}\\
1492\env{\bf babel}\index{package!babel@\env{babel}}\index{babel@\env{babel} package}%
1493 & Interface to \fn{german.perl} via the \env{babel} package.\label{babel}\\
1494\env{\bf changebar}\index{package!changebar@\env{changebar}}\index{changebar@\env{changebar} package}%
1495 & Provides rudimentary change-bar support.\label{changebar}\\
1496\env{\bf chemsym}\index{package!chemsym@\env{chemsym}}\index{chemsym@\env{chemsym} package}%
1497 & defines the standard atomic symbols.\label{chemsym}\\
1498\env{\bf color}\index{package!color@\env{color}}\index{color@\env{color} package}%
1499 & Causes colored text to be processed as ordinary text by \latextohtml.\label{color}\\
1500\env{\bf colordvi}\index{package!colordvi@\env{colordvi}}\index{color!colordvi@\env{colordvi} package}%
1501 & supports the Crayola colors.\label{crayola}\\
1502\env{\bf enumerate}\index{package!enumerate@\env{enumerate}}\index{enumerate@\env{enumerate} package}%
1503 & supports structured labels for \env{enumerate} environments.\label{enumerate}\\
1504\env{\bf epsbox}\index{package!epsbox@\env{epsbox}}\index{epsbox@\env{epsbox} package}%
1505 & Processes embedded figures not enclosed in a \env{figure} environment.\label{epsbox}\\
1506\env{\bf epsfig}\index{package!epsfig@\env{epsfig}}\index{epsfig@\env{epsfig} package}%
1507 & Processes embedded figures not enclosed in a \env{figure} environment.\label{epsfig}\\
1508\env{\bf finnish}\index{package!finnish@\env{finnish}}\index{finnish!finnish@\env{finnish} package}%
1509 & Support for the Finnish language.\label{finnish}\\
1510\env{\bf floatfig}\index{package!floatfig@\env{floatfig}}\index{floatfig@\env{floatfig} package}%
1511 & Processes floating figures.\label{floatfig}\\
1512\env{\bf floatflt}\index{package!floatflt@\env{floatflt}}\index{floatflt@\env{floatflt} package}%
1513 & Processes floating figures and tables.\label{floatflt}\\
1514\env{\bf foils}\index{class!foils@\env{foils}}\index{foils@\env{foils} class}\index{FoilTeX@\FoilTeX}%
1515 & Supports \FoilTeX{} system.\label{foils}\\
1516\env{\bf frames}\index{package!frames@\env{frames}}\index{frames@\env{frames} package}%
1517 & Provides separate frames for navigation and footnotes.\label{frames}\\
1518\env{\bf francais}\index{package!francais@\env{francais}}\index{french!francais@\env{francais} package}%
1519 & Support for the French language, same as \fn{french.perl}.\label{francais}\\
1520\env{\bf french}\index{package!french@\env{french}}\index{french@\env{french} package}%
1521 & Support for the French language.\label{french}\\
1522\env{\bf german}\index{package!german@\env{german}}\index{german@\env{german} package}%
1523 & Support for the German language.\label{german}\\
1524\env{\bf germanb}\index{package!germanb@\env{germanb}}\index{german!germanb@\env{germanb} package}%
1525 & Support for the German language, same as \fn{german.perl}.\label{germanb}\\
1526\env{\bf graphics}\index{package!graphics@\env{graphics}}\index{graphics@\env{graphics} package}%
1527 & Supports commands in the \env{graphics} package.\label{graphics}\\
1528\env{\bf graphicx}\index{package!graphicx@\env{graphicx}}\index{graphics!graphicx@\env{graphicx} package}%
1529 & Supports the alternate syntax of graphics commands.\label{graphicx}\\
1530\env{\bf harvard}\index{package!harvard@\env{harvard}}\index{citations!harvard@\env{harvard} package}%
1531 & Supports the \env{harvard} style of \htmlref{citation}{harvard} (same as fn{nharvard.perl}).\\
1532\env{\bf heqn}\index{package!heqn@\env{heqn}}\index{heqn@\env{heqn} package}%
1533 & Alters the way displayed equations are processed.\label{heqn}\\
1534\env{\bf hthtml}\index{environment!hthtml@\env{hthtml}}\index{hthtml@\env{hthtml} environment}%
1535 & gives an alternative syntax for specifying hyperlinks, etc.\label{hthtml}\\
1536\env{\bf htmllist}\index{environment!htmllist@\env{htmllist}}\index{htmllist@\env{htmllist} environment}%
1537 & Provides support for \htmlref{fancy lists}{htmllist}.\\
1538\env{\bf justify}\index{package!justify@\env{justify}}\index{justify@\env{justify} package}%
1539 & supports paragraph alignment---no longer needed.\\
1540\env{\bf latexsym}\index{package!latexsym@\env{latexsym}}\index{latexsym@\env{latexsym} package}%
1541 & supports the \LaTeX{} symbol font.\label{latexsym}\\
1542\env{\bf lgrind}\index{package!lgrind@\env{lgrind}}\index{lgrind@\env{lgrind} package}%
1543 & macros for nice layout of computer program code.\label{lgrind}\\
1544\env{\bf longtable}\index{package!longtable@\env{longtable}}%
1545\index{tables!longtable@longtable\env{longtable} package}%
1546 & supports use of long tables, as a single table.\label{longtable}\\
1547\env{\bf makeidx}\index{package!makeidx@\env{makeidx}}\index{makeidx@\env{makeidx} package}%
1548 & provides more sophisticated indexing.\label{makeidx}\\
1549\env{\bf multicol}\index{package!multicol@\env{multicol}}\index{columns!multicol@\env{multicol} package}%
1550 & suppresses requests for multi-columns.\label{multicol}\\
1551\env{\bf natbib}\index{package!natbib@\env{natbib}}\index{citations!natbib@\env{natbib} package}%
1552 & Supports many different styles for citations and bibliographies.\label{natbib}\\
1553\env{\bf nharvard}\index{package!nharvard@\env{nharvard}}\index{citations!nharvard@\env{nharvard} package}%
1554 & Supports harvard-style citations, using \env{natbib}.\label{nharvard}\\
1555\env{\bf seminar}\index{package!seminar@\env{seminar}}\index{seminar@\env{seminar} package}%
1556 & for creation of overhead-presentation slides.\label{seminar}\\
1557\env{\bf spanish}\index{package!spanish@\env{spanish}}\index{spanish@\env{spanish} package}%
1558 & Support for the Spanish language.\label{spanish}\\
1559\env{\bf supertabular}\index{package!supertabular@\env{supertabular}}\index{tables!supertabular@\env{supertabular} package}%
1560 & supports use super-tables, as an ordinary table.\label{supertabular}\\
1561\env{\bf texdefs}\index{package!texdefs@\env{texdefs}}\index{texdefs@\env{texdefs} package}%
1562 & Supports some raw \TeX{} commands.\label{texdefs}\\
1563\env{\bf verbatim}\index{package!verbatim@\env{verbatim}}\index{verbatim@\env{verbatim} package}%
1564 & Supports verbatim input of files.\label{verbatim}\\
1565\env{\bf verbatimfiles}\index{package!verbatimfiles@\env{verbatimfiles}}\index{verbatim!verbatimfiles@\env{verbatimfiles} package}%
1566 & Supports verbatim input of files, also with line-numbering.\label{verbatimfiles}\\
1567\env{\bf wrapfig}\index{package!wrapfig@\env{wrapfig}}\index{figures!wrapfig@\env{wrapfig} package}%
1568 & Supports wrapped figures.\label{wrapfig}\\
1569\env{\bf xspace}\index{package!xspace@\env{xspace}}\index{xspace@\env{xspace} package}%
1570 & Supports use of the \env{xspace} package and \Lc{xspace} command.\label{xspace}\\
1571\env{\bf xy}\index{package!xypic@\protect\Xy-pic}\index{xypic@\protect\Xy-pic package}%
1572\index{graphics!xy@\protect\Xy-pic package}%
1573 & Supports use of the \Xy-pic graphics package.\label{xypic}\\
1574%\hline
1575\end{longtable}
1576%\end{tabular}
1577\end{center}
1578%\begin{htmlonly}
1579%\end{table}
1580%\end{htmlonly}
1581%\end{table}
1582\index{extensions!require understanding@require understanding of \Perl{}}\html{\\}%
1583\noindent
1584The problem however, is that writing such extensions requires an understanding
1585of \Perl{} programming and of the way the processing in \latextohtml{} is organised.
1586Interfaces that are more ``user-friendly'' are being investigated.
1587Some of the techniques currently used are explained in
1588\hyperref{a later section}{Section~}{}{sec:ext}.
1589
1590
1591\subsubsection{Fancy List-Markers\label{htmllist}}
1592%\subsection{Fancy List-Markers\label{htmllist}}
1593\index{htmllist@\env{htmllist} environment}%
1594\index{environment!htmllist@\env{htmllist}}%
1595%
1596An optional style-file \fn{htmllist.sty} has been provided which
1597produces fancier lists in the electronic version of the document%
1598\html{, }\htmlref{such as this}{listExample}.
1599This file defines a new \LaTeX{} environment \env{htmllist},
1600which causes a user-defined item-mark to be placed at each new
1601item of the list, and which causes the optional description
1602to be displayed in bold letters.
1603\begin{changebar}
1604The filename prefix for the item-mark image can be given as an
1605optional parameter; see example below. The images distributed with
1606\latextohtml{} for this purpose are listed with the description
1607of the \verb|\htmlitemmark| command, which provides an alternative
1608means of choosing the item-mark, and allows the image to be changed
1609for different items in the list.
1610\end{changebar}
1611
1612\index{htmlitemmark@\Lc{htmlitemmark}}%
1613\index{htmllist@\env{htmllist}!prints as@prints as \env{description}}%
1614\index{htmllist@\env{htmllist}!item-marks}%
1615\index{environment!htmllist@\env{htmllist}}\html{\\}%
1616%
1617The mark is determined
1618by the \verb|\htmlitemmark{|\Meta{item-mark}\verb|}| command.
1619This command accepts either a mnemonic name for the \Meta{item-mark},
1620from a list of icons established at installation, or the URL of a mark
1621not in the installation list.
1622The command \Lc{htmlitemmark} must be used \emph{inside} the
1623\env{htmllist} environment in order to be effective,
1624and it may be used more than once to change the mark within the list.
1625The item-marks supplied with \latextohtml{} are
1626\texttt{BlueBall}, \texttt{RedBall}, \texttt{OrangeBall}, \texttt{GreenBall},
1627\texttt{PinkBall}, \texttt{PurpleBall}, \texttt{WhiteBall} and \texttt{YellowBall}.
1628The \env{htmllist} environment is identical to
1629the \env{description} environment in the printed version.
1630
1631\index{htmllist@\env{htmllist}!example}%
1632
1633\noindent
1634An example of its usage is:
1635%begin{latexonly}
1636\begin{small}
1637%end{latexonly}
1638\begin{verbatim}
1639\begin{htmllist}[WhiteBall]
1640\item[Item 1:] This will have a white ball.
1641\item[Item 2:] This will also have a white ball.
1642\htmlitemmark{RedBall}%
1643\item[Item 3:] This will have a red ball.
1644\end{htmllist}
1645\end{verbatim}
1646%begin{latexonly}
1647\end{small}
1648%end{latexonly}
1649
1650\noindent This will produce:\label{listExample}
1651\begin{htmllist}[WhiteBall]
1652%begin{latexonly}
1653\addtolength{\leftskip}{15pt}
1654%end{latexonly}
1655\item[Item 1:] This will have a white ball.
1656\item[Item 2:] This will also have a white ball.
1657\htmlitemmark{RedBall}%
1658\item[Item 3:] This will have a red ball.
1659\end{htmllist}
1660
1661\index{floatfig@\env{floatingfigure} environment}%
1662\index{wrapfig@\env{wrapfigure} environment}%
1663\index{environment!floatingfigure@\env{floatingfigure}}%
1664\index{environment!wrapfigure@\env{wrapfigure}}\html{\\}%
1665\noindent
1666One can also obtain \LaTeXe\ style-files \fn{floatfig.sty} and
1667\fn{wrapfig.sty}, which provide support for the \env{floatingfigure}
1668and \env{wrapfigure} environments, respectively.  These environments
1669allow text to wrap around a figure in the printed version,
1670but are treated exactly as an ordinary \env{figure}s in the electronic version.
1671They are described in \hypercite{The \LaTeX{} Companion}%
1672{\emph{The \LaTeX{} Companion}}{}{goossens:latex}.%
1673
1674\subsubsection{Support for \FoilTeX\label{sec:foils}}
1675\index{foils@\env{foils} class}%
1676\index{FoilTeX@\FoilTeX} The \FoilTeX{} system presents some
1677additional problems for \latextohtml:
1678\begin{itemize}
1679\item It has additional commands like \Lc{foilhead} and
1680  \Lc{rotatefoilhead}, that roughly correspond to sectioning commands,
1681\item The images are produced at the sizes suitable for large screen
1682  presentation, but not for the HTML.
1683\end{itemize}
1684The package \fn{foils.perl} deals with these problems. It treats foils as
1685starred subsections and ignores \FoilTeX-specific commands that have no
1686meaning for HTML, like \Lc{LogoOn}. The header
1687\Lc{documentclass[}+\texttt{\it options}\verb+]{foils}+ in the
1688\fn{images.tex} file is substituted by the header
1689\Lc{documentclass[}\fn{\$FOILOPTIONS}\verb+]{+\fn{\$FOILCLASS}\verb+}+,
1690where the variables \fn{\$FOILOPTIONS} and \fn{\$FOILCLASS} can be set
1691in the configuration file (by default they are \texttt{'10pt'} and
1692\texttt{'article'} correspondingly).
1693A further variable \fn{\$FOILHEADLEVEL} holds the level of sectioning
1694at which a `foil' is to correspond; the default level is 4 (sub-section).
1695
1696The \LaTeX{} style file \fn{foilhtml.sty} in the \fn{texinputs/}
1697directory provides some additional features for \FoilTeX{}. It implements
1698structural markup commands like \Lc{section},
1699\Lc{tableofcontents} for foils. See the directory \fn{docs/foilhtml/} for
1700the details.
1701
1702
1703
1704\subsubsection{Indicating Differences between Document Versions\index{change-bars}}%
1705%\subsection{Indicating Differences between Document Versions\index{change-bars}}%
1706\latextohtml{} supports the \LaTeXe\ \fn{changebar.sty} package,
1707written by Johannes Braams \Email{JLBraams@cistron.nl}, for
1708inserting \emph{change-bars} in a document in order to indicate
1709differences from previous versions. This is a very primitive form of
1710version control and there is much scope for improvement.
1711
1712\index{change-bars!different versions}%
1713Within the \LaTeX{} version of this manual two thicknesses of change-bar
1714have been used. Thicker bars indicate changes introduced with version \textsc{v97.1}\,,
1715while thinner bars indicate earlier additions since \textsc{v96.1}\,.\html{\\}
1716Within the \texttt{HTML} version the change-bars clearly indicate the
1717different revisions with explicit numbering.%
1718Within the \texttt{HTML} version, the graphic icons representing
1719the changebars can be followed by some text indicating the new version.
1720This is used repeatedly throughout\latex{ the online version of}
1721this manual. It is achieved using the command
1722\verb|\cbversion{|\Meta{version}\verb|}|, immediately following
1723the \verb|\begin{changebar}|.
1724This sets a variable \fn{\$cb\_version} to be used both at the beginning
1725and end of the environment. The value of this variable is retained,
1726to be used with other \env{changebar} environments, unless changed explicitly
1727by another occurrence of \fn{\$cb\_version}.
1728
1729\smallskip\noindent
1730\textbf{Warning: }
1731\latextohtml{} will not correctly process \env{changebar} environments
1732that contain sectioning commands, even when the (sub)sections or
1733(sub)paragraphs are to occur on the same \texttt{HTML} page.
1734If this is required, use a separate \env{changebar} environment
1735within each (sub)section or (sub)paragraph.
1736
1737
1738
1739
1740\subsection{Indexing\label{index}\index{index|(}}%
1741%\section{Indexing\label{index}\index{index|(}}%
1742\index{index!section-names}%
1743\latextohtml{} automatically produces an Index consisting of the
1744arguments to all \Lc{index} commands encountered, if there are any.
1745A hyperlink is created to that point in the text where the
1746\Lc{index} command occurred.
1747
1748More sophisticated indexing is available by loading the \env{makeidx} package.
1749Most of the features described in \cite[Appendix~A]{lamp:latex} become available.
1750This includes:
1751%
1752\begin{htmllist}\htmlitemmark{RedBall}%
1753\index{index!styled entries}%
1754\item
1755[styled entries, using `\texttt{@}' : ]
1756Entries of the form \verb|\index{|\Meta{sort-key}\verb|@|\Meta{styled-text}\verb|}|
1757produce \Meta{styled-text} as the entry, but sorted according to \Meta{sort-key}.
1758
1759\index{index!hierarchical}%
1760\item
1761[hierarchical entries, using `\texttt{!}' : ]
1762Entries of the form
1763\verb|\index{|\Meta{item}\verb|!|\Meta{sub-item}\verb|}|
1764set the \Meta{sub-item} indented below the \Meta{item}.
1765Unlimited levels of hierarchy are possible,
1766even though \LaTeX{} is limited to only 3 levels.
1767The \Meta{sort-key}\verb|@|\Meta{styled-text} can be used at each level.
1768
1769\index{index!page-ranges}%
1770\item
1771[explicit ranges, using `\texttt{|(}' and `\texttt{|)}' : ]
1772This is perhaps more useful in the \LaTeX{} version.
1773In the \texttt{HTML} version these simply insert words ``from'' and ``to'',
1774respectively, prior to the hyperlink to where the index-entry occurs.
1775
1776\index{index!cross-link}%
1777\index{index!see@\texttt{\char124see}}%
1778\item
1779[\texttt{|see\char123}\Meta{index-entry}\texttt{\char125} : ]
1780provides a textual reference to another indexed word or phrase,
1781by inserting the word ``see''.
1782This can be used in conjunction with \Lc{htmlref} to create a hyperlink
1783to the \Meta{index-entry}; viz.
1784\begin{verbatim}
1785\index{latexe@\LaTeXe |see{\htmlref{\LaTeX}{IIIlatex}}}
1786\end{verbatim}
1787where a \Lc{label} has been specified in some other index-entry, as follows:
1788\begin{verbatim}
1789\index{latex@\LaTeX\label{IIIlatex}}
1790\end{verbatim}
1791
1792\index{index!emph@\texttt{\char124emph}}%
1793\item [\texttt{|emph} : ]
1794\strikeout{is recognised but \emph{ignored};
1795other \texttt{|\Meta{command}} commands are \emph{not} processed by \latextohtml{},
1796with the following exception\dots} is handled correctly, by applying
1797\Lc{emph} to the text of the generated hyperlink.
1798
1799\index{index!style@\texttt{\char124}\Meta{style}}%
1800\item [\texttt{|}\Meta{style} : ]
1801where \Meta{style} is the name of \LaTeX{} style-changing command,
1802without the initial `\Lc{}'; e.g. `\texttt{emph}', `\texttt{textbf}',
1803`\texttt{textit}', etc. The corresponding \LaTeX{} command is applied
1804to the text of the generated hyperlink.
1805
1806\index{index!blank lines}%
1807\index{index!alphabetization}%
1808\item [blank lines and alphabetization: ]
1809Having precisely a single space-character after the \verb+|+
1810(e.g. \verb+\index{A| }+)
1811places a blank line before the index entry and omits the hyperlink.
1812This is used mainly for visual formatting; it allows a break before the entries
1813starting with each letter, say. Using a printable-key, as in \verb+\index{Q@Q, R| }+,
1814is appropriate when there are no indexed words starting with `Q', say.
1815
1816\index{index!quoted delimiters}%
1817\item [quoted delimiters: ]
1818The three special delimiters can be used within the printable portion,
1819if preceded by the double-quote character: \verb+"@+, \verb+"|+, \verb+"!+
1820and also \verb+""+ for the quote character itself.
1821Also \verb|\"| produces an umlaut accent on the following character,
1822when appropriate, else is ignored.
1823%
1824\end{htmllist}%
1825
1826\index{index!cross-link}%
1827\index{index!labelled entries}\html{\\}\noindent
1828%
1829Furthermore, the printable part of an index entry can contain \texttt{HTML}
1830anchors; that is, hyperlinks and/or \verb|\label{...}|s.
1831This allows index entries to contain cross-links to other entries, for example,
1832as well as allowing index-entries to be the target of hyperlinks from elsewhere
1833within the document.
1834
1835The \htmlref{next section}{glossind} describes how this feature is used within this
1836manual to create a Glossary, containing a short description of all file-names,
1837configuration-variables and application software mentioned within the manual,
1838integrated with the Index. All occurrences of the technical names can be
1839easily found, starting from any other.
1840
1841\index{index!labelled entries}
1842
1843When a single item is indexed many times, it is sufficient
1844to have a \Lc{label} command appearing within the printable portion
1845of the first instance of an \verb|\index{...}| command for that item,
1846within a single document segment.
1847
1848\medskip
1849
1850If the index-entries are in different segments of a segmented document,
1851it is sufficient to have the  \verb|\index{...@...\label{...}}| appearing
1852within that segment, in which the item is indexed, whose indexing information
1853is loaded earliest via a \verb|\internal[index]{...}| command.
1854When in doubt, include one \verb|\index{...@...\label{...}}| per segment
1855in which the item is indexed.
1856
1857\index{index!cross-link}%
1858\index{index!cross-link incorrect}
1859
1860For cross-links to work effectively within segmented documents,
1861the indexing command
1862\verb|\index{...@...\label{...}}| \emph{must} occur earlier
1863in the same segment than any use of
1864\verb|\index{...@...\htmlref{...}{...}}|
1865intended to create a link to that label.
1866If the \Lc{label} occurs in a different segment,
1867then a \verb|\internal[index]{...}| command for that segment,
1868may be needed at the beginning of the segment with the \Lc{htmlref}\,.
1869When this is done incorrectly, the resulting link will be to the
1870segment where the indexed item occurred,
1871rather than staying within the Index.
1872
1873\htmlrule
1874\index{index!section-names}%
1875\index{index!cumbersome}%
1876
1877\noindent
1878Since use of section-names, as the text for hyperlinks, can lead to a very long
1879and cumbersome Index, especially when single items have been indexed many times,
1880a further feature is provided to obtain a more compact Index.
1881
1882\index{index!codified links}\html{\\}%
1883Use of the command-line option \Cs{short\_index} causes a codified
1884representation of the sectioning to be used, rather than the full section-name.
1885The differences are as follows.
1886%
1887\begin{itemize}
1888%
1889\item
1890For example, `\texttt{2.1}' means sub-node~\#1 of node~\#2,
1891viewing the entire document as a tree-like structure.
1892
1893\index{index!codified links!top-most node}%
1894\item
1895The top-most node is simply denoted `\verb|^|'.
1896
1897\index{segmentation!child-links}%
1898\index{segmentation!codified index}%
1899\item
1900With a \htmlref{segmented document}{Segmentation},
1901each segment is codified separately
1902using the \htmlref{\Meta{prefix}}{prefix} supplied for that segment.
1903The Index includes a legend of these prefixes,
1904each giving the title of the leading page from the segment,
1905as a hyperlink to the place on that page where its
1906child-links are displayed.
1907
1908\index{index!codified links!for easier browsing}%
1909\item
1910Hyperlinks start on the same line as the index-key,
1911rather than the next line, separated by `\texttt{|}'.
1912This gives further compactification for easier browsing.
1913
1914\index{index!with prefix@with \Meta{prefix}}%
1915\item
1916If \Cs{prefix \Meta{prefix}} has been specified, then the \Meta{prefix}
1917is prepended to the codified form. This is most useful for segmented documents.
1918Now the top-most node is indicated by the bare \Meta{prefix}.
1919\end{itemize}
1920%
1921These features can also be obtained by setting the variable \fn{\$SHORT\_INDEX}
1922to have value `\texttt{1}', in a configuration or initialisation file;
1923provided, of course, that the document loads the \env{makeidx} package.%
1924
1925\latex{\index{index|)}}
1926
1927
1928
1929\subsubsection{Integrated Glossary and Index\label{glossind}}%
1930%\subsection{Integrated Glossary and Index\label{glossind}}%
1931\index{index!integrated with Glossary}%
1932\index{Glossary!integrated with Index}%
1933
1934\noindent
1935A large number of different pieces of software are required to make
1936\latextohtml{} work effectively, as well as many files containing data or code
1937to work with parts of this software.
1938For this reason, a Glossary is included with this manual.
1939It contains the names of all files, configuration variables, application software
1940and related technical terms, with a short description of what it is, or does,
1941and perhaps a URL for further reference.
1942
1943\index{Glossary!printed version}%
1944\index{Glossary!HTML@\texttt{HTML} version}\html{\\}%
1945In the printed version each item in the Glossary is accompanied by the page-numbers
1946on which the item is mentioned, somewhat like in the Index.
1947For the \texttt{HTML} version, each glossary-item contains a hyperlink to an
1948index-entry, which then has links to each occurrence.
1949These extra index-entries do not appear in the printed version;
1950indeed they also contain a hyperlink back to the corresponding glossary-entry.
1951
1952This feature is currently available only when using the \env{makeidx} package,
1953and needs also the \env{html} and \env{htmllist} packages.
1954It was developed for version 96.1f by Ross Moore,
1955incorporating an extensive revision of \fn{makeidx.perl}, as well as additions to
1956\latextohtml{} so that all aspects of indexing work correctly with segmented documents.
1957
1958\bigskip
1959\noindent
1960Since \LaTeX{} provides no guidelines for how a Glossary should be constructed,
1961the technique used here will be explained in detail, for both the printed and
1962\texttt{HTML} versions.
1963
1964\begin{itemize}
1965\item
1966Firstly the \Lc{makeglossary} command, which is similar to \Lc{makeindex},
1967must appear in the document preamble, so that \LaTeX{} will record
1968uses of the \verb|\glossary{...}| command within a file \fn{manual.glo}.
1969
1970This command is redundant in the \texttt{HTML} version, so is given a trivial
1971definition which is ignored by \LaTeX{}.\par
1972
1973\item
1974Next, the words, phrases or technical terms to be included in the Glossary
1975are marked in the main text using the \Lc{glossary} command, used indirectly
1976via other macros. For example, file-names are inserted via
1977\verb|\|\verb|fn{html.sty}|, \verb|\|\verb|fn{dvips}|,  \verb|\|\verb|appl{dvips}| etc.
1978which both insert the text and create the glossary-entry; \textit{viz.}
1979%
1980%begin{latexonly}
1981\begin{small}
1982%end{latexonly}
1983\begin{verbatim}
1984\newcommand{\fn}[1]{\htmlref{\texttt{#1}}{GGG#1}\glossary{#1}}
1985\newcommand{\appl}[1]{\htmlref{\textsl{#1}}{GGG#1}%
1986  \Glossary{#1}{\textsl{#1}}}
1987\end{verbatim}
1988%begin{latexonly}
1989\end{small}
1990%end{latexonly}
1991
1992\item
1993The expansions of \Lc{glossary}, and the slightly more general
1994\Lc{Glossary}, are different for the printed and \texttt{HTML} versions.
1995For the \texttt{HTML} version the following definitions occur
1996within an \env{htmlonly} environment:
1997%
1998%begin{latexonly}
1999\begin{small}
2000%end{latexonly}
2001\begin{verbatim}
2002\def\glossary#1{\index{#1@\texttt{#1} \label{III#1}%
2003  \htmlref{(G)}{GGG#1}}}
2004\def\Glossary#1#2{\index{#1@{#2} \label{III#1}\htmlref{(G)}{GGG#1}}}
2005\def\makeglossary{}
2006\end{verbatim}
2007%begin{latexonly}
2008\end{small}
2009%end{latexonly}
2010%
2011\dots while in \LaTeX{} we need only:\quad
2012\verb|\newcommand\Glossary[2]{\glossary{#1@#2}}|~.
2013
2014Notice how the feature of \env{makeidx}, allowing the printable portion to
2015be separate from the sorting-key, is used to allow text-styles to be included within
2016both index-entries and glossary-entries. Indeed the purpose of \Lc{Glossary} is
2017to allow deviations from a fixed style, e.g.
2018%
2019%begin{latexonly}
2020\begin{small}
2021%end{latexonly}
2022\begin{verbatim}
2023\newcommand{\MF}{\htmlref{\textsl{Metafont}}{GGGmetafont}%
2024  \Glossary{metafont}{\textsl{Metafont}}}%
2025\end{verbatim}
2026%begin{latexonly}
2027\end{small}
2028%end{latexonly}
2029%
2030Also notice that in the \texttt{HTML} version an index-entry is created that
2031includes, within its printable portion, both a \Lc{label} and a hyperlink.
2032The former, having name \texttt{III...}, will ultimately reside on the Index page,
2033while the latter will point to an anchor named \texttt{GGG...} on the Glossary page.
2034These names must be distinct from any other names used with \Lc{label}s
2035elsewhere in the document, hence the use of prefixes \texttt{III} and \texttt{GGG}.
2036A short string `\texttt{(G)}' is used for the text of the hyperlink in the Index.
2037
2038\item
2039The text descriptions of the glossary-items are stored in a file
2040called \fn{l2hfiles.dat}, with one description per line.
2041For the \texttt{HTML} version this file is actually read as input:
2042%
2043\begin{comment}
2044\begin{small}
2045\latex{\hskip15pt}\verb|\|\verb|begin{htmlonly}|%
2046\latex{\vskip-1.1\baselineskip\vskip-1.1\baselineskip\indentverb{15pt}}%
2047\begin{verbatim}
2048\section*{Glossary of variables and file-names\label{Glossary}}
2049\begin{htmllist}\htmlitemmark{OrangeBall}
2050\input l2hfiles.dat
2051\end{htmllist}
2052\end{verbatim}
2053\latex{\nobreak\vskip-1.1\baselineskip\nobreak\leavevmode\hskip15pt}%
2054\verb|\|\verb|end{htmlonly}|%
2055\end{small}%
2056\end{comment}
2057%
2058%begin{latexonly}
2059\begin{small}
2060%end{latexonly}
2061\begin{verbatim}
2062\section*{Glossary of variables and file-names\label{Glossary}}
2063\begin{htmllist}\htmlitemmark{OrangeBall}
2064  \input l2hfiles.dat
2065\end{htmllist}
2066\end{verbatim}
2067%begin{latexonly}
2068\end{small}%
2069%end{latexonly}
2070
2071\noindent
2072For this reason alone it is desirable to have \fn{l2hfiles.dat} sorted alphabetically.\par
2073
2074\item
2075The mechanism used for the \LaTeX{} version also requires the file to be sorted
2076strictly alphabetically, according to the sort-keys associated to each glossary entry.
2077\newline
2078(This requirement could be relaxed, but only with a loss in efficiency; see below.)
2079
2080\LaTeX{} constructs its Glossary by running the \fn{makeindex} utility
2081on the file \fn{manual.glo}, using the following command:
2082%
2083%begin{latexonly}
2084\begin{small}%
2085%end{latexonly}
2086\begin{verbatim}
2087makeindex -o manual.gls -s l2hglo.ist manual.glo
2088\end{verbatim}
2089%begin{latexonly}
2090\end{small}%
2091%end{latexonly}
2092%
2093Its output, which includes page numbering for an index, is stored in \fn{manual.gls}
2094and subsequently read by \LaTeX{} using:
2095
2096%begin{latexonly}
2097\begin{small}%
2098%end{latexonly}
2099\begin{verbatim}
2100\InputIfFileExists{manual.gls}{\clearpage\typeout{^^Jcreating Glossary...}}
2101{\typeout{^^JNo Glossary, since  manual.gls  could not be found.^^J}}
2102\end{verbatim}%
2103%begin{latexonly}
2104\end{small}%
2105%end{latexonly}
2106
2107\noindent
2108The configuration file \fn{l2hglo.ist} is included along with this manual.
2109It contains a portion that inserts tricky \TeX{} code at the beginning of \fn{manual.gls}.
2110This code extracts from \fn{l2hfiles.dat} that line corresponding to each glossary entry,
2111then typesets it itemized within an environment called \env{theglossary}.
2112
2113%begin{latexonly}
2114\begin{small}%
2115%end{latexonly}
2116\begin{verbatim}
2117\newenvironment{theglossary}{\begin{list}{}{%
2118  \setlength{\labelwidth}{20pt}%
2119  \setlength{\leftmargin}{\labelwidth}%
2120  \setlength\itemindent{-\labelwidth}%
2121  \setlength\itemsep{0pt}\setlength\parsep{0pt}%
2122  \rmfamily}}{\end{list}}
2123\end{verbatim}
2124%begin{latexonly}
2125\end{small}%
2126%end{latexonly}
2127%
2128Currently searching within \fn{l2hfiles.dat} is only done sequentially, stopping
2129at the end of the file. If an entry is not found then it is skipped and a message
2130printed to the log; the next entry will search from the top of the file.
2131If all entries are included and maintained in strict order, there will be no skipping
2132and each line of \fn{l2hfiles.dat} is read exactly once.\par
2133
2134\item
2135Within \fn{l2hfiles.dat} the data lines look like:
2136%
2137%begin{latexonly}
2138\begin{small}%
2139%end{latexonly}
2140\begin{verbatim}
2141\item[\gn{french.perl}] adds \Perl{} code to be compatible with the ...
2142\item[\gn{\textsl  {ftp}}] `File Transfer Protocols', network ...
2143\item[\gn{german.perl}] adds \Perl{} code to be compatible with the ...
2144...
2145\end{verbatim}
2146%begin{latexonly}
2147\end{small}%
2148%end{latexonly}
2149%
2150For the \LaTeX{} version the \verb|\item[\gn{...}]| is only used for pattern-matching,
2151to find the correct data entry.
2152All typesetting is controlled from within \fn{manual.gls}.
2153
2154However the \texttt{HTML} version requires the following definition:
2155%
2156%begin{latexonly}
2157\begin{small}%
2158%end{latexonly}
2159\begin{verbatim}
2160\newcommand{\gn}[1]{\texttt{#1}\label{GGG#1}\htmlref{\^}{III#1}}%
2161\end{verbatim}
2162%begin{latexonly}
2163\end{small}%
2164%end{latexonly}
2165%
2166which establishes the hyperlink to the Index, marked by `\verb|^|',
2167and provides the \Lc{label} to create the target in the Glossary
2168for any \verb|\glossary{...}| command having the corresponding argument.%
2169\end{itemize}
2170