What LaTeX package to use with knitr to get more table-control? tabu?

偶尔善良 提交于 2019-12-06 02:36:23

I can confirm (as maintainer of xtable) that no backslashes are needed. I have updated the documentation of xtable on R-Forge.

A couple of notes:

There is an example of the use of fixed width alignments in the xtable Gallery vignette.

Also, a slightly simpler specification works, namely, align = "llp{5cm}"

xtable has parameter align; for your example, try

 align=c("l","l","l","p\{5cm\"})

Edited (after checking @Alex A. comment): The \before the last " was definitively wrong, but this time I checked carefully. Looks like the following version without any backslashes is correct. I will report the error in the docs to the package author.

\documentclass{article}

\begin{document}

<<a, results='asis'>>=
library(xtable)
x  = data.frame(a=1:10,
     b=rep("This is a very long text that takes up to much space",10),
     stringsAsFactors = FALSE)

xt = xtable(x, align=c("l","l","p{5cm}"))
print(xt, include.rownames=FALSE)
@

\end{document}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!