0

I am using htlatex to convert TeX to HTML output.

I try to keep the LaTeX equations unchanged when using the \[...\] command.

my cfg:

\Preamble{xhtml,mathml,NLM,-xtpipes,NoFonts,refcaption,DocBook}

\newtoks\eqtoks 
\def\AltMath#1\]{\eqtoks{\[#1\]}% 
   \HCode{\the\eqtoks}}
\Configure{[]}{\expandafter\AltMath}{} 

\begin{document}
\EndPreamble

But i am not getting the required equivalent of the LaTeX code in the HTML output. Lots of errors are reported during the compilation:

! Missing $ inserted.
<inserted text> 
                $
l.19 B_{n}\subset
                  C_{n}\subset A_{n}, \textrm{  and  }\mu(A_{n}-B_{n})<\frac...

? 
! You can't use `\eqno' in math mode.
\endmathdisplay@a ...\df@tag \@empty \else \veqno 
                                                  \alt@tag \df@tag \fi \ifx ...
l.20 \end{equation}

? 
! Extra }, or forgotten $.
\b:equation ->\egroup 
                      \ifvmode \IgnorePar \fi \EndP \HCode {</td><td class="...
l.20 \end{equation}

? 
! Missing $ inserted.
<inserted text> 
                $
l.20 \end{equation}

? 
! Missing } inserted.
<inserted text> 
                }
l.20 \end{equation}

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
! Missing } inserted.
<inserted text> 
                }
l.26 \begin{table}[!t]

? 
[1] [2

]
! TeX capacity exceeded, sorry [input stack size=5000].
<to be read again> 
                   y
l.27 ... 2\], $Bi = 0.2$\[Bi = 0.2\]\label{tab:1}}

MWE:

\documentclass{book}

\usepackage[utf8]{inputenc}
\usepackage{fixltx2e}
\usepackage[numbers,compress]{natbib}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{upgreek}
\usepackage{hyperref}
\usepackage{graphics}
\usepackage{enumerate}

\begin{document}

\noindent {Proof:} Suppose $(\mathcal{X}, \mathcal{A}_{0}, \mu)$\[(\mathcal{X}, \mathcal{A}_{0}, \mu)\] is given. There exists a compact class $\mathcal{K}$\[\mathcal{K}\] that is \hbox{$\mu$\[\mu\]-approximates} $\mathcal{A}_{0}$\[\mathcal{A}_{0}\]. Let $\{A_{n}\}\subset \mathcal{A}_{0}$\[\{A_{n}\}\subset \mathcal{A}_{0}\] such that $A_{n}\searrow\emptyset$\[A_{n}\searrow\emptyset\]. We need to show that \hbox{$\mu(A_{n})\searrow\ 0$\[\mu(A_{n})\searrow\ 0\].} For given $\epsilon>0$\[\epsilon>0\], let $B_{n}\in \mathcal{A}_{0}$\[B_{n}\in \mathcal{A}_{0}\] and $C_{n}\in \mathcal{K}$\[C_{n}\in \mathcal{K}\], such that
\begin{equation}
B_{n}\subset C_{n}\subset A_{n}, \textrm{  and  }\mu(A_{n}-B_{n})<\frac{\epsilon}{2^{n}}.
\end{equation}

\[\begin{array}{lllll}
B_{n}\subset C_{n}\subset A_{n}, \textrm{  and  }\mu(A_{n}-B_{n})<\frac{\epsilon}{2^{n}}.
\end{array}\]

\begin{table}[!t]
\caption{Variatation of shear stress, Nusselt number and Sherwood number at $y = d$\[y = d\] and $y = 1$\[y = 1\] while taking parameters $K_{R} =2$\[K_{R} =2\], $\alpha _{\text{T}} = 2$\[\alpha _{\text{T}} = 2\], $\alpha _{\text{c}} = 2$\[\alpha _{\text{c}} = 2\], $G_{C} =2$\[G_{C} =2\], $G_{r} = 2$\[G_{r} = 2\], $P_{r} =0.71$\[P_{r} =0.71\], $S_{c} =0.96$\[S_{c} =0.96\], $t = 2$\[t = 2\], $M = 2$\[M = 2\], $Bi = 0.2$\[Bi = 0.2\]\label{tab:1}} 
{\tabcolsep=20.4pt\begin{tabular*}{\textwidth}{lrrrrrrr} 
  & ${\tau }_{f0}$\[{\tau }_{f0}\] & ${\tau }_{f1}$\[{\tau }_{f1}\] & \textit{Nu}\textsubscript{0} & \textit{Nu}\textsubscript{1} & \textit{Sh}\textsubscript{0} & \textit{Sh}\textsubscript{1} \\  
\midrule
$\beta $\[\beta \] \\
\quad 2.0 & 0.03699 & 0.01833 &  &  &  &  \\  
\quad  3.0 & 0.04127 & 0.02063 &  &  &  &  \\  
\quad  4.0 & 0.04380 & 0.02200 &  &  &  &  \\  
$Bi$\[Bi\] \\
\end{tabular*}}{}
\end{table}

\begin{enumerate}
\item[$k_{\lambda}{_{1w}}$\[k_{\lambda}{_{1w}}\]] Radiation absorption coefficient at the wall 

\item[$e_{b{\lambda}_{1}}$\[e_{b{\lambda}_{1}}\]]  Plank's function  
\end{enumerate}

\end{document}

How to rectify the errors? How to get the HTML equivalent of the LaTeX Math coding? Please advise.

CS Kumar
  • 1,253
  • i've edited the text of the question, since your native language is most likely not english. if i have misinterpreted your intention, please point out the problems and i'll be happy to fix them. – barbara beeton Jun 22 '16 at 13:50
  • is this question resolved? – Runar Jun 30 '16 at 11:58

