I want to fold the whole part before \begin{document} where it is just formatting the LaTeX document. Is there a way to do this in LaTeX, in general, or at least in TeXstudio? Could I use some \begin{} structure to do it?
- 31,033
- 223
1 Answers
Note, code folding is a feature of an editor not a language. So there cannot be in 'code folding in LaTeX in general'.
Coming back to your intention, TeXstudio does not directly support 'folding everything before \begin{document}'. In TXS folding is limited to environments and structure commands (\section, etc.). However, you can define arbitrary folding ranges using the comments
%BEGIN_FOLD
%END_FOLD
That said, you may still consider separating the preamble to another file and \input-ing it as others have proposed in the comments. Personally, I favor this over folding, particularly in large projects that constist of multiple files anyway. While TXS can persistently save foling information in a session, the folding state is gone if you switch to another editor or pass the code to someone else. And then you would have to fold all the stuff again.
- 31,033
- 11,159
-
Is it possible to auto-fold certain environments, e.g. everything between
\begin{figure}and\end{figure}, meaning they will be collapsed unless manually extended? – Oct 24 '17 at 09:58 -
1
-
2
\begin{document}follow http://tex.stackexchange.com/questions/40760/best-practice-on-organising-your-preamble – texenthusiast Jan 28 '15 at 03:38