[tex4ht] No math rendering

Radhakrishnan CV cvr at river-valley.org
Sun Apr 17 01:37:57 CEST 2011


On Thu, Apr 14, 2011 at 3:27 AM, Bruno Grenet
<bruno.grenet at gmail.com> wrote: > Hello,
>
> I have read some previous messages concerning math rendering,
> especially one about MathJax (a javascript library to display
> LaTeX formulas in HTML). I think I have the same wish as the
> poster even though I am not so sure.

Why not consider moving to MathML which is now part of HTML5 specs and
already supported by browsers like Firefox and Opera?

> My wish is to configure tex4ht so that it just copies all math
> formulas into the html code. I felt like it is easy (just by
> using the \HCode command) but unfortunately I could not do what
> I want. I guess I do not understand well enough tex4ht yet.

It is not a big task to verbatim copy the TeX code for inline math.
For instance, the following code can do the job:

\Configure{$}{}{}{\expandafter\getMath}%$
\def\getMath#1${\relax$%
    \def\next{$#1$}%
    \HCode{\expandafter\strip at prefix\meaning\next}}

However, this trick will not help with displayed math. The main
problem is the resolution of cross references to equation numbers.
Since equation numbers are generated on the fly, you need to process
the displayed math in some manner before writing verbatim to your html
document.

A possible way out shall be to write out each displayed equation,
typeset it in a box so that \label{...}'s are expanded and written to
*.aux, discard the box and verbatim input the equation file again.
Not a trivial job, but entirely doable.

> The rationale for my wish comes from MathJax: it makes a great
> job rendering LaTeX equations in HTML, and it seems that it
> works better with a pure LaTeX input than with, say, the input
> given through the jsMath option of tex4ht (even though there is
> an extension to MathJax to handle jsMath-style inputs).

Actually, it is in our TODO list to write separate packages for
MathJax. In fact, there is a request pending from MathJax developers
in this regard. Volunteers are welcome.

> Thank you in advance, and already many thanks for the great job
> done to continue Eitan Gurari's terrific work!

Welcome. Sorry for being late to respond. As you can imagine, it is
the day job which forces a procrastination.

Best regards
-- 
Radhakrishnan


More information about the tex4ht mailing list