如何使用officedown省略R Markdown目录中的部分

问题描述 投票:0回答:2

我正在起草一份需要目录并需要编写到Word 中的rmd。我正在使用 officedown 包,虽然我可以获得目录,但我需要让表格不包含目录的节标题。我有这个:

---
output:
  officedown::rdocx_document:
    reference_docx: word_styles_ref_01.docx
---



{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.cap = TRUE)
library(officedown)
library(officer)

<!---CHUNK_PAGEBREAK--->    
# Table of Contents 
<!---BLOCK_TOC--->    
<!---CHUNK_PAGEBREAK--->



My report starts here.

# Heading 1
My report starts here.

## Heading 2
And I have this next subsection. 

但我不希望“目录”在实际目录中重复。在上面的代码中,它在带有页码的单词文档中重复。有没有办法不将其包含在目录中?

r r-markdown officedown
2个回答
1
投票

根据 https://bookdown.org/yihui/rmarkdown-cookbook/toc-unlisted.html,只需在标题后添加 {.unlisted .unnumbered} 即可。


0
投票

@Gregory 谢谢,你的解决方案对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.