[OS X TeX] Stack size limit error with hyperref

Will Robertson will at guerilla.net.au
Fri Mar 25 00:10:25 EST 2005

On 25 Mar 2005, at 2:53 PM, Richard Seguin wrote:

> So how do I get the $...$ string to be typeset in bold within the 
> section name, consistent with the rest of the name, and not crash 
> hyperref?

Hi Richard

The problem here is that section commands, by rights, should not 
contain formatting commands because they well may be used in other 
parts of the document (running headers and the table of contents, 
specifically). Any formatting you desire should be declared by 
redefining the article class's \section command or by using one of the 
various packages to do so.

In this case, I've just copy/pasted the definition from article.cls, 
changed \newcommand to \renewcommand, and added \boldmath to the end of 
the font command. \boldmath is to maths what \bfseries is to text, in 
case you haven't seen it before. Unfortunately the Table of Contents 
makes a similar oversight and we need to patch that up as well in 
exactly the same way.

Best of luck,
Will Robertson

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                      {-3.5ex \@plus -1ex \@minus -.2ex}%
                                      {2.3ex \@plus.2ex}%
\renewcommand*\l at section[2]{%
   \ifnum \c at tocdepth >\z@
     \addvspace{1.0em \@plus\p@}%
       \parindent \z@ \rightskip \@pnumwidth
       \parfillskip -\@pnumwidth
       \leavevmode \bfseries\boldmath
       \hskip -\leftskip
       #1\nobreak\hfil \nobreak\hb at xt@\@pnumwidth{\hss #2}\par
\section{No problem: $\int^{2\pi}_0\cos\theta\,\mathrm{d}\theta=0$}
Now in running text: $\int^{2\pi}_0\cos\theta\,\mathrm{d}\theta=0$.

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list