# TeXstudio: How to add custom highlighting for custom environment?

Until there is a cwl file for the paralist package, I would like to just include the compactenum environment into the custom highlighting list in the TeXstudio Options. I tried adding compactenum in the custom environment column, but to no avail.

Even after a restart of TeXstudio, \begin{compactenum} and \end{compactenum} were still highlighted in red

Is there something I'm missing? How do you add a custom environment to TeXstudio? The custom command \possessivecite that you can see in the first screenshot is working fine...

-

Actually, it's not you who is missing something, but the Custom Highlighting. It's an unfinished feature. See the FAQ for what it can(not) do.

If it's just about telling the syntax checker, you should use a custom cwl file. Note, that TXS autogenerates a cwl file by inspecting the package. But this mechanism is not perfect due to the complexity of LaTeX. Therefore it may not find all specified commands. You are welcome to take this cwl as a starting point, add the missing commands and provide it to us, so we can include it in TXS.

For instance to tell the syntax checker and completer that there is the compactenum environment just add the following line to your custom cwl file:

\begin{compactenum}#\env

-
Wow! Great to hear about the autogeneration of cwl files (I had only looked at the offline help). I guess that did not happen in my case because I'm including my header via \input{header.tex}. I tried what happened if I paste it directly into the main file, but as you say: it's not perfect yet. \compactenum, for example was recognized as a command but not as an environment. I haven't had the time yet to work my way towards writing my own cwl files, but I found a few on the net that I use (esp. csquotes.cwl). Look here: bit.ly/WpiKcG –  Christoph Mar 16 '13 at 16:44
The concept of cwl files originally comes from Kile. Note however, that TXS has expanded it to include things like cursor and placeholder positions as well as semantic and contextual meaning. You can perfectly use cwl files generated for Kile, but then you may not exploit all capabilities TXS offers. Therefore we ship our own cwls. –  Tim Hoffmann Mar 18 '13 at 0:25
@TimHoffmann Could you perhaps also look at \RequirePackage statements of the packages? I have a custom package with lots of commands and a bunch of standard packages required (the ams packages for example). –  AlexR Nov 6 '14 at 20:09
@AlexR: What do you want exactly? The package parser already detects \ReqirePackage commands and adds a corresponding #include to the cwl file. –  Tim Hoffmann Nov 7 '14 at 22:12
@TimHoffmann I couldn't get it to even look into my (own) package. It's in the same directory as the .tex files and it is a .sty file. Do I need to generate a .cwl for it? If yes, how do I do that? –  AlexR Nov 10 '14 at 8:13