TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 7 down vote accepted

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.

share|improve this answer
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. – J4cK Jan 1 '14 at 12:00
@Trickster With github.com/SublimeText/LaTeXTools - yes. – Piotr Migdal Jan 22 '14 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 '14 at 10:46
Is there any news on whether ST3 supports code folding for LaTeX in any shape or form? I couldn't get it working in Latexing and don't want to switch to LatexTools if I can avoid it. – Harry Oct 8 '15 at 11:52

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.

share|improve this answer

I've been looking for answers to this too and have found a really good add on solution that's great for working with long files and navigating the section headings within those files.

Using the Filter Lines package, you can not only filter for lines that match a string or regex, but also fold everything except your string/regex.

So to make life easier for LaTeX documents by folding everything in sections:

ctrl+shift+p -> Filter Lines: Fold with Regex

Then use the regex \\.*section\{ to fold all lines except sections, subsections and subsubsections; or customise to taste.

I'm using Sublime Text 3 but ST2 is supported by Filter Lines as well.

enter image description here

share|improve this answer
This is a great trick, too bad it's not persistent, i.e.: the folding goes away after restarting Sublime. Still, very useful. Thanks you! +1 – Gabriel May 11 at 14:54
Also a nice addition is that it remembers the last regex you entered (at least for me). Thanks for this solution! – Mathias711 May 26 at 12:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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