[tex4ht] problem using "\" inside verbatim in make4ht mathjax mode

Nasser M. Abbasi nma at 12000.org
Thu Sep 27 02:29:00 CEST 2018


just when I was thinking may be mathjax with make4ht might actually
work, I found new problem.

It seems passing verbatim text to mathjax is tricky. I do not
if this is a mathjax problem or tex4ht.

When compiling this MWE

----------------------
\documentclass[11pt]{article}
\begin{document}

\begin{verbatim}
HW1 \ref{sec:HW1}  & 100\% \\\hline
\end{verbatim}
\end{document}
------------------------

The HTML shows  this

     HW1 ???  & 100\% \\\hline

It is actually rendering \ref{sec:HW1} as math when
it is inside verbatim!

I put the HTML generated here if you like to see it

https://www.12000.org/tmp/092618/foo.htm

Compiled using

make4ht -ulm default -c ./nma_mathjax.cfg foo.tex
         "htm,0,notoc*,p-width,charset=utf-8" " -cunihtf -utf8"

Where

nma_mathjax.cfg is

\RequirePackage{mathjax-latex-4ht}
\Preamble{xhtml}
\begin{document}
\EndPreamble

Using mathjax-latex-4ht downloaded from

https://raw.githubusercontent.com/michal-h21/helpers4ht/master/mathjax-latex-4ht.sty

Since it is not in tex4ht source yet.

Is there a way to resolve this issue? May be use different
verbatim class when using mathjax than not?

There is no such problem when using make4ht with svg or
png. Only when using mathjax.

This will be a problem if mathjax would look inside verbatim
and try to interpret strings with "\" in them as math, since
I use verbatim alot to put plain latex code in Latex for illustration.

Thanks
--Nasser




More information about the tex4ht mailing list