2

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.

1
  • 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.
    – michal.h21
    Nov 7, 2020 at 21:41

1 Answer 1

3

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{<div class="newtheorem">}\par\noindent\HCode{<span class="head">}}
   {\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:

enter image description here

3
  • 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?
    – Yai0Phah
    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
    – michal.h21
    Nov 9, 2020 at 20:48
  • @Yai0Phah I've added configuration for this issue to the config file in my answer
    – michal.h21
    Nov 9, 2020 at 22:05

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.