1

I exactly follow the instruction from latex mathjax node but getting some unexpected result, first in section 6 accents, the math symbols are not corrected, enter image description here second, in HTML some information is missing enter image description here in pdf file, it should be enter image description here third, in theorem environment, some font in the HTML file looks like too big. enter image description here

Here is my error message when I run make4ht

[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: maths.tex
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
--- warning --- \special{t4ht~...} without \special{t4ht~}
[WARNING] domfilter: DOM parsing of maths.html failed:
[WARNING] domfilter: ...ive/2019/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/msup) [char=37676]

Formula <math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
      <msub><mrow><mi>u</mi></mrow><mrow><mn>1</mn></mrow></msub> <mo class="MathClass-rel">=</mo> <!--l. 216--><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>−2γ𝜖</mrow><mrow>2</mrow>s<mrow>2</mrow>+μ𝜖<mrow>3</mrow><mstyle mathsize="1.19em"><mfenced separators="" open="("><mrow></mrow></mfenced></mstyle><mfrac><mrow>3</mrow>
<mrow>8</mrow></mfrac>s<mrow>2</mrow>+<mfrac><mrow>1</mrow>
<mrow>8</mrow></mfrac>s<mrow>1</mrow>i<mstyle mathsize="1.19em"><mfenced separators="" open=")"><mrow></mrow></mfenced></mstyle>+𝜖<mrow>3</mrow><mstyle mathsize="1.19em"><mfenced separators="" open="("><mrow></mrow></mfenced></mstyle>−<mfrac><mrow>81</mrow>
<mrow>32</mrow></mfrac>s<mrow>4</mrow>s<mrow>2</mrow><mrow>2</mrow>−<mfrac><mrow>27</mrow>
<mrow>16</mrow></mfrac>s<mrow>4</mrow>s<mrow>2</mrow>s<mrow>1</mrow>i+ <mfrac><mrow>9</mrow>
<mrow>32</mrow></mfrac>s<mrow>4</mrow>s<mrow>1</mrow><mrow>2</mrow>+<mfrac><mrow>27</mrow>
<mrow>32</mrow></mfrac>s<mrow>3</mrow>s<mrow>2</mrow><mrow>2</mrow>i−<mfrac><mrow>9</mrow>
<mrow>16</mrow></mfrac>s<mrow>3</mrow>s<mrow>2</mrow>s<mrow>1</mrow>−<mfrac><mrow>3</mrow>
<mrow>32</mrow></mfrac>s<mrow>3</mrow>s<mrow>1</mrow><mrow>2</mrow>i<mstyle mathsize="1.19em"><mfenced separators="" open=")"><mrow></mrow></mfenced></mstyle>+∫<!--nolimits--><!--nolimits--><mrow>
a</mrow><mrow>b</mrow>1−2x+3x<mrow>2</mrow>−4x<mrow>3</mrow><mspace width="0.3em" class="thinspace"></mspace>dx</math>
</math> contains the following errors:
 [ 'MathML - Unexpected text node: \'−2γ𝜖\'' ]
[STATUS]  make4ht: Conversion finished

I use texlive2019, so how to fix all the questions above?

maths.tex file is here

stack.cfg file is as below

\Preamble{xhtml,mathml,fn-in,html5}  
\Css{body{  
    margin:40px auto;  
    max-width:36em;  
    line-height:1.6;  
    font-size:1em; 0.88em;  
    color:\#222;  
    background-color:\#FEFEF7;  
    padding:0 10px;}}  
\Css{h1,h2,h3{line-height:1.2}}  
\Css{p.indent{text-indent:0;}}  
\Css{@media (min-width: 29.63em){  
  :root {  
    font-size: 3vw;  
  }  
}}  

\Css{@media (min-width: 40.74em){  
  :root {  
    font-size: 1.375em;  
  }  
}}  
\Css{body {  
font-family: STIXGeneral, "Linux Libertine O", Gentium, Georgia,  
"Times New Roman",  "Iowan Old Style",  
 Palatino Linotype, Palatino, serif;  
}}  
\begin{document}  
\EndPreamble

and then I use this command

make4ht -uf html5+mathjaxnode -c stack.cfg maths.tex

