27

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

2
  • 1
    Is this still reproducible with a recent version of TS? I think this has been fixed. Please confirm!
    – LaRiFaRi
    Commented Aug 28, 2015 at 7:44
  • 1
    @LaRiFaRi I'm sorry, I don't use TS anymore.
    – Zero
    Commented Jun 21, 2021 at 0:12

4 Answers 4

23

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.

4
  • 1
    Same can be done on Win7(x64)
    – Stat-R
    Commented May 7, 2013 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
    Commented Jul 10, 2013 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
    Commented Feb 19, 2014 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
    Commented Aug 28, 2015 at 8:29
1

See also FAQ: How does TeXstudio know about valid commands

0

When I was adding superscripts to one of my research articles, I ran into a similar problem. The easiest way I found was to wrap the text with $, which activates inline math mode.

Example:

 $ 1^{2} $

Result:

12

I hope this information can help.

0

Instalei o TeXstudio e dei a opção de novo. Ao tentear digitar o primeira linha de codigo recebo o erro...

unknown at 893035 (TXS-Version 4.3.1 R ) [bt] 000000000064dd70 ??? error: 487

1
  • 1
    This is not answer. And please write in English. Commented Oct 18, 2022 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .