# TeX Studio doesn't recognize certain amsmath commands even after loading packages

Here is my code:

As you can see, TeX Studio doesn't recognize the proof environment. Nonetheless, I have activated the amsmath package in the preferences:

So why isn't it working? I have tried restarting the PC to see if it would load the package but it didn't work.

I am using the ProTeXt packages. The output file looks fine.

• amsmath doesn't deal with theorem-like environments, that is what amsthm does. Try activating the cwl for amsthm. – Torbjørn T. Feb 26 '18 at 10:38
• @TorbjørnT. Did that, but still marks the syntax as incorrect. I've also added a \usepackage{asmthm} command at the beginning. – Anakhand Feb 26 '18 at 10:46
• You had \usepackage{amsthm} already, no need for more than one. But I think I realized your mistake. The proof environment itself is recognized (not highlighted in red), but the thing is that it is not a math environment. To use math inside a proof, you need e.g. $...$ for inline math, or an align environment for multi-line math with alignment. – Torbjørn T. Feb 26 '18 at 10:51
• Please, don't post screen shots, rather paste your code. – bmv Feb 26 '18 at 10:54
• @bmv I posted a screenshot rather than pasted the code because I wanted to show how TeX Studio was highlighting the syntax (to indicate that it didn't recognize it) – Anakhand Feb 26 '18 at 11:03

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:
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 ?