I would like to use code folding with Aquamacs but I don't find any reference to do it. I would like to fold the figure and the paragraph. I've already tried all the combination listed here. Can anybody give my a practical example to fold this code? And a \section.

\begin{figure}[h!]
  \centering
    \includegraphics[width=0.5\textwidth]{fiocco}
   \caption{A running dog}
    \label{fig:fiocc}
\end{figure}

I've used C-c,C-o,C-r but it doesn't work....

  • To fold the figure environment use C-C C-o C-e with point inside that environment. – giordano Oct 6 '13 at 16:25
  • @giordano this works, so I can undo this using C-c C-o p. I can fold automatically all the figure? For the section seems I have to do something else...Thanks a lot! – G M Oct 6 '13 at 16:35
up vote 2 down vote accepted

You have to customize TeX-fold-env-spec-list (LaTeX-fold-env-spec-list is more appropriate but the result is just the same if you use only LaTeX and not plain TeX). In your init file add this code

(add-to-list 'TeX-fold-env-spec-list '("[figure]" ("figure")))

Then with C-c C-o C-b (M-xTeX-fold-bufferRET) all figure environments in the current buffer will be folded at once. To fold only figure environments in the current paragraph use C-c C-o C-p (M-xTeX-fold-paragraphRET).

The folding of paragraphs is done using the outline minor mode (see also the Outlining the Document section in AUCTeX manual). You can activate it with M-xoutline-minor-modeRET and then use the Outline menu.

  • Thank a lot, can I do the same with \section and \subsection? – G M Oct 7 '13 at 16:27
  • 1
    @GM see the updated answer. – giordano Oct 7 '13 at 16:59
  • @GM did you see the updated answer? Is it complete now? – giordano Oct 11 '13 at 19:47
  • 1
    Yes thanks a lot I've voted up you, usually I wait always a week to accept answer, don't worry I will soon do it! – G M Oct 12 '13 at 7:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.