2

Is this possible to get the simple math as in HTML tag in display math? My tags are follows:

\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}

In inlinemath, simple math, example $a+b=c$ converted as HTML tag, but the same content in display math, then it was converted as image, but I need simple math should convert as HTML tag in both display and inline math? Please advise...

TeXnician
  • 33,589
MadyYuvi
  • 13,693

1 Answers1

1

Try this configuration:

\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

It configures both \[\] and $$...$$, the math is placed in <div class="displaymath"> element.

Result:

enter image description here

<!--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>
michal.h21
  • 50,697
  • what a lovely and fast reply! it is working fine...thanks a lot... – MadyYuvi Nov 27 '18 at 10:45
  • Sorry one more question, is it possible to convert \widehat, \widetitle, \langle and \rangle ? These tags are converted as image... – MadyYuvi Nov 27 '18 at 11:17
  • 1
    @MadyYuvi yes, there is still lot of commands that are converted as images, usually because it is not easy to convert them as HTML – michal.h21 Nov 27 '18 at 13:26