Knitr and TeXmaker #rstats

SO quick post – realized that you can just change R Sweave in TexMaker to:

R CMD Rscript -e “library(knitr); knit(‘%.Rnw’)”;

Then just do the shortcut for R Sweave in TeXmaker (CMD+Alt+S on my Mac) and then CMD+T (quick build – which is default xelatex for me) and then you just ran your knitted document, then compiled the tex and see the pdf.  Texmaker default pdf viewer has some oddities with displaying figures, so I tend to change that to my external viewer (Preview or Adobe).

Why you would want to do this? Texmaker has a great text expansion for LaTeX and you can write TeX much quicker and easier in that.

Why it still isn’t optimal – RStduio has all the nice text expansion for R objects. If RStudio’s native editor for Rmd and Rnw’s could rival Texmaker – I would probably switch whole sale. It seems possible – they already have it down for knowing if you’re in a code chunk or not for commenting – given that you don’t highlight R code and TeX at the same time – otherwise you’ll get some interesting behavior


One thought on “Knitr and TeXmaker #rstats

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s