由rmarkdown生成的pdf文档中表格的标题
问题描述:
如何获取由rmarkdown生成的pdf_document中的表格浮动标题?
How can I get captions on my table floats in pdf_document generated by rmarkdown?
使用
output:
pdf_document:
fig_caption: true
和
```{r, fig.cap='a caption'}
myplot
```
生成带有myplot和指定标题的浮动图形.
Generates a floating figure with myplot and the caption specified.
如何使用xtable生成的表实现相同的目的?
How do I achieve the same thing with tables generated by xtable?
```{r, results='asis', fig.cap='table caption'}
print(xtable(table), comment = FALSE)
```
我尝试在print.xtable中使用float.environment ='figure',但无济于事.
I have tried using floating.environment = 'figure' in print.xtable, but to no avail.
答
标题"是xtable的参数,而不是print.xtable
The 'caption' is a parameter to xtable, not to print.xtable
```{r, results='asis'}
print(xtable(table, caption='Captions goes within xtable'), comment = FALSE)
```