2

When configuring the theorem like environment, the para tags are wrongly inserting when inline equations before like below in the screenshot, I tried to correct, but unable to update, How to achieve the expected result?

enter image description here

My cfg is

\Preamble{xhtml,uni-html4,mathjax,charset=UTF-8,fn-in,NoFonts,ext=.xhtml}

\NewConfigure{inlineeqn}{3}
\NewConfigure{displayeqn}{3}
\NewConfigure{reftag}{3}
\NewConfigure{citelink}{2}

\catcode`\:=11
\renewcommand\inlineeqn[2]{\a:inlineeqn#1\b:inlineeqn#2\c:inlineeqn}
\renewcommand\displayeqn[2]{\a:displayeqn#1\b:displayeqn#2\c:displayeqn}
\renewcommand\reftag[2]{\a:reftag#1\b:reftag#2\c:reftag}
\renewcommand\citelink[1]{\a:citelink#1\b:citelink}
\catcode`\:=12

\Configure{inlineeqn}{\HCode{<Inline-formula id="}}
                     {\HCode{">}}
                     {\HCode{</Inline-formula>}}
\Configure{displayeqn}{\HCode{<display-formula id="}}
                      {\HCode{">}}
                      {\HCode{</display-formula>}}


\ConfigureEnv{lemma}
         {\ifvmode \IgnorePar\fi \EndP\HCode{<statement>\Hnewline}}
         {\ifvmode \IgnorePar\fi \EndP\HCode{</statement>}}
         {}{}


\Configure{newtheorem}{\HCode{<label>}}{\HCode{</label>}\ifvmode\IgnorePar\fi\EndP\par}{}{}
 
\begin{document}


\EndPreamble

MWE:

\documentclass{book}

\usepackage{amsthm}
\def\inlineeqn#1#2{#2}
\def\displayeqn#1#2{#2}
\def\reftag#1#2{#1}
\def\citelink#1{#1}



\newtheorem{lemma}{Lemma}

\begin{document}


\begin{lemma}\label{th(2.2)}
 Let \inlineeqn{ineq1}{$M\in M_n({Z})$} be an expanding integer matrix, and let \inlineeqn{ineq2}{$D,L\subset{Z}^n$} be two finite digit
sets with the same cardinality. Then the following statements are equivalent.
 \end{lemma}
 Let \inlineeqn{ineq1}{$M\in M_n({Z})$} be an expanding integer matrix, and let \inlineeqn{ineq2}{$D,L\subset{Z}^n$} be two finite digit
sets with the same cardinality. Then the following statements are equivalent.


\begin{lemma}[Lemma Head]\label{th(2.3)}
 Let \inlineeqn{ineq1}{$M\in M_n({Z})$} be an expanding integer matrix, and let \inlineeqn{ineq2}{$D,L\subset{Z}^n$} be two finite digit
sets with the same cardinality. Then the following statements are equivalent.


 \end{lemma}

 Let \inlineeqn{ineq1}{$M\in M_n({Z})$} be an expanding integer matrix, and let \inlineeqn{ineq2}{$D,L\subset{Z}^n$} be two finite digit
sets with the same cardinality. Then the following statements are equivalent.


\end{document}

1 Answer 1

1

This problem arises because you're not starting a new paragraph after the lemma environment. As a result, the subsequent text doesn't belong to any paragraph. To resolve this, make4ht automatically inserts <p> tags to address validation issues. While this usually functions correctly, it adds <p> elements for every portion of text outside of the <Inline-formula> due to your usage of non-standard tags for inline math.

You need to use \par\ShowPar in your configuration for the lemma environment to open the paragraph:

\Preamble{xhtml,uni-html4,mathjax,charset=UTF-8,fn-in,NoFonts,ext=.xhtml}

\NewConfigure{inlineeqn}{3}
\NewConfigure{displayeqn}{3}
\NewConfigure{reftag}{3}
\NewConfigure{citelink}{2}

\catcode`\:=11
\renewcommand\inlineeqn[2]{\a:inlineeqn#1\b:inlineeqn#2\c:inlineeqn}
\renewcommand\displayeqn[2]{\a:displayeqn#1\b:displayeqn#2\c:displayeqn}
\renewcommand\reftag[2]{\a:reftag#1\b:reftag#2\c:reftag}
\renewcommand\citelink[1]{\a:citelink#1\b:citelink}
\catcode`\:=12

\Configure{inlineeqn}{\HCode{<Inline-formula id="}}
                     {\HCode{">}}
                     {\HCode{</Inline-formula>}}
\Configure{displayeqn}{\HCode{<display-formula id="}}
                      {\HCode{">}}
                      {\HCode{</display-formula>}}


\ConfigureEnv{lemma}
         {\ifvmode \IgnorePar\fi \EndP\HCode{<statement>\Hnewline}}
         {\ifvmode \IgnorePar\fi \EndP\HCode{</statement>}\par\ShowPar}
         {}{}


\Configure{newtheorem}{\HCode{<label>}}{\HCode{</label>}\ifvmode\IgnorePar\fi\EndP\par}{}{}
 
\begin{document}


\EndPreamble

This is the result:

 

<!-- l. 16 --><p class='indent'>   <label>
<a id='x1-2r1'></a>
Lemma 1.  </label></p>
<!-- l. 17 --><p class='indent'>   Let <Inline-formula id='ineq1'>\(M\in M_n({Z})\)</Inline-formula> be an expanding integer matrix, and let <Inline-formula id='ineq2'>\(D,L\subset {Z}^n\)</Inline-formula> be two finite digit
sets with the same cardinality. Then the following statements are equivalent.
</p>
   </statement>
<!-- l. 20 --><p class='indent'>   Let <Inline-formula id='ineq1'>\(M\in M_n({Z})\)</Inline-formula> be an expanding integer matrix, and let <Inline-formula id='ineq2'>\(D,L\subset {Z}^n\)</Inline-formula> be two finite digit sets
with the same cardinality. Then the following statements are equivalent.
</p>

You must log in to answer this question.

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