# [R] Fwd: xtable and sweave: caption placement problem

renger at vannieuwkoop.ch renger at vannieuwkoop.ch
Fri Nov 18 10:22:08 CET 2011

Dear All

I am running Sweave with xtable and want to put the caption placement
on top. But this does not work. Any idea what is going wrong?

Here is an example that runs properly with the exception of the
caption placement in the pdf-file.

\documentclass[11pt,a4paper]{article}
\usepackage{Sweave}
\begin{document}
<<>>=
x  =  runif(100,  1,  10)
y  =  2  +  3  *  x  + rnorm(100)
@

<<echo=FALSE,results=tex>>=
library(xtable)
print(xtable(summary(lm(y~x)),
align="rcccc",
caption="Summary  statistics  for  the  regression  model",
caption.placement="top", label="tab:summary",
digits=2))

@

\end{document}

Renger

_________________________________________
Renger van Nieuwkoop
Centre for Energy Policy and Economics, ETH Zürichbergstrasse 18 (ZUE)
CH - 8032 Zürich
+41 44 632 02 63
mailto: renger at vannieuwkoop.ch
blog.modelworks.ch