【问题标题】:How to make part of rmarkdown document without section numbering?如何制作没有节编号的 rmarkdown 文档的一部分?
【发布时间】:2016-03-26 18:30:40
【问题描述】:

我有一个 rmarkdown 文档 (.Rmd),我想将其编入 pdf 文档。 number_sections 设置为“yes”,toc 设置为“true”。如何添加出现在目录中但没有节号的附录节?

这是一个示例 .Rmd 代码。怎样才能让附录A和附录B成为无数节,让它们同时出现在目录中?

---
title: "Test"
author: "test test"
geometry: margin=1in
output:
  pdf_document:
    keep_tex: yes
    latex_engine: xelatex
    number_sections: yes
    toc: yes
    toc_depth: 3
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{this is a fancy foot}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{longtable}
- \usepackage{caption}
- \captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
subtitle: test test test
fontsize: 12pt
---
# start

# second

```{r results="asis",eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA,fig.height=4}
cat("and here some R")
```

# appendix A

# appandix B

【问题讨论】:

  • 你的意思是你想要他们字母而不是编号?您能展示一下您希望目录的外观吗?
  • @BenBolker,不,我不想给他们写字母。我已经有了答案,但我理解你的问题。下次我也会尝试做出更喜欢的结果。

标签: r latex pdf-generation r-markdown


【解决方案1】:

只需在部分名称后添加{-}。因此,对于您的附录,您应该执行以下操作:

# appendix A {-}

# appendix B {-}

有关更多详细信息,请参阅文档的this section


结果:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-28
    • 2017-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多