I have inside a verbatim environment, a description of some document. It is all verbatim. So TeXStudio should ignore everything inside it. For some reason, it is reading what is inside the verbatim, and sees \section in there, and it is showing this in the structure of the document itself. Which makes navigation very hard.

It is supposed to ignore this, since I made sure to add this environment in the Configure->Custom Highlighting and told it it is of type verbatim. Yet, it seems to make no difference. Here is MWE



\section{real section that should show in structure}

     \section{this should NOT show up in structure}
      example of a document
     \subsection{This should also NOT show up}


The strange thing is that it does color the verbatim environment in green, which tells me it knows it is not the same as the main document, but it shows those verbatim section in the structure. Here is screen shot

Mathematica graphics

And here is screen shot showing that verbatimwrite is added to custom highlighting as verbatim

Mathematica graphics

Mathematica graphics

The strange thing, if I change the environment name verbatim, now it works

Mathematica graphics

Is the custom highlighting broke in TexStudio? I am using latest and greatest.

Mathematica graphics

On windows 7, 64 bit.

Is there something else I can try to fix this? It is impossible to navigate the document like this, as it is large and I have many such environments there and they show up in the structure making it hard to know where one is.

Update, I assumed that all one had to do is tell texstudio that the env is verbatim type in the custome hightliting. Here is a link

Mathematica graphics

  • Your MWE does not compile, since verbatimwrite is not a standard LaTeX environment. Where is it defined? Jul 7, 2016 at 18:16
  • 1
    @StevenB.Segletes I have this defined in another file. But it should not affect the display part of TeXstudio? As long as it is told that it is verbatim type. But will add it (I wanted to make the MWE small). Just give me a minute.
    – Nasser
    Jul 7, 2016 at 18:18
  • It is possible that it doesn't get the sectioning information from the "custom highlighting", but rather from the aux file contents. If the latter is true, then how the environment is defined has everything to do with what ends up in the aux file. Jul 7, 2016 at 18:23
  • 1
    @StevenB.Segletes just updated the file. Now it compiles OK. And as you can see, it still shows those fake sections in the structure. I do not know about aux. I was told once as long as I set the env. to verbatim in the custom, it should ignore it and not show it in the document structure. I doubt that texstudio does more than this.
    – Nasser
    Jul 7, 2016 at 18:29

1 Answer 1


Essentially, Custom Highlighting is a dead end in development as it has proven to be too inflexible. It's likely to be removed in the future.

Instead, you should define a cwl file for your commands and declare them as verbatim:


More information on the cwl format can be found in the user manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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