【问题标题】:Number some sections with rmarkdown使用 rmarkdown 对某些部分进行编号
【发布时间】:2018-06-05 12:38:03
【问题描述】:

我正在用 rmarkdown 写一篇手稿。

如果我想给所有部分编号,我可以像这样使用 YAML

---
title: "My Report"
output: 
  html_document:
    number_sections: true
---

见Automatically number sections in RMarkdown

但我只想给一些部分编号,所以我的文档看起来像

摘要
1.简介
2.方法
3.结果
参考文献

有没有办法做到这一点?

【问题讨论】:

标签: r r-markdown


【解决方案1】:

从 Pandoc User Guide 你想将.unnumbered 属性添加到标题中。这是使用:

# My header {.unnumbered}

或快捷方式

# My header {-}

例如使用下面的文档

---
title: "My Report"
output: 
  html_document:
    number_sections: true
---

# Abstract {-}

# Introduction

# Methods

# Results

# References {-}

生成的 HTML 呈现为:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-28
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 2021-12-13
    • 1970-01-01
    • 2022-10-21
    相关资源
    最近更新 更多