Hello all,
I recently made the switch from TextMate2 to SublimeText2 and I am really impressed with the editor so far. That said, I am still trying to get some of the functionality I had in TextMate in SublimeText2. I am going to outline two of the things I am trying to accomplish below with the hope that somebody can give me some advice.
- I would like to be able to “sweave, typeset and view” a .Rnw file in the same way that I can in TextMate. The idea is that I can type cmd + R (cmd + B in ST2) and the R chunks are sent to R, sweaved, and then placed into a .tex file. That file is then compiled and SKIM is called to open the corresponding PDF file. My understanding is that I need to create a custom build in ST2 to do this. This is what I have so far:
{
"selector": "source.Rnw"],
"cmd": "osascript", "-e", "tell app \"R64\" to cmd \"setwd('$file_path')\"\n",
"-e", "tell app \"R64\" to cmd \"Sweave('$file')\"\n"],
"target": "make_pdf",
"selector": "text.tex.latex",
"osx":
{
"cmd": "latexmk", "-cd",
"-e", "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'",
//"-silent",
"-f", "-pdf"],
"path": "$PATH:/usr/texbin:/usr/local/bin",
"file_regex": "^(...*?):([0-9]+): ([0-9]*)(^\\.]+)"
}
}
Basically I am calling R, setting the working directory, and sweaving the .Rnw file. This part works fine. The .tex file is created and can be compiled if opened in ST2 independently. What I cannot do is make this build compile the .tex file after it is created. The second half of the code (from “target”: “make_pdf”, to the end) is copied from the LaTeX build. So any insight on how I can get this to work would be great. Now on to problem 2.
- I would like to be able to use the Rconsole in one window and have my .R file in the other. I would like to build the .R file and have it sent to the R console in the first window. RIght now I am able to build the .R file, but the R.app is opened and the output is shown there, not in ST2. Any insight on how I could get this to work would also be appreciated. Thank you in advance.