在 tex4ht 中重新配置类似定理的环境

在 tex4ht 中重新配置类似定理的环境

在配置类似定理的环境时,像下面的屏幕截图中那样在内联方程式时错误地插入了para标签,我试图纠正,但无法更新,如何达到预期的结果?

在此处输入图片描述

我的 cfg 是

\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

梅威瑟:

\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

出现此问题的原因是您没有在环境后开始新段落lemma。因此,后续文本不属于任何段落。为了解决此问题,make4ht会自动插入标签以解决验证问题。虽然这通常可以正常工作,但由于您使用非标准标签进行内联数学运算,<p><p>会为 > 之外的每一部分文本添加元素。<Inline-formula

您需要\par\ShowPar在您的环境配置中使用lemma以下段落来打开:

\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

结果如下:

 

<!-- 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>

相关内容