# Folding entire section in AUCTeX?

I'm new to AUCTeX and I wonder:

is it possible to fold entire sections or subsections of a LaTeX document for a better overview, so that they are only represented by their headline (kind of a tree view of the document)?

I would expected that being done by the "folding" features, but I could not manage to hide a whole section, but folding seems to hide only some selected elements of the source code.

Is there a feature like what I'm searching in AUCTeX?

-
Could you post a MWE including the part of the source code that fails to fold completely? –  Ricardo Dec 30 '12 at 16:40
With TeX-fold-mode and outline-minor-mode you should be able to fold the document in a manageable way (via the outline menu and corresponding bound keys). However, without a minimal example, we can only take guesses at what might be wrong. –  Ricardo Dec 30 '12 at 16:46
@Ricardo: thanks! in the meantime I found out, that "folding" is not what I need, but this outline-minor-mode... the problem is: I can not enter the commands, because Aquamacs does not recognize the "@" sign: superuser.com/questions/525988/… –  Martin Dec 30 '12 at 17:05
TeX-fold-mode is here to fold environments and macros (for example replacing \lambda with a unicode lambda or hide a long proof). outline-minor-mode is what you need, as you stated, but you shouldn't have to set the heading levels yourself, auctex should take care of that for you. –  T. Verron Dec 30 '12 at 17:08
@T.Verron: thanks. So which commands could I use to jump e. g. to the next section heading on the same level as the current one? As stated in the linked question in the superuser-forum, I can not enter any commands containing "@" at the moment. –  Martin Dec 30 '12 at 17:10

TeX-fold-mode is here to fold environments and macros (for example replacing \lambda with a Unicode lambda or hiding a long proof). outline-minor-mode is what you need, as you stated in the comments, but you shouldn't have to set the heading levels yourself, AUCTeX should take care of that for you.

If the key mapping is a problem to you, the easiest way to change it is to change the prefix-key for outline-mode.

This solution is described on EmacsWiki, where I found the following code snippet (to be added in your .emacs:

(add-hook 'outline-minor-mode-hook
(lambda () (local-set-key "\C-c\C-@"
outline-mode-prefix-map)))))


The above snippet will actually do nothing in AUCTeX, but you can replace \C-c\C-@ with any sequence of keys you like. The shortcuts will then use that key sequence instead : for example, to move to the next visible heading, you'll use <your key sequence> C-n.

You'll find on EmacsWiki many other options to change the keybindings, as well as suggestions for the choice of keys (but you'll probably need to figure out what key to use yourself, due to the many keybindings needed by AUCTeX).

-

## Scrolling is not my hobby...

For easy navigation use the table of contents inside Emacs. Just type C-c = and Emacs displays it. You can navigate incredibly fast.

From the comments, if it does not 'work out of the box,' you can use

M-x reftex-mode


to turn it on for the current buffer or, to make the change permanent, add the following to your .emacs:

; If you use AUCTeX (you probably do; if you don't, you probably should):