From f7eb2c6a23e6a15f86a636186d8bd77f16b2061d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 22 Nov 2013 00:03:01 +0000 Subject: latexmk (21nov13) git-svn-id: svn://tug.org/texlive/trunk@32200 c570f23f-e606-0410-a88d-b1316a301751 --- .../latexmk/example_rcfiles/sweave_latexmkrc | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc (limited to 'Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc') diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc new file mode 100644 index 00000000000..19f046be6be --- /dev/null +++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc @@ -0,0 +1,57 @@ +# This is to allow the use of Sweave with latexmk, and in addition to +# make synctex work properly with it. +# SEE THE IMPORTANT NOTES below. +# +# Sweave (http://www.stat.uni-muenchen.de/~leisch/Sweave/) is a tool +# that allows to embed the R code for complete data analyses in latex +# documents. The user edits a file with an extension like .Rnw, and +# the .tex file is generated from this. +# +# Four problems are solved by the code below: +# 1. Generate the .tex file automatically. +# 2. Arrange not to re-run unmodified chunks of R code. (A pure +# optimization.) +# 3. Fix the execution environment for (pdf)latex. +# 4. Deal with synctex: If the user wants to use synctex +# (www.tug.org/TUGboat/tb29-3/tb93laurens.pdf) to synchronize the +# pdf file with the source file, by default synctex does the +# synchronization with the generated .tex file, not the original +# source file. Postprocessing of the .synctex.gz file is necessary +# to fix this. +# +# The following version was worked out and tested by a user (thanks +# to Brian Beitzel) on MSWindows. It will need at least one change to +# work on UNIX-like operating systems (which include Linux and OS-X). + +# N.B. ===> IMPORTANT NOTES <=== +# +# 1. The patchDVI package for R needs to be installed from R-Forge, as +# follows: +# +# install.packages("patchDVI", repos="http://R-Forge.R-project.org") +# +# 2. In all Sweave (.Rnw) documents, the following lines must be included: +# +# \usepackage{Sweave} +# \SweaveOpts{concordance=TRUE} + + +# Fix the pdflatex command to run Sweave first, and to postprocess the +# .synctex.gz file: +# !!!!! THIS IS THE VERSION FOR MS-WINDOWS, with && as a command +# separator +$pdflatex = "cmd /c " + . "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); " + . "Sweave('%S', driver=cacheSweaveDriver)\"" + . " && R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex" + . " && Rscript -e " + . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\""; +# +# !!!TO FIX THIS FOR Linux/OS-X/UNIX, try uncommenting the following: +# (this version hasn't been tested). +#$pdflatex = "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); " +# . "Sweave('%S', driver=cacheSweaveDriver)\"" +# . " ; R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex" +# . " ; Rscript -e " +# . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\""; + -- cgit v1.2.3