【发布时间】:2016-02-15 10:48:11
【问题描述】:
我有一个由 knitr 代码块生成的表。该表使用xtable 打印。它的标题设置在xtable 函数内。此标签太长,无法显示在文档开头的表格列表中。因此我想设置一个短标签,而不是这个列表中的长标签。
对于生成的绘图,此标签可以通过块选项fig.scap 设置,但是当我尝试将其用于表格时,长标签仍保留在表格列表中。
我想我可以在代码块之外使用\captionof{table}[short label]{long label} 来处理这个问题,但这不是一种非常简单的方法,而且我担心我会在将表格及其标题卡在一起时遇到问题。有更好的方法吗?
代码(人工数据):
\documentclass[a4paper,12pt, english]{article}
\usepackage{capt-of}
\begin{document}
\listoffigures
\listoftables
\section{Intoduction}
<<Chunk1, results="asis", echo=FALSE, fig.scap= "short caption - tab">>=
library(xtable)
print(xtable(head(iris), caption="long caption of the table"))
@
<<Chunk2, results="asis", echo=FALSE,fig.align="center", fig.cap = "Long caption of the figure", fig.scap= "short caption - fig">>=
plot(iris[,1:2])
@
\end{document}
【问题讨论】:
标签: r latex knitr caption xtable