[R] Sweave and bibliographies

Marc Schwartz marc_schwartz at me.com
Thu Oct 6 21:23:27 CEST 2011


On Oct 6, 2011, at 1:42 PM, Terry Therneau wrote:

> I added a bibliographic reference to one of my .Rnw documents, to wit:
> 
> \begin{thebibliography}{9}
>  \bibitem{Jose} Jos{\'{e}} C. Pinheiro and Douglas M. Bates,
>    \emph{Mixed-Effects Models in S and S-PLUS},
>    Springer, 2000.
> \end{thebibliography}
> 
> just before the \end{document}.
> When I run Sweave on the result these lines disappear without a trace.
> 
> Is this intentional?  
> 
> Subquestion: is there a link to some Sweave documentation from the main CRAN
> or R page?
> 
> Terry T.


Terry,

Not sure what else you might have in your .Rnw file, but here is a simple example (test.Rnw) that is working for me:

\documentclass[10pt]{article}

\begin{document}

<<results=tex>>=

# Test code
print(1 + 2)

@ 

This is some text\cite{Jose}.

\begin{thebibliography}{9}
 \bibitem{Jose} Jos{\'{e}} C. Pinheiro and Douglas M. Bates,
   \emph{Mixed-Effects Models in S and S-PLUS},
   Springer, 2000.
\end{thebibliography}

\end{document}


I processed it using:

 R CMD Sweave test.Rnw

and then:

 pdflatex test.tex


It generates the PDF attached…

Fritz has some documentation here:

  http://www.statistik.lmu.de/~leisch/Sweave/

But otherwise a good LaTeX reference is helpful more generally.

HTH,

Marc Schwartz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 46275 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111006/d8e60eaf/attachment.pdf>
-------------- next part --------------




More information about the R-help mailing list