Here is (almost) minimal example of the file, which gives the error.
\documentclass{article}
\usepackage{amsmath}
\usepackage[english]{babel}
\begin{document}
\section{Section name with varinjlim: $\varinjlim$}
\end{document}
Running pdflatex gives 4 identical errors of the form
minimal.tex:5: Illegal parameter number in definition of \reserved@a. [...{Section name with varinjlim: $\varinjlim$}]
Adding \tableofcontents gives 12 additional errors of the form
\minimal.toc:2: Only one # is allowed per tab. [...m \p@ \kern -\ex@ }\cr }}}}\nmlimits@ $}{1}]
Is there a way to avoid these, and still put \varinjlim in the section name?
\protectwhen it's in a "moving" environment (this means anything that may appear somewhere else, such as in the toc, or a running head, or ...). – barbara beeton Apr 06 '15 at 17:43