# Is it possible to use the code \section{} without the computer breaking?

After doing a mass substitution of a certain heading I had had in my document for \section{}, my document stopped compiling. It took me longer than I'd care to admit to figure out what caused it. What it seems to be is that a display  in a section heading makes it too irate to compile. Is there a good way around this? My way is just to end the \section{}, insert the , and resume with a \section*{} afterward, but this seems like it can't be the best way.

-
Additionally, the \section{} environment also doesn't seem to accept \overset{f}{\to}'' or \varinjlim''... – jdc Jan 8 '11 at 2:35

Use \protect to make \overset and \varinjlim robust:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\tableofcontents

\section{$\protect\overset{f}\to \protect\varinjlim$}
foo
\end{document}

-

Display math environments create a new paragraph, and that obviously won't work inside a header. Instead, you can use $\displaystyle some math$.

I don't really know why \varinjlim doesn't work in sectioning commands. I seems to be defined in some way that breaks the ToC mechanism. Providing an alternative for the table of contents, it compiles, but might not be exactly what you want:

\section[$\displaystyle \injlim_k M_k$]{$\displaystyle \varinjlim_k M_k$}


(This uses \injlim for the toc entry and \varinjlin for the actual section.)

-