[texhax] trying to modify book.cls to automatically add TOC entry for \chapter* gives errors
Niall Mansfield
texhax at uit.co.uk
Wed May 7 18:12:19 CEST 2008
- Using book.cls
- Want to change \chapter*{} in order to:
* add a TOC entry
* set the running heads
so that we can use \chapter*{} for Preface, Foreword,
Glossary, etc.
The definition we took from book.cls is, after simplifying:
\def\@schapter#1{
\@makeschapterhead{#1}%
\@afterheading}
If we change that to do either of the things we want, e.g.:
\def\@schapter#1{
\@makeschapterhead{#1}%
\@afterheading
\addcontentsline{toc}{chapter}{#1}}
we get error:
! TeX capacity exceeded, sorry [input stack size=300].
\originalTeX ->\noextrasenglish
\let \originalTeX \@empty \lefthyphenmin =2\...
l.1 \select at language {english}
or, if we clear out the existing .toc file first, we get:
No file authdns.toc.
[1
! Undefined control sequence.
\\->\let \reserved at e
\relax \let \reserved at f \relax \@ifstar {\let \reserved...
l.60 \listoftables
However, if we change the added line to:
\addcontentsline{toc}{chapter}{foobar}
then it "works", i.e. runs without error, but it's useless
of course. The same pattern happens when we try to insert
\mkboth{#1}{#1}
into \@schapter.
I assume I'm doing something stupid, but I'm so confused
after trying this for hours that I can't think how to
start tracking it down. Help!
More information about the texhax
mailing list