How to tell TeXStudio to ignore all content of some environment from its Tree (structure) layout?

2014-08-11
2014-08-11
  • Nasser M. Abbasi

    I am using TexStudio 2.8.2 (excellent editor)

    Is there a way to tell texstudio to ignore entries such as \section and \chapter that appears inside Verbatim environment from showing in the Structure tree in the left panel?

    The problem shows up only when I defined a macro like this:

    \DefineVerbatimEnvironment{X}{Verbatim}{samepage,fontsize=\small,frame=single}

    Then in the code I write

    .....
    \begin{X}
    \section{blabla}
    \end{X}
    ......

    Now \section{blabla} shows up in the Structure tree to the left, even though it is inside a Verbatim.

    However, the \section{blabla} do not show up if I write Verbatim explicit as in:

    .....
    \begin{Verbatim}
    \section{blabla}
    \end{Verbatim}
    ......

    Which is good! But I like to use macros such as X above, to reduce the amount of typing each time. So I need a way to tell texstudio to simply treat the X environment exactly as Verbatim, that is all.

    I wonder if there is a setting or a way to add such environment and tell TexStudio that environment X is Verbatim?

    thank you
    --Nasser

     
  • Tim Hoffmann

    Tim Hoffmann - 2014-08-11

    In the particular case of verbatim, the simplest solution is to define X as verbatim at Options -> Custom Highlighting -> Custom Environment. You need to have the advanced option checkbox in the lower left corner of the options dialog enabled to access this setting.

    More refined definition of commands can be achieved by a user-defined cwl file. See
    https://sourceforge.net/p/texstudio/wiki/Frequently%20Asked%20Questions/#how-does-txs-know-about-valid-commands and the links therein.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks