Prev Up Next
Go backward to 5.6 Footnotes
Go up to 5 Getting started
Go forward to 5.8 Ignorable input

5.7 Formulas

There is no math mode in HTML. (The proposed standard HTML 3 contained a math mode, but has been withdrawn. HTML-browsers that will understand math do not seem to become widely available in the near future.)

Hyperlatex understands the $ sign delimiting math mode as well as \( and \). Subscripts and superscripts produced using _ and ^ are understood. If the \htmllevel is larger than html2 then HTML tags for subscripts and superscripts are created. Otherwise, Hyperlatex creates a textual approximation of the form a^2 = x^{2n}.

Hyperlatex now has a simply textual implementation of many common math mode commands, so simple formulas in your text should be converted to some textual representation. If you are not satisfied with that representation, you can use the \math command:

  \math[HTML -version]{LaTeX-version}
In LaTeX, this command typesets the LaTeX-version, which is read in math mode (with all special characters enabled, if you have disabled some using \NotSpecial). Hyperlatex typesets the optional argument if it is present, or otherwise the LaTeX-version.

If, for instance, you want to typeset the ith element (the \math{i}th element) of an array as ai in LaTeX, but as a[i] in HTML, you can use

   \math[\code{a[i]}]{a_{i}}

By default, Hyperlatex sets all math mode material in italic, as is common practice in typesetting mathematics: "Given n points..." Sometimes, however, this looks bad, and you can turn it off by using \htmlmathitalic{0} (turn it back on using \htmlmathitalic{1}). For instance: 2n, but H-1. (In the long run, Hyperlatex should probably recognize different concepts in math mode and select the right font for each.)

It takes a bit of care to find the best representation for your formula. This is an example of where any mechanical LaTeX-to-HTML converter must fail--I hope that Hyperlatex's \math command will help you produce a good-looking and functional representation.

You could create a bitmap for a complicated expression, but you should be aware that bitmaps eat transmission time, and they only look good when the resolution of the browser is nearly the same as the resolution at which the bitmap has been created, which is not a realistic assumption. In many situations, there are easier solutions: If xi is the ith element of an array, then I would rather write it as x[i] in HTML. If it's a variable in a program, I'd probably write xi. In another context, I might want to write x_i. To write Pythagoras's theorem, I might simply use a^2 + b^2 = c^2, or maybe a*a + b*b = c*c. To express "For any eps> 0 there is a delta> 0 such that for |x - x0| < delta we have |f(x) - f(x0)| < eps" in HTML, I would write "For any eps > 0 there is a delta > 0 such that for |x-x0| < delta we have |f(x)-f(x0)| < eps."


Otfried Schwarzkopf, September 2, 1997

Prev Up Next