Outline mode and the AUCTeX folding facilities are two different beasts that are meant to do broadly the same thing: hide and show selected parts of the buffer. Personally, I find the AUCTeX facilities to be rather jarring and rarely use them, but your mileage may vary. I use the outlining functionality all the time, however.
A key element to recognize when using outline-minor-mode
is that it's got a different prefix key that outline-mode
(ie, the major mode) -- precisely to avoid the key conflicts with motion keys, etc. That prefix defaults to the awkward-to-type C-c @
(although you can change that by customizing outline-minor-mode-prefix
). All the keybindings listed on this node of the manual should still work, but with the twist that you replace the major mode prefix of C-c
with the minor mode prefix of C-c @
. Hence, C-c @ C-c
runs hide-entry
, C-c @ C-e
runs show-entry
, and so on.
To use these facilities, you need to enable outline-minor-mode
. The simplest way is with a mode hook:
(add-hook 'LaTeX-mode-hook 'outline-minor-mode)
adding new outline headings
As an added bonus, you can also customize which outline headers can get folded, and to what levels. I, for example, like to be able to make "fake" section headers to hide away text that doesn't have a true LaTeX header, but logically is kept at the same level of the document. With the following code, you can use:
%section{a fake section}
Blah blah blah blah blah, LaTeX doesn't recognize me as a section...
\section{a real section}
Blah blah blah blah blah, LaTeX treats me as a real section
And you will be able to manipulate the fake section just like any other one, but LaTeX will ignore it when you compile the document:
;; extra outline headers
(setq TeX-outline-extra
'(("%chapter" 1)
("%section" 2)
("%subsection" 3)
("%subsubsection" 4)
("%paragraph" 5)))
;; add font locking to the headers
(font-lock-add-keywords
'latex-mode
'(("^%\\(chapter\\|\\(sub\\|subsub\\)?section\\|paragraph\\)"
0 'font-lock-keyword-face t)
("^%chapter{\\(.*\\)}" 1 'font-latex-sectioning-1-face t)
("^%section{\\(.*\\)}" 1 'font-latex-sectioning-2-face t)
("^%subsection{\\(.*\\)}" 1 'font-latex-sectioning-3-face t)
("^%subsubsection{\\(.*\\)}" 1 'font-latex-sectioning-4-face t)
("^%paragraph{\\(.*\\)}" 1 'font-latex-sectioning-5-face t)))
outline-magic
extends the outline modes to use org-mode
-like hiding/showing with the magic tab key. In other words, you can probably add this in to your workflow and make your LaTeX documents behave more like org
documents. (I don't use it myself, so can't comment on functionality.)
These were the facilities you were mentioning when you cited the bindings like C-c C-o C-b
. Note that you need to enable them with TeX-fold-mode
.
These facilities work differently from outline mode, and hide environments (eg, \begin{itemize} ... \end{itemize}
and what AUCTeX refers to as "macros", such as \footnote{...}
rather than sections per se.
You can use both outline-minor-mode
and AUCTeX's folding facilities together in the same document: they do different things on different parts of it.