I'm getting the error:
TeX capacity exceeded, sorry [input stack size=5000]
Under the following very specific combination of packages and document class:
\documentclass{scrreprt}
\usepackage{hyperref}
\usepackage{flexisym}
\begin{document}
\chapter{When $\ne$.}
\end{document}
Removing either the hyperref, or flexisym package references, or changing the document class to article from scrreport, or removing the math content from the \chapter (or \section or \subsection) heading, appears to eliminate the issue.
This looks pretty similar to "TeX capacity exceeded" because of a couple of raiseboxes in a \section?
but changing the chapter reference to:
\chapter{When \protect$\ne$.}
doesn't seem to help. Is this a bug in one of the packages above? If not, what's the proper way to deal with this?