# Getting WinEdt to ignore lstlisting

WinEdt 9.0 gives me incorrect TOC in its side panel when I use listings package to illustrate a piece of LaTeX code:

How can I get WinEdt to ignore \begin{lstlisting} ...\end{lstlisting} (and every other verbatim environments) in its structure collection process?

The closest question I can find in this site is this: Incorrect tree view of document structure with Winedt, VerbatimPlus and listings package But I could not resolve my problem using the solution there.

Anybody?

• What happens if you try the solution given in that other question? Are you using VerbatimPlus as well? – T. Verron Nov 20 '14 at 10:02
• @T.Verron. It solves different problem I think. Moreover, somehow I could not find the problematic string in my WinEdt's Input.ini file (my guess it's inserted by VerbatimPlus, I'm not sure). And no, I'm not using VerbatimPlus. Just listings, as shown above. – fajar Nov 20 '14 at 12:06
• The question is indeed about another problem, my bad. However, from what I understand, the OP was using Verbatimplus precisely to achieve what you want (note how the "Not to be shown in tree view" section disappeared between his two screenshots. – T. Verron Nov 20 '14 at 13:12
• @T.Verron. Ah, yes, I did not know that VerbatimPlus is a plugin for WinEdt. My bad. I installed it and, voila, problem solved! If you could just make it an answer, I'll gladly accept it. Thanks! – fajar Nov 20 '14 at 14:47
• Hi @fajar. I made the question you mentioned. You will only have to edit the lines in edit.ini if you use lstinputlisting to include latex code with sectioning commands. Besides that all work fine, as far as I know. – Smarzaro Nov 21 '14 at 2:34

The first part of the the answer is clear from the comments above.

WinEdt only recognises verbatim as a "verbatim" environment. If you want more control on these kind of environments you have to install the plugin of mine VerbatimPlus. With this, you have support for environments coming from the following packages: listings, moreverb, verbatim and fancyvrb.

Now, if you want to add your personal environments to the list of supported ones, follow these steps. Let's suppose that you have created a new environment cplusplus through the \lstnewenvironment command.

Go to "Options" -> "Options Interface" and double-click the "Switches" item:

A local copy of Switches.ini gets opened. In this file, let's say after the lines

SWITCH="\begin{verbatim*} .. \end{verbatim*}"
ENABLED=1
MODE_FILTER="TeX|INS;STY;AUX"
START="\"
STOP="\"
HIGHLIGHT_START=0
STEP_OVER_STOP=1
HIGHLIGHT_STOP=0
SCOPE=4
DOMINANT_PRIORITY=0
STRICT_PRIORITY=1
PRIORITY=9
INDENTED=0
BOLN_ONLY=0
CASE_SENSITIVE=1
VERBATIM=1
START1_TRIGGER=""
START2_TRIGGER="begin{verbatim*}"
STOP1_TRIGGER=""
STOP2_TRIGGER="end{verbatim*}"
TEXT_COLOR="xclVerbatim"
DEFAULT_FONT=1
CUSTOM_BACKGROUND=1
TRANSPARENT=128
BACKGROUND_COLOR="xclEnvBk"
RELATIVE_RIGHT_MARGIN=1
RIGHT_MARGIN=0
INDENTED_LEFT_MARGIN=0
LEFT_MARGIN=0


SWITCH="\begin{cplusplus} .. \end{cplusplus}"
ENABLED=1
MODE_FILTER="TeX|INS;STY;AUX"
START="\"
STOP="\"
HIGHLIGHT_START=0
STEP_OVER_STOP=1
HIGHLIGHT_STOP=0
SCOPE=4
DOMINANT_PRIORITY=0
STRICT_PRIORITY=1
PRIORITY=9
INDENTED=0
BOLN_ONLY=0
CASE_SENSITIVE=1
VERBATIM=1
START1_TRIGGER=""
START2_TRIGGER="begin{cplusplus}"
STOP1_TRIGGER=""
STOP2_TRIGGER="end{cplusplus}"
TEXT_COLOR="xclVerbatim"
DEFAULT_FONT=1
CUSTOM_BACKGROUND=1
TRANSPARENT=128