[英]Cross-referencing in a single-file bookdown document
One of the promises of the bookdown package is functions for automatic numbering of figure/table captions, and cross-referencing figures/tables/sections. bookdown软件包的承诺之一是自动编号图/表格标题和交叉引用图/表格/部分的功能。
This is claimed to be enabled for single-Rmd bookdown, if we use bookdown::html_document2
in the YAML: https://bookdown.org/yihui/bookdown/a-single-document.html 据称,如果我们在YAML中使用
bookdown::html_document2
,则可以启用单Rmd bookdown: https bookdown::html_document2
Looking at the raw rmarkdown for that chapter of the bookdown manual, I've tried to follow the instructions to make a single Rmd file that can use those cross-referencing functions. 看一下bookdown手册章节的原始rmarkdown ,我试图按照说明制作一个可以使用这些交叉引用功能的Rmd文件。 But I can't get it to render as expected, with cross-references.
但是我无法通过交叉引用按预期进行渲染。
Here's a simple example Rmd: 这是一个简单的示例Rmd:
---
output: bookdown::html_document2
---
Here's the cross-ref: \@ref(fig:cars-fig)
Here's the figure:
```{r cars-fig, fig.cap = 'Here is a plot about cars'}
plot(cars)
```
Here's the output I get when I click on the knit button in RStudio, the cross-references are not quite working as expected: 这是我点击RStudio中的编织按钮时得到的输出,交叉引用不能按预期工作:
How can I get the cross-referencing to show figure numbers and be a live link to the figure? 如何让交叉引用显示图形编号并成为图形的实时链接? And how can I get the caption to be formatted as expected?
我如何才能按预期格式化标题?
Here's my session info: 这是我的会话信息:
> devtools::session_info()
Session info -------------------------------------------------------
setting value
version R version 3.3.0 (2016-05-03)
system x86_64, mingw32
ui RStudio (0.99.846)
language (EN)
collate English_Australia.1252
tz Australia/Sydney
date 2016-07-02
Packages -----------------------------------------------------------
package * version date source
bookdown 0.0.74 2016-07-01 Github (rstudio/bookdown@8333bbb)
devtools 1.12.0 2016-06-24 CRAN (R 3.3.1)
digest 0.6.9 2016-01-08 CRAN (R 3.3.0)
htmltools 0.3.5 2016-03-21 CRAN (R 3.2.4)
httpuv 1.3.3 2015-08-04 CRAN (R 3.2.3)
memoise 1.0.0 2016-01-29 CRAN (R 3.2.5)
mime 0.4 2015-09-03 CRAN (R 3.2.2)
miniUI 0.1.1 2016-01-15 CRAN (R 3.2.4)
R6 2.1.2 2016-01-26 CRAN (R 3.2.5)
Rcpp 0.12.5 2016-05-14 CRAN (R 3.3.0)
rmarkdown 0.9.6 2016-05-01 CRAN (R 3.3.0)
rsconnect 0.4.3 2016-05-02 CRAN (R 3.3.0)
shiny 0.13.2 2016-03-28 CRAN (R 3.2.4)
withr 1.0.2 2016-06-20 CRAN (R 3.3.0)
xtable 1.8-2 2016-02-05 CRAN (R 3.2.5)
yaml 2.1.13 2014-06-12 CRAN (R 3.2.2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.