[tex4ht] [bug #457] tex4ht removes space causing mathjax to fail

Nasser M. Abbasi puszcza-hackers at gnu.org.ua
Mon Apr 20 06:00:02 CEST 2020


URL:
  <http://puszcza.gnu.org.ua/bugs/?457>

                 Summary: tex4ht removes space causing mathjax to fail 
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Mon 20 Apr 2020 06:56:22 AM EEST
                Category: None
                Priority: 5 - Normal
                Severity: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

reference:

https://tex.stackexchange.com/questions/539597/tex4ht-removes-space-causing-mathjax-to-fail

This MWE

====================
\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}

$ 2\ x\ {\arcsin x} $

\end{document}
====================

is valid latex. It compiles OK using lualatex to

But when compiled to HTML using mathjax mode

  make4ht -ulm default  foo.tex "htm,mathjax"

The generated latex losses the important white space between x\ { and it
becomes x\{. Here is the raw HTML

========================
<!DOCTYPE html> 
<html lang="en-US" xml:lang="en-US" > 
<head><title></title> 
<meta  charset="utf-8" /> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<meta name="viewport" content="width=device-width,initial-scale=1" /> 
<link rel="stylesheet" type="text/css" href="foo.css" /> 
<meta name="src" content="foo.tex" /> 
 <script type="text/x-mathjax-config"> MathJax.Hub.Config({ 'fast-preview':
{disabled: true}, TeX: { extensions: ["color.js","AMSmath.js"],
equationNumbers: { autoNumber: "AMS" } }, extensions: ["tex2jax.js"], tex2jax:
{  inlineMath: [ ["\\\(","\\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"]
], processEscapes: true, processEnvironments: true } }); </script> 
 <script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
 
</head><body 
>
<!--l. 6--><p class="noindent" >\( 2\ x\{\arcsin x} \)
</p>   

</body> 
</html>
==============

And because of this mathjax fail to render it.


Manually editing the HTML above and adding the extra white space that was in
source, now it works.

 <!--l. 6--><p class="noindent" >\( 2\ x\ {\arcsin x} \)


Using TL 2019 on Linux





    _______________________________________________________

Reply to this item at:

  <http://puszcza.gnu.org.ua/bugs/?457>

_______________________________________________
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/


More information about the tex4ht mailing list.