[tex4ht] Getting correct MathML for multi-character symbols

William F Hammond gellmu at gmail.com
Thu Feb 1 22:04:59 CET 2018

The discussion about correct MathML output for numbers bring this old issue
back to me.  Take, for example, the common math (though not engineering)
symbol "Hom".  Let's assume we want it to become <mi> -- although some may
wish for <mo>.  What LaTeX markup for Hom should be given to tex4ht (that
also works for regular LaTeX)?

There is no way that I think is fully correct unless it involves something
\DeclareMathOperator, which should be handled, but is too heavy for casual

For casual use \mathrm{Hom} will generate <mi>Hom</mi> with tex4ht and, if
I might add, also with latexml.  The problem with using \mathrm this way is
that its LaTeX purpose is a zone font operation and its argument for
regular LaTeX may contain math expressions, not just a single symbol name.
A translation to MathML can only safely set \mathrm as <mi> when its
content is free of operations, otherwise it needs to become, I suppose,

I've always thought that \mbox{Hom} should be the way to go.  In regular
LaTeX one cannot set a math expression in an mbox inside math without
explicitly returning to math mode.  However, for \mbox{Hom} tex4ht uses
<mtext> (as does also latexml).  But isn't <mtext> is supposed to be a
semantic escape from math expression parsing that a computer algebra system
can ignore?  In fact, amsmath introduced \text{} for semantic escaping from
math expression parsing.

By the way, as for \mbox{} found in LaTeX outside of math, I think its
content should be passed through to html as if the \mbox{} were not
present.  For \mbox{} inside math, internal math content should throw an
error for translation to MathML.  If the content has no internal white
space, it should be <mi>, but <mtext> if there is internal white space.

William F Hammond
Email: gellmu at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tex4ht/attachments/20180201/91d35334/attachment.html>

More information about the tex4ht mailing list