B.7 Mathematical Formulas
B.7.1 Math Mode Environment
The three ways to use math mode ($
...$
,
\(
...\)
and
\begin{math}
...\end{math}
) are supported.
The three ways to use display math mode ($$
...$$
,
\[
...\]
and
\begin{displaymath}
... \end{displaymath}
) are also
supported.
Furthermore, \ensuremath
behaves as expected.
The equation
, eqnarray
, eqnarray*
environments
are supported.
Equation labeling and numbering is performed in the first two
environments, using the equation
counter.
Additionally, numbering can be suppressed in one row of an
eqnarray
, using the \nonumber
command.
Math mode is not as powerful in HEVEA as in LATEX. The
limitations of math mode can often be surpassed by using math display
mode. As a matter of fact, math mode is for in-text formulas. From
the HTML point of view, this means that math mode does not close
the current flow of text and that formulas in math mode must be
rendered using text-level elements only. By contrast, displayed
formulas can be rendered using block-level elements. This means that
HEVEA have much more possibilities in display context than inside
normal flow of text. In particular, stacking text elements one above
the over is possible only in display context.
For instance compare how HEVEA renders
$\frac{1}{\sum_{i=1}^{\infty}$
as: 1/ Si=1¥ ii, and
$$\frac{1}{\sum_{i=1}^{\infty}$$
as:
B.7.2 Common Structures
HEVEA admits, subscript (_
), superscripts (^
) and
fractions (\frac{
numer}{
denom}
).
The best effect is obtained in display mode, where HTML
<TABLE>
element is extensively used. However, in-text
simple subscript and superscript are rendered using the <SUB>
and <SUP>
text-level elements and their appearance should be correct
both in in-text and displayed formulas.
The nth root command \sqrt
is not supported.
An attempt is made to render all ellipsis constructs (\ldots
,
\cdots
, \vdots
and \ddots
). The effect may be
strange for the latter two.
B.7.3 Mathematical symbols
Symbols that can be printed using browser iso-latin1 or symbol fonts
are translated.
Other symbols are undefined most of the time.
Attempting to translate them will thus generate ``Unknown macro''
warnings.
Then, users can choose their own replacement for these symbols.
These personal definitions are best placed in an ad-hoc style file,
given as a command line argument to HEVEA.
A suggested replacement is a mix of colors and available
symbols.
For instance, HEVEA cannot render the \leadsto
symbol, but it
can be defined as a red arrow by:
\newcommand{\leadsto}{{\red\rightarrow}}
Then, $$A \leadsto B$$
is rendered as follows:
A ® B
When given the -nosymb
option, HEVEA silently replaces
symbols that cannot be rendered by iso-latin1 only by text equivalents.
These equivalents are English words by default, or French words when the
-francais
option is set.
Log-like functions and variable sized-symbols are recognized and their
subscripts and superscripts are put where they should in display mode.
Subscript and superscript placement can be changed using the
\limits
and \nolimits
commands.
Big delimiters are also handled.
B.7.4 Putting one thing above the other
The commands \stackrel
, \underline
and \overline
are recognized.
They produce sensible output in display mode.
In text mode, these macros call the \textstackrel
,
\textunderline
and \textoverline
macros.
These macros perform the following default actions, which can be
changed by redefining them:
- \textstackrel
- Performs ordinary superscripting.
- \textunderline
- Underlines its argument, using the
HTML
<U>
text-level element.
- \textoverline
- Sends a warning message to the
console and echoes its argument in the output.
Math accents (\hat
, \tilde
, etc.) are not handled at
all.
B.7.5 Spacing
By contrast with LATEX, space in the input matters in math mode.
One or more spaces are translated to one space.
Furthermore,
spaces after commands (such as \alpha
) are echoed
except for invisible commands (such as \tt
).
This allows users to control space in their formulas, output being
near to what can be expected.
Explicit spacing commands (\,
, \!
, \:
and
\;
) are recognized, the first two commands do nothing, while
the others two output one space.
B.7.6 Changing Style
Letters are always italicized inside math mode and this cannot be
changed. The appearance of
other symbols can be changed using
LATEX2e style changing commands (\mathrm
, etc.).
The commands \boldmath
and \unboldmath
are not
recognized. Whether symbols belonging to the symbol font are affected
by these changes or not is browser dependent.
Observe that this does not corresponds directly to how LATEX manage style
in math mode.
Math style changing declarations \displaysyle
and \textstyle
do not exist, while \scriptstyle
and \scriptscriptstyle
perform type size changes.