What is the file to load the command \colon
to be recognized (as a known command) by TeXStudio? If I add it to the personal command it works but I guess that this command comes from some package.
ps: I'm talking about highlighting unknown commands.
ps2: I tried grep colon *.cwl
on my .config/texstudio
folder and I found
mathabx.cwl:\coloneq#Sm
mathabx.cwl:\eqcolon#Sm
mathtools.cwl:\vcentcolon#S
mathtools.cwl:\ordinarycolon#S
mathtools.cwl:\MT_activate_colon#S
mathtools.cwl:\MT_active_colon_true#S
that is, no \colon
command.
Best Answer
The macro
\colon
is defined inplain.tex
as a punctuation mark (:
is a relation symbol in math mode)and redefined by
amsmath
.Unfortunately, TeXstudio doesn’t recognize the command even if the
amsmath.cwl
completion file is selected.But we can create our own
.cwl
file. On Windows, custom.cwl
files are stored and recognized by TeXstudio in%appdata%\texstudio\completion\user
. In Linux in~/.config/texstudio/completion/user
. (more information in 4.13.4 cwl file placement)Create your own
.cwl
file, I named itcustom.cwl
. One line suffices:Notes:
m
declares it as a math mode command, the use of\colon
in text mode will still give you the unrecognized highlighting.S
, as I understand it, gives you recognizing (i.e. correct highlighting) but not completion.After saving the file
custom.cwl
start TeXstudio go to the “Options” menu and open the “Configure TeXstudio” dialog. In the “Completion” tab selectcustom.cwl
and apply your changes (“OK”).Code
Screenshots