>标题说明了一切。有关最小(非(工作示例,请参见下文。
---
title: "Untitled"
author: "Anonymous"
date: "09/01/2020"
output: bookdown::word_document2
---
# First Section {#sec1}
Etc.
# Second Section
See section @ref(sec1).
当我编织上述内容时,我收到以下警告:
Output created: mre.docx
Warning message:
The label(s) sec1 not found
输出中的引用将替换为两个问号 (??(。当我将 YAML 标头中的输出选项替换为pdf_document2
时,没有错误。我的template.docx
为所有标题样式启用了章节编号,并且章节编号正确(只是不是参考文献(。
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.9.0
LAPACK: /usr/lib/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.2 Matrix_1.2-18 bookdown_0.16 htmltools_0.4.0 tools_3.6.2 yaml_2.2.0 reticulate_1.13 Rcpp_1.0.3 rmarkdown_1.17 grid_3.6.2 knitr_1.26 jsonlite_1.6
[13] digest_0.6.22 xfun_0.11 rlang_0.4.1 lattice_0.20-38 evaluate_0.14
> pandoc --version
pandoc 2.8
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3
我一直在为同样的问题而苦苦挣扎,我找到了解决方法
这是 Rstudio 小组正在处理的已知问题。
https://github.com/rstudio/bookdown/issues/787
我能够通过使用 Rstudio 中安装的 pandoc 版本(当前为 2.7.2(来解决此问题。 在窗口中,我通过从 PATH 中删除 pandoc 然后重新启动我的 Rstudio 会话来做到这一点。