# Long LaTeX files in Sublime Text 2

I use Sublime Text 2 for my LaTeX documents, but I tend to write very long documents. What kind of tricks or add-ons would be helpful when working with super long files?

For example, since I have many `\sections` in my document, is there a way to quickly jump between them?

-
Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. –  adn May 6 '13 at 2:17
Use `Goto Symbol` (`cmd-R` in Mac and it should be `ctr-R` under Window or Linux) allows you to jump to the various sections (and labels) –  Guido May 6 '13 at 7:12
Instead of writing very long documents, you could split them into several documents (for example along sections), and then just `\input` them into a master-document. Also, I am using `vim`, and I have defined custom folding whenever e.g. `<<<` and `>>>` is encountered. I am sure sublime has something similar. –  mSSM Jul 1 '13 at 12:24

Some suggestions:

• The Goto menu is your friend. Goto Symbol (super+R) lets you jump between `\section` commands, and Goto Line (which I bind to super+L) lets you jump to a specific line, which is handy for debugging.
• You could split different sections into separate files, and use `\input{section1.tex}` to reduce the number of lines in any one file. I tend to find dealing with a collection of smaller files is easier than handling a single, larger file.
• Read about Projects, which ST2 does fairly nicely (or so I think). Many IDEs have the concept of “Projects”, which bundle together these separate, smaller files, and let you work on them together in a slightly better way than just having lots of individual files open.
• The Minimap (View > Show Minimap) gives you a preview of the whole document, syntax highlighting and all, so that you can see the “shape” of your LaTeX. I don’t find this view particularly useful, but if your code has a lot of whitespace before new sections, say, then it might be helpful.

Unfortunately ST2 doesn't support code folding in LaTeX documents yet (if it does, please correct me in comments, because I'd love to have this), which is a handy way of managing larger files.

-
Does Goto Symbol (super+R) really works for navigating latex section. For me I can navigate to source code functions, but not the latex function. –  Trickster Jan 1 at 12:00
@Trickster With github.com/SublimeText/LaTeXTools - yes. –  Piotr Migdal Jan 22 at 12:10
Goto Symbol only seems to work in the current file. Is there a way to edit it so that it reads all the files in the project and therefore let you jump to any section in any other tex file? –  Charl May 30 at 10:46

I think SublimeText 2 generates folding markers depending on the indentation of paragraphs. When writing in LaTeX, I find it useful to have all text indented (one tab space is enough. Should also work with spaces) beneath each chapter or section. Maybe the below example helps:

``````\section{My foldable section}
You need at least two paragraphs for SublimeText 2 to generate the fold markers.

So this would be the second paragraph.
``````

This should fold as shown below (with the ellipses in yellow):

``````\section{My foldable section}...
``````

Final note: SublimeText 2 shows a light gray vertical line running through the foldable area to indicate the scope.

-