I have defined several macros in my LaTeX report. For instance, following is a macro I defined for writing bold letter H. I have several macros like this I use throughout my work.
\newcommand{\channel}{\ensuremath{\mathbf{H}}}
Whenever I use \channel
, TeXstudio highlights it as red saying unknown-command. But it is indeed supported by the auto-completion feature. I want to stop TeXstudio from highlighting it as red (as it is annoying and affects readability). Is there any way to do this?
Update—
After seeing the comments, I realize I forgot to include a important thing. I always write these macros and package calls all inside a single file. Then I input this file in the LaTeX file I am writing. But now I guess I am asking a bit too much. I mean I require the software to recognize the macros which I have input from another file. Nevertheless I was wondering if there was any solution.
Best Answer
Normally, TeXstudio recognizes a
\usepackage{…}
in the main file and does load the auto-completion list (.cwl
), but TeXstudio isn’t intelligent enough to recognize packages loaded in external files.You could manually select the auto-completion lists for packages loaded in the external file, but then they are active in every document.
For custom commands I only see a solution with a custom
.cwl
file which, of course, has the same disadvantage (always active if not disabled).