如何制作没有节编号的 rmarkdown 文档的一部分? [英] How to make part of rmarkdown document without section numbering?

查看:30
本文介绍了如何制作没有节编号的 rmarkdown 文档的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

---作品名称:《测试》作者:《测试测试》几何:边距=1in输出:pdf_文档:keep_tex: 是的latex_engine:xelatexnumber_sections: 是目录:是的目录深度:3标头包括:- usepackage[荷兰语]{babel}- usepackage{fancyhdr}- pagestyle{花式}- fancyfoot[LE,RO]{这是一只花哨的脚}- usepackage{dcolumn}- usepackage{这里}- usepackage{longtable}- usepackage{标题}- captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}副标题:测试测试测试字体大小:12pt---# 开始# 第二```{r results="asis",eval=TRUE,echo=FALSE,message=FALSE,error=FALSE,warning=FALSE,comment = NA,fig.height=4}cat("这里还有一些 R")```# 附录 A# 附录 B

解决方案

只需在节名后添加{-}即可.因此,对于您的附录,您应该执行以下操作:

# 附录 A {-}# 附录 B {-}

有关详细信息,请参阅文档的

I have an rmarkdown document (.Rmd) that I want to knit into a pdf document. number_sections has been put to 'yes' and toc to 'true'. How can I add appendix sections that appear in the table of contents but don't have a section number?

Here is an example .Rmd code. How can I let appendix A and appendix B be numberless sections and let them appear in the table of contents at the same time?

---
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

解决方案

Just add {-} after the section name. Thus, for your appendices, you should do something like:

# appendix A {-}

# appendix B {-}

For more details, see this section of the docs.


Result:

这篇关于如何制作没有节编号的 rmarkdown 文档的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