LyX has a great feature of being able to hide the content of comments from the editor, leaving only a mark that there's a comment at that area. I'm now trying to write directly in Latex rather than Lyx. Are there any Latex editors with a similar feature?

Some more details: I have been using the comment environment for long comments. However, I don't want the comment to take up so much space while editing the file as it interferes with navigating - it takes too long to move past all the comments. I also don't want to move it to the end of the file or another file, since I want the comments in the relevant place of the file. I want the editor to show something that tells me there's a comment there, which I can expand if I want.


AucTeX, which is a TeX mode for Emacs (not the default mode that comes with Emacs), has functionality for folding parts of the buffer, for example comments. At https://www.gnu.org/software/auctex/manual/auctex/Folding.html#Folding you can read about that. When activated you can for example use C-c C-o C-c to hide a comment are looking at. It will then be shown just as %... until you position yourself inside of it. And if you do the command for folding an environment inside of \begin{comment} and \end{comment} only [comment] will be seen until you position yourself inside.


Some generic programmers' text editors will allow you to fold up sections demarcated in some way. I can do this in jEdit (cross platform) for example:

\comment{still need to add an intro%{{{
this is some text
over many lines}

and if I click on the line number next to the first line of this I can toggle between the display above and

\comment{still need to add an intro%{{{ [3 lines]

where %{{{...%}}} is an "explicit fold" . I can do the same in Python in the same editor.

LaTeX support isn't integrated but there's a macro suite out there somewhere if you want it -- I used about 3 of the buttons in the macro while writing my thesis and don't bother using any more.

You can do all the same things on Notepad++ on windows as well. I have a general preference for using the same editor for code and LaTeX, and for an editor with generic features and extensibility. This doesn't suit everyone.

This was going to be a comment (probably still should be but for formatting).

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.