Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I recently (2 days back) started using LaTeX, I use Sublime Text 2 (ST2) for most of the programming. I found that ST2 has LaTeX package. So what I am doing is write the document with ST2 and run it with TeXWorks to see any errors/debugging. Is there a way I can run/debug the tex file directly from ST2? Is there any better practice than what I am doing currently?

share|improve this question
1  
Welcome to TeX.SE. Why not just work directly in TeXWorks? What exactly is the big advantage of using ST2 over TeXWorks? –  Peter Grill Jun 18 '12 at 4:59
4  
@PeterGrill I am also using ST2 and I'd hardly change to a different editor just for my Tex work. Having a different keyboard interface is annoying to say the least. (But I can't answer the original question though - I open the log file in another tab and see it there.) –  topskip Jun 18 '12 at 5:04
    
@PatrickGundlach: Ok, that makes sense. Will have to take a look at ST2. –  Peter Grill Jun 18 '12 at 5:52
    
@PeterGrill, thanks for welcome, ST2 awesomely highlights the syntax where as TeXworks doesnt & its so messy! –  uDaY Jun 18 '12 at 6:37
    
@uDaY What is your operating system ? –  Alain Matthes Jun 18 '12 at 8:51
show 2 more comments

3 Answers

up vote 28 down vote accepted

It's not easy to work with ST2 the first time . You need to install some tools.

Firstly, you can read this readme Readme LaTeXTools then you can download the archive .zip here LaTeXTools.

The readme explains how to install the package. You get something like TextMate after that (Personally I prefer TextMate on OS X) but this editor is really fine tool.

idea from kgr

A good thing, it's to add the package control, with this package you can LaTeXTools directly and very important this will keep it up to date. It's the better way. You need to read carefully the explanations to install the package control.

share|improve this answer
3  
Just to expand on this a bit, first you need to add package control, instructions here: wbond.net/sublime_packages/package_control . Then you should add LaTeXTools directly in package control; this will keep it up to date. (As opposed to downloading the zip file manually.) –  kgr Jun 18 '12 at 13:26
    
@kgr Yes you are right and it was my method to install the package but I forgot it. I will update my answer. I forgot because I work only with TextMate, I made only an attempt with Sublime Text 2. –  Alain Matthes Jun 18 '12 at 14:09
    
@kgr, I already looked that site. But I have noticed that without adding the package control too the LaTeX package was available in ST2, So we need to add package control to have a build system to debug/run the LaTeX file created? –  uDaY Jun 18 '12 at 17:14
    
@Altermundus, Ok I followed and installed the LaTeX tools package & have built the system, but after I compile the document without errors, ST2 prompts it Cannot launch Viewer, make sure its in PATH Is it talking about the Adobe Acrobat is not in path? –  uDaY Jun 19 '12 at 0:08
    
@kgr I'm not a great expert with Windows but I think Sumatra is a great viewer. You can read this link jbdeaton.com/2012/…. About the PATH, perhaps via Start/ . . . /System/Extended/Enviroment variables –  Alain Matthes Jun 19 '12 at 5:38
show 3 more comments

There is no default functionality for that, but you can easily create your own. in ST2 you can add build systems in Tools -> Build System -> New Build System... and if you want to run your file with PDFTeX, your build system definition file would look like:

{
    "cmd": ["pdflatex","$file_name"],
        "selector": "text.tex.latex"

}

Another way is to set up latexmk for your project, which can be as simple as creating a project file like this (name that latexmkrc):

$pdf_mode = 1;
@default_files = ('myfile');

and have a build project with latexmk:

{
    "cmd": ["latexmk"],
    "selector": "text.tex.latex"
}

If you now select select that build system in the same menu you can now press command-b or ctrl-b the TeX file will get compiled. You can manually switch to the log file and see what is in there.

share|improve this answer
    
Altermundus' answer is much better than mine! –  topskip Jun 18 '12 at 6:58
    
Only if you like the LaTeXTools but your answer shows how to create the "build system", it's interesting too. –  Alain Matthes Jun 18 '12 at 8:48
    
well, LaTeXTools includes an already created build system for latex. –  kgr Jun 18 '12 at 13:27
add comment

I'm the developer of the LaTeXTools plugin. Ctrl-B (-B on OS X) launches a specially modified build system that:

  • collects errors and warnings, and displays them in Sublime Text's output panel; you can then click on the errors to jump to the corresponding line in your source text file;

  • sets up forward and inverse search

  • upon completion, invokes forward search in your PDF previewer (Skim on Mac, SumatraPDF on Windows, Linux not there yet) so you get to see the current page

Take a look at the README file in the plugin's directory (which you can open in Sublime Text using the "Browse Packages..." menu item).

share|improve this answer
4  
+1, Thanks a lot! Marciano! –  uDaY Sep 18 '12 at 20:28
    
Hm... tried it a while a go and it didn't work. Now, after your answer I tried it again and found the culprit: Apparently, the plugin does not support the $out_dir=./build setting in my .latexmkrc, which, among other things, makes latexmk to add -output-directory=./build to the pdflatex command line. I really do love this setting, as it keeps my source folders clean. Any easy option to enable this? If not, any chance that it will be supported? –  Daniel Mar 18 '13 at 22:13
add comment

Your Answer

 
discard

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.