1

This MWE makes one small table of 2 rows of type p. The first row has has two math equations. tex4ht only shows the first one but not the second. While compiling with lualatex to pdf shows both as expected.

MWE

\documentclass[12pt]{book}
\usepackage{amsmath,mathtools}
\usepackage{array}

\begin{document}
\begin{tabular}{|p{.6in}|>{\setlength\columnwidth{5.8in}}p{5.8in}|}\hline
ODE&\vspace{-2em}\begin{gather*}
y^{\prime}-1-2 x=0
\end{gather*}
With initial conditions
$
\begin{aligned}
[y \left(0\right) = 3]
\end{aligned}
$
\\ \hline
program solution&\vspace{-1em}
\begin{align*}
y \left(x \right) = x^{2}+x +3
\end{align*}
Verified OK. 
\\ \hline
\end{tabular}

\end{document}

The pdf is

enter image description here

compiling to html using

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

gives

enter image description here

Here is the raw HTML generated. I see the missing math is there, but it is not displayed but it is sitting there doing nothing.

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title></title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='foo.css' rel='stylesheet' type='text/css' /> 
<meta content='foo.tex' name='src' /> 
<script>window.MathJax = { tex: { tags: "ams", }, }; </script> 
 <script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js' type='text/javascript'></script>  
</head><body> 
<div class='tabular'> <table class='tabular' id='TBL-1'><colgroup id='TBL-1-1g'><col id='TBL-1-1' /></colgroup><colgroup id='TBL-1-2g'><col id='TBL-1-2' /></colgroup><tr class='hline'><td></td><td></td></tr><tr id='TBL-1-1-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-1-1' style='white-space:normal; text-align:left;'> <!-- l. 18 --><p class='noindent'>ODE      </p></td>
                  <td class='td11' id='TBL-1-1-2' style='white-space:normal; text-align:left;'> <!-- l. 20 --><p class='noindent'>\begin {gather*}  y^{\prime }-1-2 x=0  \end {gather*} With initial conditions \( \begin {aligned} [y \left (0\right ) = 3] \end {aligned} \)
                                                                                                              </p></td></tr><tr class='hline'><td></td><td></td></tr><tr id='TBL-1-2-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-2-1' style='white-space:normal; text-align:left;'> <!-- l. 28 --><p class='noindent'>program 
solution   </p></td><td class='td11' id='TBL-1-2-2' style='white-space:normal; text-align:left;'> <!-- l. 31 --><p class='noindent'>\begin {align*}  y \left (x \right ) = x^{2}+x +3  \end {align*}
</p><!-- l. 32 --><p class='noindent'>Verified OK.                                                                                            </p></td>
</tr><tr class='hline'><td></td><td></td></tr></table>                                                                                 </div>
 
</body> 
</html>

Using TL 2022 on linux

>which tex4ht
/usr/local/texlive/2022/bin/x86_64-linux/tex4ht
>make4ht --version
make4ht version v0.3l
>

How to correct this so that the math shows up in HTML?

fyi, ticket added to tex4ht also here.

1 Answer 1

1

The aligned environment accepts optional argument in square brackets, so I think that MathJax just eats your math content enclosed in these brackets, and doesn't display it. You can use \left[ and \right] to work around this issue:

\documentclass[12pt]{book}
\usepackage{amsmath,mathtools}
\usepackage{array}

\begin{document}
\begin{tabular}{|p{.6in}|>{\setlength\columnwidth{5.8in}}p{5.8in}|}\hline
ODE&\vspace{-2em}\begin{gather*}
y^{\prime}-1-2 x=0
\end{gather*}
With initial conditions
$
\begin{aligned}
\left[y \left(0\right) = 3\right]
\end{aligned}
$
\\ \hline
program solution&\vspace{-1em}
\begin{align*}
y \left(x \right) = x^{2}+x +3
\end{align*}
Verified OK. 
\\ \hline
\end{tabular}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .