Frequently Asked Question List for TeX


Capacity exceeded [semantic nest …]

! TeX capacity exceeded, sorry [semantic nest size=100].
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

Even though TeX suggests (as always) that enlargement by a wizard may help, this message usually results from a broken macro or bad parameters to an otherwise working macro.

The “semantic nest” TeX talks about is the nesting of boxes within boxes. A stupid macro can provoke the error pretty easily:

\def\silly{\hbox{here's \silly being executed}}

The extended traceback (see general advice on errors) does help, though it does rather run on. In the case above, the traceback consists of

\silly ->\hbox {
                here's \silly being executed}

followed by 100 instances of

\silly ->\hbox {here's \silly 
                              being executed}

The repeated lines are broken at exactly the offending macro; of course the loop need not be as simple as this — if \silly calls \dopy which boxes \silly, the effect is just the same and alternate lines in the traceback are broken at alternate positions.

There are in fact two items being consumed when you nest boxes: the other is the grouping level. Whether you exhaust your semantic nest or your permitted grouping levels first is controlled entirely by the relative size of the two different sets of buffers in your (La)TeX executable.

FAQ ID: Q-semanticnest