I am getting an error when I use the command \bm
in a section title that is numbered, when the package hyperref
is loaded. Here is the error:
ERROR: TeX capacity exceeded, sorry [input stack size=5000].
— TeX said — to be read again>
{ l.10 …ction{A proof of convexity in $p,\bm{w}$}
and here is the MWE
\documentclass{article}
\usepackage{bm}
\usepackage[bookmarks]{hyperref}
\begin{document}
\section{A proof of convexity in $p,\bm{w}$}
\end{document}
Note that I can get avoid the error if I do any of the following
- use
\section*
instead of\section
(and this really intrigues me!) - remove the
\bm{}
from the title - remove the package
hyperref
I noticed there is a question similar to mine (such as this) but the solution seems not to be related to my problem.
Does anyone know how to solve this?
Best Answer
The PDF bookmarks can not have formatting, so you can either
Use
\texorpdfstring
within the\section
command to provide the alternate text to be used for the bookmakrs:Or use
\pdfstringdefDisableCommands
to disable the macros (thanks to Stephan Lehmke for pointing this out):I prefer this approach as it does not clutter up your main text.
Code:
\texorpdfstring
:Code:
\pdfstringdefDisableCommands
: