显示方程式也需要转换为 HTML 标签 (TeX4ht)

显示方程式也需要转换为 HTML 标签 (TeX4ht)

是否可以在显示数学中获取 HTML 标签中的简单数学?我的标签如下:

\documentclass{book}

\begin{document}

This is for test $a+b=c$

\[
a+b=c\qquad p_1 = \frac{m}{x_1}- p_2.
\]

\[
ab
\]


\end{document}

在内联数学中,简单的数学运算,例如 $a+b=c$ 转换为 HTML 标签,但在显示数学中内容相同,然后它被转换为图像,但我需要简单的数学运算在显示和内联数学中都转换为 HTML 标签?请指教...

答案1

尝试以下配置:

\Preamble{xhtml}
\Configure{[]}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="displaymath">}\bgroup$$\everydisplay{}\everymath{}}{$$\egroup\HCode{</div>}}
\Configure{$$}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="displaymath">}\bgroup\everydisplay{}\everymath{}}{\egroup\HCode{</div>}}{}
\begin{document}
\EndPreamble

它配置\[\]$$...$$,并将数学放在<div class="displaymath">元素中。

结果:

在此处输入图片描述

<!--l. 5--><p class="noindent" >This is for test <span 
class="cmmi-10">a </span>+ <span 
class="cmmi-10">b </span>= <span 
class="cmmi-10">c</span>
</p>
   <div class="displaymath">
                     <span 
class="cmmi-10">a </span>+ <span 
class="cmmi-10">b </span>= <span 
class="cmmi-10">c     p</span><sub><span 
class="cmr-7">1</span></sub> = <img 
src="sample0x.png" alt="m-
x1"  class="frac" align="middle" /> <span 
class="cmsy-10">− </span><span 
class="cmmi-10">p</span><sub><span 
class="cmr-7">2</span></sub><span 
class="cmmi-10">.</span>
</div>
   <div class="displaymath">
                                <span 
class="cmmi-10">ab</span>
</div>

相关内容