8 Latex Folding

8.1 Default Folding Scheme in Latex-Suite
8.2 Customizing what to fold

Latex-Suite ships with the plugin SyntaxFolds.vim which is a plugin for creating "fake" syntax folds on the fly. The fold method is actually manual but the folding is based on LaTeX syntax. This offers a speed increase over regular syntax folding. Ofcourse it has the disadvantage that the folds are not dynamic, i.e newly created syntax items are not automatically folded up. (This is a compromise between speed and convenience).

When you open up a LaTeX file, all the portions will be automatically folded up. However, no new folds will be created until you press \rf. (rf stands for "refresh folds").

The fold-text is set to the first line of the folded text unless the fold is a table, figure etc. (an environment). In this case, if a \caption and/or a label is found in the folded region, then those are used to make a more meaningful fold-text, otherwise the second line of the environment is displayed along with the name of the environment. In other words, the following

\begin{figure}[h]
     \centering
     \includegraphics[height=6cm]{slidercrank.pdf}
    \caption{The Slider Crank Mechanism.}
    \label{fig:slidercrank}
\end{figure}
% a LaTeX comment.
\begin{equation}
    \sin(\pi) = 0
\end{equation}

will be shown as:

+---  5 lines: figure (fig:slidercrank) : The Slider Crank Mechanism. -----
% a LaTeX comment.
+---  3 lines: equation () : \sin(\pi) = 0 --------------------------------