For reasons that are beyond me, the following MWE

\documentclass{scrreprt}
\usepackage{classicthesis-ldpkg}
\usepackage{bm}
\usepackage{amsmath}

\begin{document}

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

\end{document}


fails to compile with the following error:

! TeX capacity exceeded, sorry [input stack size=5000].
\HyPsd@@LetCommand
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. Thanks. PS: by the way, I must add that this site is very beautiful indeed. -  May I also suggest using \DeclarePairedDelimiters instead of that pair of \mid? – Federico Poloni Apr 6 '12 at 21:26 ## 4 Answers 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. - 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.)

-

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.

-

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

\let\oldsection\section
\def\tmpl{\oldsection[]}
\let\section\tmpl


Cheers!

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
\makeatletter

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

\makeatother

-
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