# [texhax] clash of babel and tableofcontents

Axel E. Retif axel.retif at mac.com
Sun Mar 26 13:41:19 CEST 2017

Hi

I have a problem I'd never experienced before: I have typeset a 200+
pages book, using

\usepackage[spanish,es-nolayout,es-noshorthands]{babel}

(but, please, note that *the same error below happens* if I change it to
\usepackage[english]{babel}).

Everything went fine, without any problem. Now I need to typeset the
Contents and I get this error

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

--- TeX said ---
\T1-cmd ...otect \@typeset at protect \@inmathwarn #1
\else \noexpand
#1\expanda...l.306 \tableofcontents

I've seen this code in

https://github.com/ho-tex/hyperref/blob/master/hyperref.dtx

but I don't use hyperref and in the log file I don't see any other

If I comment out babel, then the Contents typesets OK.

I've even unincluded every chapter with the exception of the Prologue
(no math, no figures...) and it's the same: either babel or
\tableofcontents, but with both I get the above error.

As working with just the Prologue I don't need any of the packages I
use, I've commented them out one by one and the same thing happens ---I
can't use babel and \tableofcontents at the same time.

TIA and best regards

Axel