1 Answers1

2

I think all of your errors here are simply the same error repeated over and over. You use a lot of \[math\] which is used for displaymath, when I think you really want inline math, with \(math\). And I don't think this question has much to do with htlatex since the document won't compile anyway. Have a look at Are ( and ) preferable to dollar signs for math mode?

Here I just simply replaced all instances of \[ and \] with the correspending \( and \). You should also replace any $math$-pair, according to mentioned article. It might be this is not how you intended it to look like, but I'm not psychic.

I also commented out the usage of the caption-package, cannot really see that you are using it directly, and it threw an error on the command htlatex file.tex, but after commenting it out, no error was produced.

Note: I have zero experience with htlatex, and even thought I did manage to produce a working .html-file as requested without any errors, somebody with more experience should elaborate.

Note that fixltx2e is not needed anymore, for releases beyond 2015.Loading it will just throw this warning:

Package fixltx2e Warning: fixltx2e is not required with releases after 2015 (fixltx2e) All fixes are now in the LaTeX kernel.

You have also an overfull \hbox. Since you are producing a '.html'-file, I don't think it matters.

Output

enter image description here

Code

\documentclass{book}

\usepackage[utf8]{inputenc}
%\usepackage{fixltx2e} % Not neeeded anymore
\usepackage[numbers,compress]{natbib}
\usepackage{booktabs}
%\usepackage{caption}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{upgreek}
\usepackage{hyperref}
\usepackage{graphics}
\usepackage{enumerate}

\begin{document}

\noindent {Proof:} Suppose $(\mathcal{X}, \mathcal{A}_{0}, \mu)$\((\mathcal{X}, \mathcal{A}_{0}, \mu)\) is given. There exists a compact class $\mathcal{K}$\(\mathcal{K}\) that is \hbox{$\mu$\(\mu\)-approximates} $\mathcal{A}_{0}$\(\mathcal{A}_{0}\). Let $\{A_{n}\}\subset \mathcal{A}_{0}$\(\{A_{n}\}\subset \mathcal{A}_{0}\) such that $A_{n}\searrow\emptyset$\(A_{n}\searrow\emptyset\). We need to show that \hbox{$\mu(A_{n})\searrow\ 0$\(\mu(A_{n})\searrow\ 0\).} For given $\epsilon>0$\(\epsilon>0\), let $B_{n}\in \mathcal{A}_{0}$\(B_{n}\in \mathcal{A}_{0}\) and $C_{n}\in \mathcal{K}$\(C_{n}\in \mathcal{K}\), such that
\begin{equation}
B_{n}\subset C_{n}\subset A_{n}, \textrm{  and  }\mu(A_{n}-B_{n})<\frac{\epsilon}{2^{n}}.
\end{equation}

\(\begin{array}{lllll}
B_{n}\subset C_{n}\subset A_{n}, \textrm{  and  }\mu(A_{n}-B_{n})<\frac{\epsilon}{2^{n}}.
\end{array}\)

\begin{table}[!t]
\caption{Variatation of shear stress, Nusselt number and Sherwood number at $y = d$\(y = d\) and $y = 1$\(y = 1\) while taking parameters $K_{R} =2$\(K_{R} =2\), $\alpha _{\text{T}} = 2$\(\alpha _{\text{T}} = 2\), $\alpha _{\text{c}} = 2$\(\alpha _{\text{c}} = 2\), $G_{C} =2$\(G_{C} =2\), $G_{r} = 2$\(G_{r} = 2\), $P_{r} =0.71$\(P_{r} =0.71\), $S_{c} =0.96$\(S_{c} =0.96\), $t = 2$\(t = 2\), $M = 2$\(M = 2\), $Bi = 0.2$\(Bi = 0.2\)\label{tab:1}} 
{\tabcolsep=20.4pt\begin{tabular*}{\textwidth}{lrrrrrrr} 
  & ${\tau }_{f0}$\({\tau }_{f0}\) & ${\tau }_{f1}$\({\tau }_{f1}\) & \textit{Nu}\textsubscript{0} & \textit{Nu}\textsubscript{1} & \textit{Sh}\textsubscript{0} & \textit{Sh}\textsubscript{1} \\  
\midrule
$\beta $\(\beta \) \\
\quad 2.0 & 0.03699 & 0.01833 &  &  &  &  \\  
\quad  3.0 & 0.04127 & 0.02063 &  &  &  &  \\  
\quad  4.0 & 0.04380 & 0.02200 &  &  &  &  \\  
$Bi$\(Bi\) \\
\end{tabular*}}{}
\end{table}

\begin{enumerate}
\item[$k_{\lambda}{_{1w}}$\(k_{\lambda}{_{1w}}\)] Radiation absorption coefficient at the wall 

\item[$e_{b{\lambda}_{1}}$\(e_{b{\lambda}_{1}}\)]  Plank's function  
\end{enumerate}

\end{document}
Runar
  • 6,082
  • @runatrollet I need a two output 1)math should be converted MathML Code 2) and the same math latex code is needed. so i am using this above option \[ \]. Now i am changing as per your ideas like \[ \] replaced \( \) . fixltx2e to be comment. Change cfg file \[ \] to \( \). I am using the compilation commands like htlatex sam.tex my. But still the error to be throw ! Missing $ inserted. How to rectify this issue. please advice – CS Kumar Jun 22 '16 at 09:48
  • I commented out \usepackage{caption} from my answer since it ran an error on htlatex file.tex and then it produced an html file, which seems to be a correct file. – Runar Jun 22 '16 at 13:18