我重新定义了文件中 \section 和 \section* 的配置cfg
以修改 HTML 输出,出现以下错误(见下面的屏幕截图)。我使用了amsart.cls
,当将类文件更改为article.cls
它时,编译没有错误。
cls
除了使用其他文件之外还存在什么问题article.cls
,请帮我纠正以下错误。
我浏览了一下文件make4ht.exe -l -a debug -u -c mycfg.cfg <filename>.tex
,Texlive 2022
我的CFG:
\RequirePackage{multirow}
\Preamble{xhtml,uni-html4,mathjax,charset=UTF-8,fn-in,NoFonts,ext=.xhtml}
\makeatletter
\Configure{section}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading1">}\ifnum\c@secnumdepth>0 \thesection.\space\fi}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading2">\ifnum\c@secnumdepth>1\thesubsection.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subsubsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading3">\ifnum\c@secnumdepth>2\thesubsubsection.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{paragraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading4">\ifnum\c@secnumdepth>3\theparagraph.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subparagraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading5">\ifnum\c@secnumdepth>4\thesubparagraph.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\makeatother
\Configure{likesection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{<p class="heading1">}}
{\HCode{</p>}}
\Configure{likesubsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{<p class="heading2">}}
{\HCode{</p>}}
\Configure{likesubsubsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{<p class="heading3">}}
{\HCode{</p>}}
\Configure{likeparagraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{<p class="heading4">}}
{\HCode{</p>}}
\Configure{likesubparagraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{<p class="heading5">}}
{\HCode{</p>}}
\begin{document}
\EndPreamble
梅威瑟:
\documentclass[numbers]{amsart}
\begin{document}
\section{Head Level 1}
In the random walk setting, however, invariant measures may fail to exist, and measures that are invariant on average-- i.e., stationary-- take their place. Kukutani showed that tationary measures always exist. Stationary measures can be thought of as a weaker analogue of invariant measures, and they serve many of the same purposes. Thus, it is useful to study when a given stationary measure is genuinely invariant, and when invariant measures exist in a random dynamical system at all.
\section*{Head Level 1}
In the random walk setting, however, invariant measures may fail to exist, and measures that are invariant on average-- i.e., stationary-- take their place. Kukutani showed that tationary measures always exist. Stationary measures can be thought of as a weaker analogue of invariant measures, and they serve many of the same purposes. Thus, it is useful to study when a given stationary measure is genuinely invariant, and when invariant measures exist in a random dynamical system at all.
\subsection{Head Level 2}
In the random walk setting, however, invariant measures may fail to exist, and measures that are invariant on average-- i.e., stationary-- take their place. Kukutani showed that tationary measures always exist. Stationary measures can be thought of as a weaker analogue of invariant measures, and they serve many of the same purposes. Thus, it is useful to study when a given stationary measure is genuinely invariant, and when invariant measures exist in a random dynamical system at all.
\subsection*{Head Level 2}
\end{document}
答案1
似乎该类确实不支持带星号的分段命令配置amsart
。我尝试从的配置文件中复制它们的定义article
,这修复了错误,但\Configure{likesection}
对输出代码没有任何影响,\Configure{section}
使用的是来自的代码。
我深入研究了源代码,发现该类amsart
使用的分段命令底层代码与标准 LaTeX 类不同。具体来说,原始\section
命令会调用\@sect
或\@ssect
命令,具体取决于星号的使用。在 中amsart
,它会\@sect
在两种情况下调用,因此 TeX4ht 提供的代码likesection
从未使用过。
\Configure{like...}
由于您对无星号分段命令的配置适用于无星号版本和有星号版本,因此最简单的解决方法是从配置文件中删除所有变体:
\RequirePackage{multirow}
\Preamble{xhtml,uni-html4,mathjax,charset=UTF-8,fn-in,NoFonts,ext=.xhtml}
\makeatletter
\Configure{section}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading1">}\ifnum\c@secnumdepth>0 \thesection.\space\fi}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading2">\ifnum\c@secnumdepth>1\thesubsection.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subsubsection}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading3">\ifnum\c@secnumdepth>2\thesubsubsection.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{paragraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading4">\ifnum\c@secnumdepth>3\theparagraph.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\Configure{subparagraph}{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{\Hnewline}%
\HCode{<p class="heading5">\ifnum\c@secnumdepth>4\thesubparagraph.\space\fi}}
{\ifvmode\IgnorePar\fi\EndP\HCode{}}
{\HCode{}}
{\HCode{</p>}\HtmlParOn\ShowPar \IgnoreIndent \par}
\makeatother
\begin{document}
\EndPreamble
结果如下:
<p class='heading1' id='head-level-'>1. <a id='x1-10001'></a>Head Level 1</p>
<!-- l. 9 --><p class='noindent'>In the random walk setting, however, invariant measures may fail to exist, and measures
that are invariant on average– i.e., stationary– take their place. Kukutani showed that
tationary measures always exist. Stationary measures can be thought of as
a weaker analogue of invariant measures, and they serve many of the same
purposes. Thus, it is useful to study when a given stationary measure is genuinely
invariant, and when invariant measures exist in a random dynamical system at
all.
</p>
<p class='heading1' id='head-level-1'>1. <a id='x1-2000'></a>Head Level 1</p>
<!-- l. 13 --><p class='noindent'>In the random walk setting, however, invariant measures may fail to exist, and measures
that are invariant on average– i.e., stationary– take their place. Kukutani showed that
tationary measures always exist. Stationary measures can be thought of as
a weaker analogue of invariant measures, and they serve many of the same
purposes. Thus, it is useful to study when a given stationary measure is genuinely
invariant, and when invariant measures exist in a random dynamical system at
all.
</p>
<p class='heading2' id='head-level-2'><a id='x1-30001.1'></a>Head Level 2</p>
<!-- l. 17 --><p class='noindent'>In the random walk setting, however, invariant measures may fail to exist, and measures
that are invariant on average– i.e., stationary– take their place. Kukutani showed that
tationary measures always exist. Stationary measures can be thought of as
a weaker analogue of invariant measures, and they serve many of the same
purposes. Thus, it is useful to study when a given stationary measure is genuinely
invariant, and when invariant measures exist in a random dynamical system at
all.
</p>
<p class='heading2' id='head-level-3'><a id='x1-4000'></a>Head Level 2</p>