Skip to content

Instantly share code, notes, and snippets.

@krlmlr
Forked from jpritikin/predis-sm.Rnw
Last active December 27, 2015 00:09
Show Gist options
  • Save krlmlr/7235520 to your computer and use it in GitHub Desktop.
Save krlmlr/7235520 to your computer and use it in GitHub Desktop.
/cache/
/figure/
/predis-sm.aux
/predis-sm.bcf
/predis-sm.blg
/predis-sm.log
/predis-sm.out
/predis-sm.pdf
/predis-sm.pyg
/predis-sm.run.xml
/predis-sm.tex
#!/bin/sh
set -o errexit
set -o nounset
set -o noclobber
name=predis-sm
R --no-save --restore <<'EOF'
library(knitr)
opts_knit$set(error=TRUE)
opts_chunk$set(echo=FALSE, cache=TRUE)
if(1) {
inline.hook = knit_hooks$get("inline")
force(inline.hook)
knit_hooks$set(inline=function (x) {
inline.hook(x)
})
}
library(ggplot2)
update <- function(stem) {
rnw <- paste(stem,"Rnw",sep='.')
# if (file.info(rnw)$mtime > file.info(paste(stem,"tex",sep='.'))$mtime) {
knit(rnw)
# }
}
update("predis-sm")
EOF
[ -d gen ] || mkdir gen
pdflatex -shell-escape $name
biber $name
pdflatex -shell-escape $name
pdflatex -shell-escape $name
pdflatex -shell-escape $name
\documentclass{article}
\usepackage[backgroundcolor=yellow,shadow,textwidth=1in]{todonotes}
\begin{document}
<<cache=FALSE>>=
if (length(ls())) rm(list=ls()) # new section
opts_chunk$set(fig.path="figure/intro/")
@
\begin{figure}
<<fig.height=3>>=
plot(sin)
@
\caption{Empirical response}
\end{figure}
Much work remains \Sexpr{NA}, but I have already begun to use OpenMx
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment