tex4ht 给出 !Package amsmath 错误:\tag 此处不允许

tex4ht 给出 !Package amsmath 错误:\tag 此处不允许

这可能是 tex4ht 中已知的限制,我不知道。但下面的 MWE 给出了错误

! Package amsmath Error: \tag not allowed here.

仅在使用 运行时make4ht。lualatex 和 pdflatex 均无错误。

\documentclass[11pt]{article}
\usepackage{amsmath} 

\begin{document}
\[
x=y \tag{1}
\]
\end{document}

输出为

>make4ht  foo.tex
.....
LaTeX2e <2017/01/01> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(./foo.tex (/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
....
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./foo.aux)

! Package amsmath Error: \tag not allowed here.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                                                                                    
l.7 x=y \tag
            {1}
? 

列出文件

*File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2016/11/05 v2.16a AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names

版本

which make4ht
/usr/local/texlive/2016/texmf-dist/scripts/make4ht/make4ht

上述已知问题是否与 make4ht 有关?我应该如何解决这个问题?我需要更改\[..\]\begin{align}....\end{align}使用\tag{}tex4ht 吗?make4ht 没有错误。只有在使用带有标签时才会出错\[..\]

答案1

Amsmath 重新定义了\[\]生成了\begin{equation*}resp. \end{equation*}tex4ht将其重新定义为不同的东西,因此\tag在这里不再起作用。您可以amsmath自己尝试定义:

\Preamble{xhtml}

\DeclareRobustCommand{\[}{\begin{equation*}}
\DeclareRobustCommand{\]}{\end{equation*}}
\begin{document}
\EndPreamble

结果如下:

在此处输入图片描述

相关内容