# tex4ht: inline equations after subsubsection and theorem

MWE:

\documentclass{amsart}
\newtheorem{theorem}{Theorem}
\begin{document}
\section{SecTmp}
\subsection{SubsecTmp}
\subsubsection{SubsubsecTmp}
\begin{theorem}
\end{theorem}
Here, $$H_n^i(X)$$
\end{document}


Compiled by tex4ebook, the result expands each symbol of $$H_n^i(X)$$ into a line. I wonder why that happens, and a fix.

• I can confirm that this happens with tex4ebook. With make4ht, math is converted as an image and it looks correctly. Moreover, \subsection and \subsubsection are not converted as headings in both cases. So it looks like a brokent TeX4ht support for amsart. I will look into this, in the meantime article class with amsmath package works correctly. Nov 7, 2020 at 21:41

This issue is caused by a bug in theorem handling in TeX4ht. It seems that paragraph handling is confused after theorem end. Normally, a paragraph should be started before word "Here". But in this case, several paragraphs are inserted inside your math, which results in in parts of this expression split over multiple lines.

I've fixed it in TeX4ht sources. In the meantime, you can use the following .cfg file:

\Preamble{xhtml}
% \Configure{()}{\PicMath$}{$\EndPicMath}

\Configure{newtheorem}
{\ifvmode\IgnorePar\fi\EndP
{\HCode{</span>}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}\par\indent\ShowPar}
\let\MathPar\empty
\Configure{PicDisplay}
{\edef\MathPar{\ifvmode par-\fi}\IgnorePar\endgraf\EndP
\HCode{<div class="\MathPar math-display" \csname a:LRdir\endcsname >}}
{\HCode{</div>}\par\ShowPar}  {}  {class="\MathPar math-display" }
\Css{div.par-math-display, div.math-display{margin-left: auto; margin-right: auto;text-align:center;}}
\begin{document}
\EndPreamble


This is the result:

• Here is another issue: in place of theorem environment, if you use a displayed formula $$x^2+y^2=z^2$$, you will also see the same phenomenon. It could be fixed by replacing  (which is indeed deprecated in LaTeX) by $ and $ throughout, but is it possible to fix without that replacement? Nov 9, 2020 at 16:37
• @Yai0Phah I see. this is actually bug in tex4ebook itself, because it redefines some Math configurations and it introduces this issue in this case Nov 9, 2020 at 20:48
• @Yai0Phah I've added configuration for this issue to the config file in my answer Nov 9, 2020 at 22:05