## #563 content of \begin{comment}\end{comment} should be ignored / shown as a comment

None
closed
nobody
None
1
2015-01-18
2013-06-22
Sven Köhler
No

I'm using \begin{comment}\end{comment} as provided by \usepackage{comment}.
Texstudio will treat the latex between \begin{comment} and \end{comment} as regular content. Please show it in gray color (as a normal comment) and ignore its contents (e.g. the sections and subsections declared there)

I'm using texstudio 2.5.2

## Discussion

• status: open --> fixed
• Group: -->

• that was changed in 2.6

• Sven Köhler
2013-06-23

This is not entirely fixed. While the text between \begin{comment} and \end{comment} is now shown in gray, the sections and subsections still are shown as part of the document structure on the left. It would be nice, if they are not shown or shown in a different color.

Also, a \section after \end{document} is shown as part of the document structure on the left.

• Tim Hoffmann
2013-07-13

• status: fixed --> open

• ParkerLewis2nd
2013-07-23

I have the exact opposite problem. In some documents I have been using a custom environment which I called "comment" at some point. But this is just a regular text environment and has nothing to do with comments in the code-sense. I definitely do not want the code highlighted as if it were a comment and I'm quite bothered by this since the my update from 2.5.2 to 2.6.2.

Actually, since there is no predefined "comment" environment in latex, I don't see any reason why TeXstudio should have built-in syntax highlighting for it. For that reason I recommend to remove this highlighting feature again or at least make it dependent on whether the comment package is used in a specific document.

• Sven Köhler
2013-07-23

Hey ParkerLewis2nd, here's how it should work:
TexStudio shouldn't recognize the comment environment until you add \usepackage{comment} to your latex document. Then TexStudio load's the CWL file for the comment package, which adds the syntax highlighting etc.

So do you by any chance use the comment package and then override the comment environment? Or do you by any chance override the set of CWL files that TexStudio loads by default?

• ParkerLewis2nd
2013-07-23

Hi Sven.

TexStudio shouldn't recognize the comment environment until you add \usepackage{comment} to your latex document. Then TexStudio load's the CWL file for the comment package, which adds the syntax highlighting etc.

Just to be sure, this is a suggestion, right? If so, I second it.

So do you by any chance use the comment package and then override the comment environment? Or do you by any chance override the set of CWL files that TexStudio loads by default?

No, I don't use the comment package at all. As for the CWL files, I only checked the packages I actually use in the "Completion" dialogue in the TeXstudio configuration.

• Ticket moved from /p/texstudio/bugs/752/

• Tim Hoffmann
2014-09-15

• Tim Hoffmann
2014-09-15

• status: open --> closed

• Tim Hoffmann
2015-01-18

Note: There's now an option Advanced Editor -> Structure Panel -> Show elements in comments (default: false) to still be able to see commented out elements in the structure.