Skip to content

Instantly share code, notes, and snippets.

@cameronbracken
Created June 20, 2011 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronbracken/1036173 to your computer and use it in GitHub Desktop.
Save cameronbracken/1036173 to your computer and use it in GitHub Desktop.
pgfSweave example file for concordance
\documentclass{article}
\usepackage{Sweave}
\usepackage{tikz}
\SweaveOpts{keep.source=TRUE,tidy=TRUE,concordance=TRUE}
\begin{document}
<<>>=
# Small function with highlight=TRUE and tidy=TRUE and some additional garbage.......
# garbage to see how it wraps.
@
<<>>=
cip <- function(x=10, n=100, conf.level=0.95){phat <- x/n; z <- qnorm(1-(1 - conf.level)/2); SE <- sqrt(phat*(1-phat)/n); ME <- z*SE; c(phat-ME, phat+ME)} # cip function
@
\end{document}
@cameronbracken
Copy link
Author

script to compile:

#!/bin/bash

R CMD pgfsweave --pgfsweave-only "$1"
pdflatex --shell-escape --synctex=1 "${1%.*}"
make -j 2 -f "${1%.*}".makefile
latexmk -pdf -silent -pdflatex='pdflatex --shell-escape --synctex=1 --file-line-error' "${1%.*}"
Rscript -e "library('patchDVI');patchSynctex('${1%.*}.synctex.gz')"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment