Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). You can also use backticks ` to mark your inline code. –  Corentin Dec 14 '12 at 10:49
1  
\documentclass{article}\newcommand{\channel}{\ensuremath{\mathbf{H}}}\begin{doc‌​ument}\channel\end{document} works as expected in TeXStudio 2.5.1 with TL2012. No red highlighting. –  hpesoj626 Dec 14 '12 at 14:13
    
@hpesoj626 please see the update –  dineshdileep Dec 15 '12 at 2:05
    
@Corentin Thanks frnd!! –  dineshdileep Dec 15 '12 at 2:06

1 Answer 1

up vote 3 down vote accepted

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).

share|improve this answer
    
That is ok, I almost universally use them. where do I place that file? –  dineshdileep Dec 15 '12 at 2:58
1  
@dineshdileep See my linked answer for new Windows’s (%APPDATA%\texstudio\ ); the TeXstudio user manual also states: “This directory is placed in ~/.config/texstudio under linux and usually c:\Documents and Settings/User/AppData/Roaming/texstudio under windows.” –  Qrrbrbirlbel Dec 15 '12 at 3:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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