TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For reasons that are beyond me, the following MWE



\section{The values of $\beta$ for which $\omega_i \mid \bm{\omega}
\mid^{-\beta}$ is defined at the origin}


fails to compile with the following error:

! TeX capacity exceeded, sorry [input stack size=5000].
<to be read again>
l.9 ...a} \mid^{-\beta}$ is defined at the origin}

I've tried increasing the amount of memory available to pdfLatex but that doesn't solve the problem. I've also googled to no avail. Is there a workaround for this problem.

share|improve this question
May I also suggest using \DeclarePairedDelimiters instead of that pair of \mid? – Federico Poloni Apr 6 '12 at 21:26
Please use the upvote button to thank other people. Discussion about a site should go to the meta site. – Masroor Jun 22 '14 at 23:32
up vote 35 down vote accepted

It looks like classicthesis-ldpkg has loaded hyperref which is trying to bookmark your section title and, because it contains maths, is throwing the (rather cryptic) error for you. The solution is pretty simple. Rewrite your \section command this way:

\section{The values of \texorpdfstring{$\beta$}{TEXT} %
     for which \texorpdfstring{$\omega_i \mid \bm{\omega}\mid^{-\beta}$}%
     {TEXT} is defined at the origin}

including some non-math text in the two location with the word "TEXT". The section title will contain the math typeset as you want, and the generated pdf bookmarks will contain whatever you substitute for TEXT.

share|improve this answer

I would suggest to supply an alternative section title for the table of contents via

\section[alternative title goes here]{The values of $\beta$ for which
        $\omega_i \mid \bm{\omega} \mid^{-\beta}$ is defined at the origin}

(As explained already, this alternative title mustn't contain any math.)

share|improve this answer

Welcome! This is maybe not the answer you want, but I think if you can avoid math expressions in section titles you should. First, arguments to \section move around which makes \section one of the so-called fragile commands. Also, fonts usually change between regular text, section headers, and TOC text, which could make it a headache to select the right math fonts. Finally, if your notation is defined in the previous section, someone scanning the TOC would not have any idea what that section is about. So I would just write it out in English if you can. "The best notation is no notation," says Halmos.

share|improve this answer
"The best notation is no notation": Yes, any innovative ideas to avoid it. – user877329 Jul 22 '15 at 13:57

Just posted this here, as a variant of @HendrikVogt's answer - try also this in your preamble:



EDIT: here's a slightly better snippet - the starred section should show up correctly (if it doesn't have math, that is); the non-starred version will show "TOC-ENTRY:x" in the TOC index (but otherwise sections will be typeset as they are in the document):

% http://www.tug.org/applications/hyperref/manual.html
% http://www.tex.ac.uk/cgi-bin/texfaq2html?label=cmdstar
% http://wiki.contextgarden.net/Commands_with_optional_arguments
% TeX tricks - Listing macros - http://www.volkerschatz.com/tex/show.html
% http://zoonek.free.fr/LaTeX/LaTeX_samples_section/0.html

\newcommand{\mysectionStar}[1]{  % no two arguments here?
\typeout{AAAA}% debug
\oldsection{#1} }
\newcommand{\mysectionNoStar}[1]{ %
\typeout{BBBB}% debug
\oldsection[TOC-ENTRY:\thesection]{#1} }

share|improve this answer
This has the side effect of a blank entry in the TOC. – Matthew Leingang Apr 5 '12 at 17:41
Thanks, @MatthewLeingang - didn't think of that when I posted - Cheers! – sdaau Apr 6 '12 at 8:06

Try protect'ing the section, as in \section\protect{This title contains mathematics such as $\beta_i$}

share|improve this answer
That doesn't work for me: it creates a blank entry in the table of contents, instead of the title of the indicated section. – Benjamin McKay Mar 9 '14 at 13:48
It also doesn't create a section heading, and instead treats the protected text as just part of the running text of the paper, not as a title of a section. – Benjamin McKay Mar 9 '14 at 13:49

I wanted to use math variables (letters, not symbols) in the section heading, so, based on @Kilgore's hint to use \texorpdfstring, I defined a \hmath command for math-like letters (well, just roman italic letters) in the section heading:


which is then used like

\section{Local \hmath $q$-adic refinement in \hmath $n$D}

The result is that those letters adapt the bold/non-bold setting of the surrounding text, i.e., they are bold and italic in the section heading, and just italic (not bold) in the Table Of Contents.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.