我正在尝试使用knitr在文本正文中插入一个小表格。我不确定是knitr/sweave的问题还是xtable的问题,但是我得到了大量围绕表格的空白。这是将表格设置为5cm时输出的示例:
\documentclass{article}
\usepackage{wrapfig}
\usepackage{float}
\begin{document}
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT \par
<<test,echo=FALSE>>=
library(xtable)
## Make some data
School <- c("School A", "School B", "School C", "School D")
N <- c(59, 101, 69, 124)
df <- data.frame (School,N)
x <- xtable(df)
@
\begin{wraptable}[12]{l}[5pt]{5cm}
<<print,results='asis',echo=FALSE>>=
print (x, table.placement = getOption("xtable.table.placement", "H"))
@
\caption{Number of Responses}
\end{wraptable}
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
\end{document}