# Incorrect tree view of document structure with Winedt, VerbatimPlus and listings package

I´m having some trouble working with Winedt 8 and 9 and VerbatimPlus add-on. Here is my MWE.

File "main.tex"

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc} % Codificação da entrada
\usepackage{lmodern}        % Fonte Latin Modern
\usepackage[T1]{fontenc}    % Codificação da Saída
\usepackage[brazil]{babel}  % Português Brasil
\usepackage{listings}

\begin{document}
\section{Teste}
% including file with document divisions
\lstinputlisting{listingerror.tex}

\begin{lstlisting}
\section{Not to show in Tree view}
\begin{tabular}
\end{lstlisting}

\end{document}


File "listingerror.tex"

\chapter{chap1}
\section{sec1}
\subsection{subsec}
\subsubsection{subsec}
\paragraph{par}


To understand the problem just look at the images below. The first shows the Winedt 9 tree view of the document structure without the VerbatimPlus installed. It´s the known problem of Winedt not working right with verbatim-like environments like lstlisting

The second image shows the same file but now with the VerbatimPlus installed. The problem is that the syntax highlight is correct, but the tree view is not. It´s gathering the content of the lstinputlisting as real divisions of the document not considering it´s a verbatim environment.

I hope I made myself clear about the problem. What I want is have the correct tree view and corret highlight of the document in winedt. Anybody knows how to fix it?

• Thanks @T.Verron I read a lot here but it´s my first question. Hope everything is ok with the rules of the tex.sx. – Smarzaro Nov 14 '14 at 11:12

## Update (2017-02-14)

The workaround desribed in this answer is not needed anymore if you upgrade to WinEdt 10.2.

WinEdt 10.2 considers verbatim input like the one inserted with \lstinputlisting like "verbatim" stuff, that is nothing inside them is collected in its Tree and Gather interfaces and it is not used for folding purposes.

There's no easy solution for this.

The only way not to collect sectional commands is to not collect the file.

To do that, Go to "Options" -> "Options Interface" and double-click the "Input Directives" branch:

A local copy of Input.ini gets opened. In this file remove the lines

  DIRECTIVE="\lstinputlisting[????]{?}"
EXTENSION="*;.tex"
PATH="%P;%p;%@('TEXINPUTS');"
DIRECTIVE="\lstinputlisting{?}"
EXTENSION="*;.tex"
PATH="%P;%p;%@('TEXINPUTS');"


At this point press Shift+Ctrl+F9 to reload the file.

Now the unwanted sectional commands coming from listingerror.tex are not collected anymore:

• thanks. It worked. I don´t see the point to winedt gather the contents of a verbatim-like environment. If VerbatimPlus made this modification to the input.ini the macro for installations should be updated. Or maybe there is a point I´m missing. Anyway, thanks again. – Smarzaro Nov 15 '14 at 12:36
• @karlkoeller, is it possible to add new verbatim environment to VerbatimPlus? – fajar Nov 21 '14 at 0:29
• @fajar I've answered your question – karlkoeller Nov 30 '14 at 18:05