# How can I get TeXstudio's syntax highlighting to recognize an unknown command?

TeXstudio does not recognize the LaTeX command \rm (red highlighting in the document, with the message: unrecognized command), even after I activate all possible completion files (.cwl).

In such a case, what can I do so that TeXstudio recognizes a certain command for highlighting?

• Welcome to TeX.SE. I don't think \rm is a standard macro -- at least I never heard if it. – Peter Grill Sep 29 '12 at 22:56
• \rm has been declared obsolete some years ago and it's best not to use it, just like the companion commands \it, \bf, \sf and \tt. – egreg Sep 29 '12 at 22:57
• Please throw away your obsolete LaTeX documentation that suggested \rm (it has been deprecated since 1993) and get one more actually describing LaTeX2e. – Martin Schröder Sep 29 '12 at 23:35
• With the general wording of the question as it is now, I don't think there's any reason to close it as too localized. (Didn't really think there was one before that either.) – doncherry Oct 15 '12 at 13:44

This is still a recognized command (for legacy purposes), but should be avoided. See Does it matter if I use \textit or \it, \bfseries or \bf, etc. and Will two-letter font style commands (\bf, \it, …) ever be resurrected in LaTeX?.

TeXstudio does allow you to add commands that are not recognized to its list of known control sequences. Under Options -> Configure TeXstudio... check Show Advanced Options and add \rm to the list of Additional Commands as part of your Custom Highlighting:

Your document syntax highlight should change from

to

Another approach (perhaps better for legacy documents) is to replace any two-letter font style commands with their updated counterparts:

\renewcommand{\rm}{\rmfamily}
\renewcommand{\it}{\itshape}
%...


This renewal will also be picked up by TeXstudio.

• I wouldn't recommend to modify legacy documents in that way: \rm\it was different from \it\rm in LaTeX2.09 and still is with the two letter commands. The best is forgetting them altogether. – egreg Oct 15 '12 at 13:56
• In TeXstudio 2.6.6 (Windows) on my computer, this fix only works after restarting TeXstudio. – Cerran Feb 19 '14 at 15:44