You're actually not describing the problem correctly. When TeXstudio fails to recognize an environment, it is the \begin
and \end
that are highlighted red. For example if I add an environment foo
, I get this:
The "unrecognized command" popup comes from hovering the mouse cursor over \begin
. (Sorry, it didn't show up in screenshot.)
The problem you're facing is a different one: that you've used math mode-only code outside of math mode. The proof
environment does not start math mode. And TeXstudio tells you that this is the case:
Additional note
I just saw that you're using $$ ... $$
for displayed math. Don't do this, use \begin{equation*} ... \end{equation*}
or \[ .. \]
instead, see Why is \[ … \]
preferable to $$
?
amsmath
doesn't deal with theorem-like environments, that is whatamsthm
does. Try activating thecwl
foramsthm
.\usepackage{amsthm}
already, no need for more than one. But I think I realized your mistake. Theproof
environment itself is recognized (not highlighted in red), but the thing is that it is not a math environment. To use math inside aproof
, you need e.g.$...$
for inline math, or analign
environment for multi-line math with alignment.