# ESS knitr workflow with natbib

This solution explains ESS knitr workflow and it works as explained. However, it does not explain how to knit an Rnw file containing natbib references. Similar question have been asked here and the answer is to related to ess-swv library which is obselete.

How can I knit with ESS an Rnw file containing a natbib reference like in the example bellow. The exporter I am using in ESS is pdflatex and the weaver is knitr.

\documentclass{article}
\usepackage{natbib}

\begin{document}

<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
@

<<normal-sample, echo=FALSE>>=
x <- rnorm(100)
plot(x)
@

The moon in June is like a big balloon \citep{smith2012}.

\bibliographystyle{apalike}
\bibliography{/path/to/my/references/refs}

\end{document}