RMarkdown with Knit to HTML:如何增加节数?

RMarkdown with Knit to HTML: How to increase section number?

我正在使用 RMarkdown(使用 R Studio)中的 KnitR HTML 生成 HTML 页面。

我需要从任意数字开始的章节编号,而不是 0 或 1。

我正在努力实现的示例:

TITLE
2 SECTION
2.1 SUB-SECTION

我使用的代码如下:

---
title: "TITLE"
output:
  html_document: 
    number_sections: yes
---

# SECTION

## SUBSECTION

我在 this question 中找到了以下内容。


pandoc 选项 --number-offset 允许指定“HTML 输出中章节标题的偏移量”:

--number-offset=NUMBER[,NUMBER,…]

Offset for section headings in HTML output (ignored in other output formats). The first number is added to the section number for top-level headers, the second for second-level headers, and so on. So, for example, if you want the first top-level header in your document to be numbered “6”, specify --number-offset=5. If your document starts with a level-2 header which you want to be numbered “1.5”, specify --number-offset=1,4. Offsets are 0 by default. Implies --number-sections.

引自 pandoc README file.