The LaTeX2HTML Translator |
|
Drakos/Moore |
Extending the Translator
Subsections
In an earlier section is was seen how
the capabilities of LATEX2HTML can be extended to cope with
LATEX commands defined in packages and style-files.
This is in addition to defining simple macros and environments,
using \newcommand and \newenvironment.
The problem however, is that writing such extensions for packages
requires an understanding of Perl programming
and of the way the processing in LATEX2HTML is organised.
The default behaviour for unrecognised commands is
for their arguments to remain in the HTML text,
whereas the commands themselves are passed on to LATEX,
in an attempt to generate an image. This is far from ideal,
for it is quite likely to lead to an error in LATEX
due to not having appropriate arguments for the command.
Currently there are several related mechanisms whereby a user
can ask for particular commands and their arguments to be either
- ignored (via: &ignore_commands);
- passed on to LATEX for processing as an image
(via: &process_commands_in_tex);
- passed to LATEX for processing as an image,
as if an environment
(via: &process_commands_inline_in_tex);
- passed on to LATEX, setting parameters
to be used in subsequent images
(via: &process_commands_nowrap_in_tex);
- processed as ``order-sensitive'', as if an environment
rather than a command
(via: &process_commands_wrap_deferred);
The string beginning &.... is the name of the Perl subroutine
that controls how the LATEX commands are to be subsequently treated during
processing by LATEX2HTML.
Towards the end of the latex2html script, one finds a list
of LATEX commands to be handled by each of these subroutines.
These lists even include some common TEX commands.
Analogous lists occur in most of the package extension files.
In many cases the commands are for fine-tuning the layout on
a printed page. They should simply be ignored; but any parameters
must not be allowed to cause unwanted characters to appear on
the HTML pages.
Customised extensions using these mechanisms may be included in the
$LATEX2HTMLDIR/latex2html.config file, or in a personal
$HOME/.latex2html-init initialisation file,
as described next.