Forum Samples, Tips and Tricks

Typesetting MATH with HTML + CSS + HTMTEX + Prince


Suppose you are authoring an HTML document TEST.htm with a simple
ASCII text editor, and include a TeX-like math notation, for example

* Greek letter alpha as "macro" \alpha,
* Pythagora's theorem as "inline math" $c^2 = a^2 + b^2$, and
* Newton / Einstein's law of motion as "displayed math"

<div class="math">
<p>$F = {dG : dt}$</p>
<p>$G = {mv : \root(1 - v^2 / c^2)$</p>

Then you run the document through a (Unix) pipe HTMTEX

cat TEST.htm | HTMTEX > TEST1.htm

and voila: \alpha becomes Unicode UTF-8 char, inline
math is transformed into a span, and displayed math is
elaborated into an explicit table. Both input and output
documents are fully HTML-compliant.

Now process TEST1.htm with Prince, and you will get a
nice-looking "mathematical" PDF document.

Have a look:

Marjan Divjak