【发布时间】:2022-01-18 11:18:32
【问题描述】:
我知道如何缩进文本,例如项目符号和数字列表,但我也对缩进编号的部分和子部分感兴趣。给定以下代码,它会呈现到代码之后的屏幕截图。目录缩进了小节,我也想缩进内容正文。
是否也可以缩进文档正文中的小节?之后查看Desired Output Example 项。
---
title: "R Markdown Example With Numbered Sections"
output:
bookdown::pdf_document2:
toc: true
toc_depth: 6
number_sections: true
---
# Section A
## Level 2 A
### Level 3 A
#### Level 4 A
## Level 2 A
# Section B
## Level 2 B
不带缩进小节的渲染
所需的输出示例
... table of contents as above ...
1 Section A
1.1 Level 2 A
1.1.1 Level 3 A
1.1.1.1 Level 4 A
1.2 Level 2 A
2 Section B
2.1 Level 2 B
编辑:2021-12-15
@Peter 的解决方案在 Mac 上为我工作,但需要针对我正在使用的 Linux 系统的解决方法。我发现解决方案无法在我的 Linux 机器上运行的问题是 titlesec 的 2.10 版中的错误导致的(这就是我所拥有的)。修复可以是更新titlesec 或使用解决方法;两者都在此链接中进行了描述:titlesec: loss of section numbering with the new update (2016/03/15)
【问题讨论】:
-
你可以尝试使用类似的东西: ` header-includes: - \renewcommand{\thesubsection}{\hspace{1cm}\arabic{section}.\arabic{subsection}} ` 这里,这个进一步讨论:tex.stackexchange.com/questions/60209/…
-
@Lucas 谢谢。我需要更好地理解如何将完整的 TeX 解决方案翻译成 R Markdown。
标签: r r-markdown