8 Latex Folding

8.1 Default Folding Scheme in Latex-Suite
8.2 Customizing what to fold
8.3 Editing the folding.vim file directly

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]
    \centerline{\psfig{figure=slidercrank.eps,height=6cm}}
    \caption{The Slider Crank Mechanism.}
    \label{fig:slidercrank}
\end{figure}
% a LaTeX comment.
\begin{eqnarray}
    \sin(\pi) = 0
\end{eqnarray}

will be shown as:

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