我正在用来htlatex
转换TeX to HTML
输出。
我尝试在使用该命令时保持 LaTeX 方程式不变\[...\]
。
我的配置:
\Preamble{xhtml,mathml,NLM,-xtpipes,NoFonts,refcaption,DocBook}
\newtoks\eqtoks
\def\AltMath#1\]{\eqtoks{\[#1\]}%
\HCode{\the\eqtoks}}
\Configure{[]}{\expandafter\AltMath}{}
\begin{document}
\EndPreamble
但是我没有在 HTML 输出中获得所需的 LaTeX 代码。编译过程中报告了大量错误:
! 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}}
梅威瑟:
\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}
如何纠正错误?如何获取 LaTeX Math 编码的 HTML 等效代码?请指教。
答案1
我认为你在这里犯的所有错误都只是一遍又一遍地重复同样的错误。你使用了很多\[math\]
用于 displaymath 的函数,而我认为您真正想要的是内联数学\(math\)
。而且我认为这个问题与htlatex
因为文档无论如何都不会编译。看看对于数学模式来说, ( 和 ) 比美元符号更可取吗?
在这里我只是简单地用相应的\[
和替换了所有的和的实例\]
\(
\)
的实例。根据提到的文章,您还应该替换任何$math$
-pair。这可能不是您想要的样子,但我不是通灵者。
我还注释掉了 -package 的用法caption
,无法真正看到你直接使用它,并且它在命令上引发了一个错误htlatex file.tex
,但是在注释掉它之后,没有产生任何错误。
注意:我对 htlatex 没有任何经验,尽管我认为我确实能够按照要求生成一个有效的 .html 文件而没有任何错误,但有更多经验的人应该详细说明。
注意fixltx2e
。加载它只会引发此警告:
软件包 fixltx2e 警告:2015 年以后的版本不需要 fixltx2e(fixltx2e)所有修复现在都在 LaTeX 内核中。
你也有满满的\hbox
。由于您正在生成“.html”文件,因此我认为这并不重要。
输出
代码
\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}