# tex4ht: strange rendering of inline math in subsection

MSE:

\documentclass{amsart}

\begin{document}
\section{Test C}
\subsection{Test Ca}
\begin{proof}
\end{proof}
Let $x\in\mathbb R$ be a real number, then we have $x^2\ge0$.
\end{document}

The output of tex4ebook (or htlatex) is strange: each mathematical character occupies a line. I wonder the reason and a workaround.

• Can you add a screenshot of the output to your question, and maybe the generated html code? Nov 4, 2021 at 19:15

## 1 Answer

The problem is that a new paragraph is not started after the proof environment. tex4ebook then adds paragraphs for every piece of text it finds, because you cannot have text outside paragraphs or other block-level elements in HTML. This configuration should fix it:

\Preamble{xhtml}
\ConfigureEnv{proof}{}{\par\ShowPar}{}{}
\begin{document}
\EndPreamble

It forces new paragraph after proof. I've added this also to TeX4ht sources, so the fix should be available in TL soon.

This is the result:

<h3 class='sectionHead' id='test-c'><span class='titlemark'>1. </span> <a id='x1-10001'></a>Test C</h3>
<!-- l. 8 --><p class='noindent'><span class='subsectionHead' id='test-ca'><span class='titlemark'>1.1. </span> <a id='x1-20001.1'></a><span class='cmbx-10'>Test Ca.</span></span>
</p>
<div class='proof'>
<!-- l. 10 --><p class='indent'>  <span class='head'>
<span class='cmti-10'>Proof.</span> </span><span class='qed'><span class='msam-10'>□</span></span>
</p>
</div>
<!-- l. 12 --><p class='indent'>  Let <span class='cmmi-10'>x </span><span class='cmsy-10'>∈ </span><span class='msbm-10'>ℝ </span>be a real number, then we have <span class='cmmi-10'>x</span><sup><span class='cmr-7'>2</span></sup> <span class='cmsy-10'>≥ </span>0.
</p>
• Why does it happen only in a subsection? I don't see this issue if it is in a section. Nov 5, 2021 at 16:31
• And this seems quite similar to an old fixed bug (tex.stackexchange.com/questions/569955). Are they due to the same reason? Nov 5, 2021 at 16:38
• @Yai0Phah The problem is that im Amsart, subsection eats next paragraph. When you have block element, like theorem, between subsection and next paragraph, the paragraph doesn't start properly. Section stands as it's own paragraph, so it doesn't have this problem. Anyway, I've updated make4ht to better handle text outside of paragraphs, so it shouldn't produce such ugly results in the future release. Nov 5, 2021 at 16:48