带有编织器的Rstudio中带有标题的表格和图号

时间:2014-08-15 08:20:22

标签: r knitr rstudio

在knitr和Rstudio的前几次迭代中,使用automatic numbering were not supported的数字标题。但在newer Rmarkdown it seems they are。罗伯特飞行有一个nice solution我以前用过,但我想知道在新的Rmarkdown中是否有更整洁的方法。有吗?

就我的尝试而言,这是我能得到的。字幕不低于数字,不会自动生成数字。

---
title: "Test for caption"
output: 
  word_document:
    fig_caption: true
---


```{r, fig.cap='oh caption my caption', echo=FALSE} 
require(ggplot2)
ggplot(iris, aes(Petal.Width, Petal.Length, color=Species)) + geom_point()
```

会话信息:

R version 3.1.0 (2014-04-10)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] markdown_0.7.4   rmarkdown_0.2.46

loaded via a namespace (and not attached):
[1] digest_0.6.4    htmltools_0.2.4 tools_3.1.0  

1 个答案:

答案 0 :(得分:0)

您似乎使用旧版 rmarkdown ,请尝试upgrade it(至>> = v0.2.65)。