1

I redefined the configuration of \section and \section* in cfg file for modifying the HTML output, I am getting the below error (see the screenshot below). I used amsart.cls, when changing class file to article.cls it is compiling without error.

what is the issue when using other cls file apart from article.cls and help me to rectify the below error.

I run the file through make4ht.exe -l -a debug -u -c mycfg.cfg <filename>.tex and Texlive 2022

enter image description here

My 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

MWE:

\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 Answer 1

1

It seems that there really isn't any support for configurations of starred sectioning commands with the amsart class. I've tried to copy their definitions from the configuration file for article, which fixed the error, but \Configure{likesection} didn't have any effect on the output code, the code from \Configure{section} was used.

I've digged into the source codes and found that the amsart class uses a different underlying code for sectioning commands than the standard LaTeX classes. In particular, the original \section command calls either \@sect or \@ssect commands, depending on the use of the star. In amsart, it calls \@sect in both cases, so the code that TeX4ht provides for likesection is never used.

As your configurations for unstarred sectioning commands work for both unstarred and starred version, the simples fix is to simply remove all variants of \Configure{like...} from your config file:

\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

This is the result:

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .