# Bad mathchar (79119) using htlatex+mathml with \uparrow with align from amsmath package

texlive 2012 debian package:

\documentclass[]{article}%
\usepackage{amsmath}
\begin{document}
\begin{align}
&    \uparrow\sum F
\end{align}
\end{document}


compile with

htlatex report.tex "htm,mathml" " -cunihtf"


gives

/usr/share/texmf/tex/generic/tex4ht/html-mml.4ht)
(/usr/share/texmf/tex/generic/tex4ht/html4-uni.4ht))
(./report.aux)
! Bad mathchar (79119). <argument>  & \uparrow \sum F
l.8 \end{align}
?


But when compile as

 htlatex report.tex "htm,xhtml" " -cunihtf"


or

 htlatex report.tex "htm" " -cunihtf"


No error.

What should I do? Is this a bug in htlatex? any workaround? The problem happens when using \uparrow with mathml and when using align. Without align there is no error.

\documentclass[]{article}%
\usepackage{amsmath}
\begin{document}
$\uparrow\sum F$
\end{document}


Now

  htlatex report.tex "htm,mathml" " -cunihtf"


No error.

update

fyi, if you are using htlatex with mathml watch out for align. Workaround I found for now is to use eqnarray. Now the errors went away. I am trying to compile to HTML code generated by Scientific word, which generated the align Latex code. So I had to edit the code and change all the align to eqnarray as temporary fix for now to get HTML generated.

-

It's been a long time, but I think to have found the issue. In several places of mathltx.4ht there are \mathchar"<number> without a space at the end.

In particular the problem seems to be in line 1142:

1141 \def\:tempd#1#2{%
1142    \expandafter\def\csname #1\endcsname{\mathchar"13#2}%
1143    \MathSymbol\mathop{#1}%
1144    \expandafter\def\csname #1:limits\endcsname{\expandafter
1145                     \:same \math:sym\mathop{#1}\limits}%
1146    \expandafter\def\csname #1:nolimits\endcsname{\expandafter
1147                   \:same \math:sym\mathop{#1}\nolimits}%
1148    \expandafter\edef\csname n:#1:\endcsname{\noexpand\ifDisplayMath
1149           \noexpand\expandafter \expandafter\noexpand
1150                                         \csname #1:limits\endcsname
1151           \noexpand\else \noexpand\expandafter
1152                          \expandafter\noexpand
1153                          \csname #1:nolimits\endcsname\noexpand\fi}%
1154    \expandafter\pend:def\csname n:#1:\endcsname{\ifDisplayMath
1155           \mathop:prefix{mathsize="big"}\fi}%
1156 }


What happens is that \sum is redefined and at the end \o:sum: is expanded to

\mathchar"1350


Now the F just after it makes TeX add it to the number, because F is a proper hexadecimal digit. And 0x1350F represents exactly the number 79119.

Solution: make the bug known to the maintainers; the line should be

1142    \expandafter\def\csname #1\endcsname{\mathchar"13#2\relax}%


In the interim you can add this to your preamble:

\documentclass[]{article}%
\usepackage{amsmath}

\makeatletter
\AtBeginDocument{%
\ifcsname o:sum:\endcsname
\fi
}
\makeatother

\begin{document}

\begin{align}
&    \uparrow \sum F
\end{align}
\end{document}


but the problem might present also for other operators, for instance \bigcup: only when a hexadecimal digit follows (they are 0123456789ABCDEF).

-
I've submitted bug report, together with a patch: puszcza.gnu.org.ua/bugs/index.php?230 thank you for localising the issue –  michal.h21 Sep 16 '14 at 20:22