3
  • Hi, I willl need some LaTeX code to test
    – michal.h21
    Dec 28 '19 at 8:52
  • don't make an external link, your question is archived forever but that dropbox link will break, make a small self contained example and add it to the question in a code block. Dec 28 '19 at 12:33
  • @michal.h21 I have updated my question.
    – noname1014
    Dec 28 '19 at 23:09
1

The main issue is caused by the \parmath command, which is defined in the document text, so it cannot be patched from the configuration file. It looks like this:

\newcommand{\parmath}[2][0.8\linewidth]{\parbox[t]{#1}%
{\raggedright\linespread{1.2}\selectfont\(#2\)}}

The explicit nested math commands seems to explode the MathML code. I would redefine it in the following way:

\newcommand{\parmath}[2][0.8\linewidth]{\parbox[t]{#1}%
{\raggedright\linespread{1.2}\selectfont\ensuremath{#2}}}

It uses \ensuremath instead of \( ... \), which works better in such cases.

I've also found issue with accents that results in error message instead of rendered MathML code. I've fix that in tex4ht sources, but before this fix arrives in the TeX distributions, you can use the updated configuration file:

\Preamble{xhtml,mathml,fn-in,html5}  
\Css{body{  
    margin:40px auto;  
    max-width:36em;  
    line-height:1.6;  
    font-size:1em; 0.88em;  
    color:\#222;  
    background-color:\#FEFEF7;  
    padding:0 10px;}}  
\Css{h1,h2,h3{line-height:1.2}}  
\Css{p.indent{text-indent:0;}}  
\Css{@media (min-width: 29.63em){  
  :root {  
    font-size: 3vw;  
  }  
}}  

\Css{@media (min-width: 40.74em){  
  :root {  
    font-size: 1.375em;  
  }  
}}  


\Css{body {  
font-family: STIXGeneral, "Linux Libertine O", Gentium, Georgia,  
"Times New Roman",  "Iowan Old Style",  
 Palatino Linotype, Palatino, serif;  
}}  
\begin{document}  
\catcode`\:=11

\def\myop#1{\PauseMathClass\HCode{<mo accent="true">}#1\HCode{</mo>}\EndPauseMathClass}
\def\:vec:over{\ifmmode\expandafter\myop\fi{\x:unicode{2192}}}
\def\:grave:over{\ifmmode\expandafter\myop\fi{\x:unicode{0300}}}
\def\:acute:over{\ifmmode\expandafter\myop\fi{\x:unicode{0301}}}
\def\:hat:over{\ifmmode\expandafter\myop\fi{\x:unicode{0302}}}
\def\:widehat:over{\ifmmode\expandafter\myop\fi{\x:unicode{0302}}}
\def\:tilde:over{\ifmmode\expandafter\myop\fi{\x:unicode{0303}}}
\def\:widetilde:over{\ifmmode\expandafter\myop\fi{\x:unicode{0303}}}
\def\:bar:over{\ifmmode\expandafter\myop\fi{\x:unicode{0304}}}
\def\:breve:over{\ifmmode\expandafter\myop\fi{\x:unicode{0306}}}
\def\:dot:over{\ifmmode\expandafter\myop\fi{\x:unicode{0307}}}
\def\:ddot:over{\ifmmode\expandafter\myop\fi{\x:unicode{0308}}}
\def\:uml:over{\ifmmode\expandafter\myop\fi{\x:unicode{0308}}}
\def\:ring:over{\ifmmode\expandafter\myop\fi{\x:unicode{030A}}}
\def\:Huml:over{\ifmmode\expandafter\myop\fi{\x:unicode{030B}}}
\def\:check:over{\ifmmode\expandafter\myop\fi{\x:unicode{030C}}}
\def\:d:under{\ifmmode\expandafter\myop\fi{\x:unicode{0323}}}
\def\:cedil:under{\ifmmode\expandafter\myop\fi{\x:unicode{0327}}}
\def\:b:under{\ifmmode\expandafter\myop\fi{\x:unicode{0331}}}
\def\:udot:over{\ifmmode\expandafter\myop\fi{\x:unicode{0361}}}

\catcode`\:=12
\EndPreamble

This is the rendered problematic part with the fix:

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.