Inside optional parameters for theorem-like environment and also other macros (notable exception I could find: \title, see below), text is usually nospell. Moreover, the arguments of a \ref{....} or \cite{...} inside this optional parameter are spell.
Desired behaviour:
- text in optional parameter for theorem-like environment is spell-checked
- but text inside
\ref{...} or \cite{...} is never spell-checked
To try, just load the file below and :set spell.
\documentclass{article}
\begin{document}
This is good \ref{abc}
\begin{theorem}[This is ignored abc and this is bad \ref{abc}]
My theorem
\end{theorem}
More testing:
\centerline{This is good \ref{abc}}
\title[This is good \ref{abc}]{This is good \ref{abc}}
\author[This is bad \ref{abc}]{This is good \ref{abc}}
\usepackage[This is bad \ref{abc}]{This is bad \ref{abc}}
\mycommand[This is ignored: abc and this is bad: \ref{abc}]{This is good \ref{abc}}
\end{document}