When I write in LaTeX, what I enjoy doing is to first write an outline and the proceedings of my argumentation, and then later filling that in with text.

Now, often, my argumentational structure has much smaller steps than I can highlight by actual outline (i.e. \section, \paragraph and alike). Therefore, I would like to be able to use comments in a way that my editor recognizes them as structuring elements; I would then be able to fold/unfold small blocks of text, only showing the comments which summarise this block.

I guess that this can be achieved by means of choosing the right editor. I am currently using Texmaker und Texstudio, but I am not fully convinced of either. Is there any tool that can do what I just described?

EDIT: Maybe I can further clarify my idea: I would wish for an editor to be able to interpret my comments and accordingly show this in the way it marks them in the editor-view. E.g. it might show certain comments in bold letters or in red font, but also fold and unfold blocks between certain comments.


In Texstudio you can use

% your comment here

whatever text


in order to fold a certain range of text.

To mark special comments in colour, a feature normally used for todo comments can be abused. If you add some phrase, for example youroutline to the list of recognised to-do comments, comments starting with this expression will be coloured (which colour/font colour/bold etc. is customisable):

enter image description here

enter image description here

  • How do I set TODO-comments? – Lukas Jan 12 '18 at 12:39
  • 2
    @Lukas In the "adv. Editor" tab of the texstudio preferences. – user36296 Jan 12 '18 at 12:41
  • Is it possible to define other types of comments as well? – Lukas Jan 12 '18 at 12:52
  • @Lukas ? What do you mean with types of comments? – user36296 Jan 12 '18 at 12:56
  • like a todo-comment could be said to be a "type of" a comment. – Lukas Jan 12 '18 at 13:23


Using foldmethod=marker and foldmarker=>>>,<<< you can fold everything in between >>> and <<<. If TODO is contained in a comment the TODO gets bold and in a highlighted colour. You could add more strings which are handled like TODO (but I'd have to look up how).

If you're really at it, you could as well define your own fold rules which handle your stuff without the additional markers.

Together with vim-latexsuite (a VIM plugin), you get other stuff to get your TeXing done faster.

Or you could look at the foldmethods provided by the vim-latexsuite.


Most good editors support something like this. For example in jEdit you can use a variety of custom folding commands, the most useful for (La)TeX being

%{{{ Some comment text if you want it
This is a block that I might want to fold up.
It might be quite long
%}}} some more comment text

which when folded would look like

%{{{ Some comment text if you want it
    [2 lines]
%}}} some more comment text

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.