How to configure texmaker and knitr 1.9.3 in Ubuntu 14.04 LTS 64-bit to weave .Rnw documents

Posted: 2014/02/26 in Data Science, Ubuntu
Tags: , , , , , , , , , , ,

How to configure texmaker and knitr 1.9.3 in Ubuntu 14.04 LTS 64-bit to weave .Rnw documents

Open a Terminal in Ubuntu 14.04 64-bit and copy-paste the following commands into the Terminal one line at a time:


sudo apt-get update
sudo apt-get install texinfo texmaker r-base-core r-base
sudo apt-get install texlive-fonts-extra unp

# install testit and rgl packages which are prerequisites
# for the make check command below:
cd
rm -rf testit*
git clone https://github.com/yihui/testit.git
R CMD build testit
R CMD INSTALL testit_*.tar.gz

cd /tmp
rm index.html
wget http://cran.r-project.org/src/contrib/
FILENAME=`grep \"rgl index.html |head -n 1|cut -d"\"" -f8`
wget http://cran.r-project.org/src/contrib/`echo $FILENAME`
unp rgl*
R CMD build rgl
R CMD INSTALL rgl_*.tar.gz

# install knitr 1.9.3:
cd
rm -rf knit*
git clone https://github.com/yihui/knitr.git
R CMD build knitr
R CMD INSTALL knitr_*.tar.gz
sudo cp ~/knitr/inst/bin/knit /usr/bin/knit
cd knitr
make check

cd
rm -rf knitr-examples*
git clone https://github.com/yihui/knitr-examples

cd
rm -rf book-template-for-texstudio*
git clone https://github.com/MarkRijckenberg/book-template-for-texstudio.git
cd book-template-for-texstudio/
texmaker texmaker-knitr-sample-document.Rnw

Configure texmaker version 4.1.1 or newer as follows:
Texmaker::Options::Configure Texmaker::Commands::R Sweave command should be

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

Texmaker::Options::Configure Texmaker::Quick Build command option should be

Sweave + pdflatex + View PDF

Then press F1,F12,F11,F1,F1 in texmaker to compile from .Rnw to .tex to .pdf file and to preview it automatically.

Advertisements
Comments
  1. mark911 says:

    Today, I successfully retested all the bash commands above in Ubuntu 14.04 LTS 64-bit. I also added the installation of testit and rgl packages into this procedure.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s