[tex4ht] using verbatim fails on some content when using mathjax mode

Nasser M. Abbasi nma at 12000.org
Thu May 21 10:26:27 CEST 2020


Hello experts;

I did not know that even stuff inside verbatim has limit on what it can
be when using mathjax mode?

I thought the whole idea of verbatim, is that one can put
any text there, and mathjax or HMTL should not look at it.

This fails with mathjax mode only:

=====================
\documentclass[12pt]{article}
\begin{document}
\begin{verbatim}
catdvi -e 1 -U index.dvi | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > index.txt
\end{verbatim}
\end{document}
====================

Compiled using

make4ht -ulm default foo3.tex "html,mathjax"

The HTML gives "Undefined control sequence \+", here is screen shot

https://www.12000.org/tmp/052120/screen_shot.png

Here is the raw HTML generated by tex4ht

=================================
<!DOCTYPE html>
<html lang='en-US' xml:lang='en-US'>
<head><title></title>
<meta charset='utf-8' />
<meta name='generator' content='TeX4ht (https://tug.org/tex4ht/)' />
<meta name='viewport' content='width=device-width,initial-scale=1' />
<link href='foo3.css' rel='stylesheet' type='text/css' />
<meta name='src' content='foo3.tex' />
  <script> window.MathJax = { tex: { tags: "ams", inlineMath: [ ["\\\(","\\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true, processEnvironments: true, packages: ['base', 'color', 'ams'] }, loader: { load: ['[tex]/color', '[tex]/ams'] } }; </script>
  <script id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js' async='async' type='text/javascript'></script>
</head><body>
    
<div id='verbatim-1' class='verbatim'>
catdvi -e 1 -U index.dvi | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > index.txt
</div>
<!-- l. 6 --><p class='nopar'>
</p>
  
</body>
</html>
=================================

It seems mathjax issue? How to tell mathjax not to look inside verbatim class?

When not using mathjax mode, there is no problem at all. Here
is the raw HTML in this case

==============================
<!DOCTYPE html>
<html xml:lang='en-US' lang='en-US'>
<head><title></title>
<meta charset='utf-8' />
<meta name='generator' content='TeX4ht (https://tug.org/tex4ht/)' />
<meta name='viewport' content='width=device-width,initial-scale=1' />
<link type='text/css' rel='stylesheet' href='foo3.css' />
<meta name='src' content='foo3.tex' />
</head><body>
    
<div class='verbatim' id='verbatim-1'>
catdvi -e 1 -U index.dvi | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > index.txt
</div>
<!-- l. 6 --><p class='nopar'>
</p>
  
</body>
</html>
==============================

For now, I will compile this file not using mathjax and use svg.

Thanks
--Nasser










More information about the tex4ht mailing list.