How it worksTwo passesMagic charactersContentsIndex

Magic characters

Hyperlatex makes extensive use of "meta" characters, also called "magic" characters in its passes.2 The meta characters are the regular character, plus hyperlatex-meta-offset. Broadly, the meta characters have two uses, protecting characters from being interpreted, and as single-character document processing commands.

Protecting characters

Most magic characters are used to protect characters from final substitution. After Hyperlatex conversion, all &, <, and > characters in the file are converted to XML symbols (i.e. &amp; &lt; and &gt;), while the meta-&, meta-< and meta-> are converted to the normal &, <, > characters.

In addition to the space, these are the characters converted for this reason:

&  <  >  %  {  }  "  ~  -  '  `

For example, the < and > characters are meaningless to LaTeX, but meaningful as HTML. So as LaTeX macros are turned into HTML directives, they are bracketed with these meta brackets for the duration of the processing. The last processing step (in hyperlatex-final-substitutions) puts them all back.

Indicating text layout

Meta characters are used a single-character marks for various kinds of text layout directives. These are outlined below.

meta-C
is used (with the meta versions of { and }) to escape the magic characters, if they appear in the input file, like this: C{}.
meta-|
is used in parsing arguments to macros. It is placed in the text to delimit an argument from the text following the command. After the command is interpreted, the character is removed.
meta-l
is used to mark the spot after something that has been labeled. For instance, saying
\section{abc}
will generate an automatic label, an <h> tag, and then a meta-l marker. If now a \label command follows, Hyperlatex checks the presence of meta-l to make sure that the label before the section heading is used.
meta-X
marks locations where Hyperlatex doesn't yet know what text to mark as the anchor of a label (i.e. the contents of an <a name="xxx">xxx</a> tag). This is then done in the final substitution stage.
meta-p
marks where a paragraph break should happen.
meta-n
indicates places where no paragraph break should occur.
meta-P
is for marking paragraph endings.

Paragraph tags

Paragraph tags are controlled by two flags:

hyperlatex-in-paragraph
This is set to t at the beginning of a paragraph, and to nil when a paragraph ends. A paragraph should begin when printable material is ready to be placed on the "page," and when it's appropriate to put it into a paragraph.
hyperlatex-in-body
This is set to t when it's worth considering whether a paragraph is even appropriate here. For example, it's set to nil during the creation of a html node (file) header, during the formatting of a section head, and during the formatting of the example environment. You can unset and set this variable with \suspendpars and \resumepars.

July 13, 2005

How it worksTwo passesMagic charactersContentsIndex