# TeX capacity exceeded and parsing errors using decoration on chapter name with tex4ht

My first htlatex issue of 2014 and on the first day also :)

\chapter*{\centering \begin{normalsize}my chapter title\end{normalsize}}

which works fine with pdflatex, but htlatex gives

 ! TeX capacity exceeded, sorry [input stack size=5000].


When I removed the \centering, htlatex gave this error

(./foo2.aux) [1] [2] [1] [2] [3] [1] [2]
! Argument of \im:g has an extra }.
<inserted text>
\par
l.12 ...begin{normalsize}Abstract\end{normalsize}}


So, I am not really sure what is the problem. I basically wanted to make an Abstract like page in a book style, and found the above solution here which works really well with pdflatex, but for some reason htlatex having a problem parsing these commands inside the \chapter entry. It seems that it does not like Latex command inside \chapter{....} arguments. May be need to protect them? fragile issues? But pdflatex handles them just fine?

Is there a workaround this so I can simply have a title in middle of a page with htlatex?

MWE:

\documentclass[12pt]{book}%
\usepackage{lipsum}
\begin{document}
\frontmatter

\title{htlatex issue 010114}
\author{me}
\maketitle

\chapter*{\centering \begin{normalsize}my chapter title\end{normalsize}} %crash
%\chapter*{\begin{normalsize}Abstract\end{normalsize}} %parse error
%\chapter*{Abstract}  %only this work
\noindent
\lipsum[75]
\clearpage

\tableofcontents

\mainmatter

\chapter{one}
\section{one}
\lipsum[75]

\end{document}


command to compile:

>htlatex foo2.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.

.....
(/usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(/usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2013/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./foo2.aux) [1] [2] [1] [2] [3] [1] [2]
! TeX capacity exceeded, sorry [input stack size=5000].
\centering ->\let \\
\@centercr \rightskip \@flushglue \leftskip \@flushglue ...
l.10 ...rmalsize}my chapter title\end{normalsize}}
%crash
Output written on foo2.dvi (7 pages, 13108 bytes).
Transcript written on foo2.log.


some text from the log file showing where the problem:

LaTeX Font Info:    ... okay on input line 3.
--- file foo2.css ---
[1

] [2

] [1] [2

] [3]
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <14.4> on input line 8.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <7> on input line 8.
[1] [2]
! TeX capacity exceeded, sorry [input stack size=5000].
\centering ->\let \\
\@centercr \rightskip \@flushglue \leftskip \@flushglue ...
l.10 ...rmalsize}my chapter title\end{normalsize}}
%crash
If you really absolutely need more capacity,


Using TexLive 2013 on Linux mint.

To get the title centered, this works for htlatex:

\begin{center}
\chapter*{Abstract}  %only this work
\end{center}


So I can do what I want using the above solution. But will leave this question here since it shows a problem.

• I'd use a redefinition for \chapter* (that is \@schapter) so you don't feed htlatex the offending tokens. Jan 1, 2014 at 20:35

As I said in another question, you cannot put anything as parameter of sectioning commands, as it will be processed in order to make the TOC. so while it works in normal LaTeX, it doesn't work with tex4ht. So from conceptual point of view your workaround is in much better than your initial try. I think that instead of misusing \chapter command it would be better to use other means to solve your problem, which is abstract printing. What about new environment, which will solve also the need to put noindent and clearpage into document body?

\documentclass[12pt]{book}%
\usepackage{lipsum}
\def\abstracttitle{Abstract}
\newenvironment{abstract}{\begin{center}\abstracttitle\end{center}\par\noindent}{\clearpage}
\begin{document}
\frontmatter

\title{htlatex issue 010114}
\author{me}
\maketitle

\begin{abstract}
\lipsum[75]
\end{abstract}

\tableofcontents

\mainmatter

\chapter{one}
\section{one}
\lipsum[75]

\end{document}


I defined new environment, abstract, heading text is saved in macro \abstracttitle so it can be redefined if needed. This solution works out of the box with tex4ht: