next up previous contents
Next: Writing Subroutines to Translate Up: Converting LaTeX .sty Style Previous: Introduction   Contents


The LaTeX2HTML Process

LaTeX2HTML parses the document in a different manner to LaTeX, and this is something you need to be wary about. The &translate subroutine splits up the input into corresponding segments (if -split is given a non zero value), and these segments are then translated. Therefore, if you want to define a command that starts a new section type (e.g. \makeglossary), LaTeX2HTML won't translate the command, until after the document has been split, at which point it's too late to split it into a new segment.

The translator replaces all braces with marks containing unique identifiers, to make it easier to match opening braces with their corresponding closing braces. For example, consider the following code:

Some \textbf{bold \textit{italic}} text.
This will be translated into:
Some \textbf<#6#>bold <I>italic</I><#6#> text.
The number inside the <#n#> sequence, 6 in the above example, is the unique identifier for that set of braces. Note also that commands are translated inside out, so \textit has been translated before \textbf. The maximum number of identifiers is given by $global{'max_id'}name=$global{'max_id'},sort=global,description=This is the maximum number of unique identifiers.$global{'max_id'}, so if you want to add a new set of braces, you will need to do something like:
$id = ++$global{'max_id'};
$_ = "${OP}${id}${CP}Some text${OP}${id}${CP}";
where $OP is a predefined variable with the value <# and $CP is a predefined variable with the value #>.


next up previous contents
Next: Writing Subroutines to Translate Up: Converting LaTeX .sty Style Previous: Introduction   Contents
Dr Nicola L C Talbot 2005-06-10