I'm starting to use TeXStudio. I'm having some issues, for example with


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

  • Is this still reproducible with a recent version of TS? I think this has been fixed. Please confirm! – LaRiFaRi Aug 28 '15 at 7:44

TeXStudio recognises commands that it finds in files ending with .cwl. The \eqref command and the align* environment come from the amsmath package, so you need to make sure that amsmath.cwl is loaded. Under some circumstances, this will happen automatically, but the mechanism isn't foolproof (e.g. it doesn't know that amsmath can be loaded indirectly via \usepackage{mathtools}).

On a Mac, you can ensure that amsmath.cwl is loaded by going to

TeXStudio --> Preferences

selecting Completion on the left and checking the box next to amsmath.cwl. Presumably the procedure is similar on other operating systems. If the other unrecognised commands also come from packages for which TeXStudio has cwl files, activate these as well. Section 1.4 of the TeXStudio manual explains how to add your own cwl file for commands that do not come from standard packages.

  • 1
    Same can be done on Win7(x64) – Stat-R May 7 '13 at 14:41
  • 1
    I have activated the same, but it does not seemed to work. Most of the math symbols like \alpha,^,_ are highlighted. When I build the pdf I don't have a problem – soori Jul 10 '13 at 3:27
  • This fix worked for me yesterday in TeXstudio 2.6.6 but isn't working today. The computer was shut down overnight. For example, \euro{} produces the proper output () but is considered an "unrecognized command", even though I have the eurosym.cwl selected as a completion file. – Cerran Feb 19 '14 at 10:14
  • @Cerran do gedit ~/.config/texstudio/eurosym.cwl and add \EUR{amount} \euro \geneuro#* \geneuronarrow#* \geneurowide#* \officialeuro#* \eurobars#* \eurobarsnarrow#* \eurobarswide#* (one command per line) – LaRiFaRi Aug 28 '15 at 8:29

See also FAQ: How does TeXstudio know about valid commands

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.