I'm starting to use TeXStudio. I'm having some issues, for example with
\begin{align*}
\sqrt[n]{a}^2-\sqrt[n]{ab}&=m\sqrt[n]{a}\\
\end{align*}
When i put the point on align*
i get a small message unrecognized command, when it is in \sqrt
or ^
i get the message math command outside math env, and something similar happens with &
when it gives me the message tabular command outside tabular env. These commands are highlighted with an orange background.
I have similar mistakes with \eqref
,\implies
. Some commands as \title
,\author
or \sqrt
(when it is between dollar signs) don't present any problem.
When i build the PDF, i have no problems at all and it gives me the desired result.
I'd like that TeXStudio recognize these commands
Best Answer
TeXStudio recognises commands that it finds in files ending with
.cwl
. The\eqref
command and thealign*
environment come from theamsmath package
, so you need to make sure thatamsmath.cwl
is loaded. Under some circumstances, this will happen automatically, but the mechanism isn't foolproof (e.g. it doesn't know thatamsmath
can be loaded indirectly via\usepackage{mathtools}
).On a Mac, you can ensure that
amsmath.cwl
is loaded by going toselecting
Completion
on the left and checking the box next toamsmath.cwl
. Presumably the procedure is similar on other operating systems. If the other unrecognised commands also come from packages for which TeXStudio hascwl
files, activate these as well. Section 1.4 of the TeXStudio manual explains how to add your owncwl
file for commands that do not come from standard packages.