我试图偏移章节/标题编号,以便第一个 1 级标题从 0 开始。默认从 1 开始。当我为 PDF 输出选项设置
number-offset: -1
时,它不起作用。我还将正偏移量与测试联系起来,例如 number-offset: 2
。那也行不通。我在一个网站上读到,这是 PDF 输出上的一个错误 (https://github.com/quarto-dev/quarto-cli/issues/3126),但它将在 1.3 版本中修复。我假设这意味着 Quarto 版本 1.3。当对 HTML 输出使用相同的 YAML 选项时,数字偏移有效,但它仍然不适用于 PDF 输出。
如有任何建议,我们将不胜感激。谢谢!
以下是我正在运行的版本:
R:4.3.1
RStudio:2323.06.2 +561
四开:1.3.450
潘多克:3.1.1
我知道有一个可用的 pandoc 版本,即 3.1.8,但我还没有尝试过,因为我读到 RStudio 与 pandoc 版本捆绑在一起,并且更改为非捆绑版本可能会导致问题。
下面是默认四开文档中的代码,其中添加了几个我正在渲染为 PDF 的 1 级标题。它还具有 HTML 选项来显示它正在运行。 PDF 数字偏移不起作用。
---
title: "Section Numbering Test"
format:
html:
toc: true
number-sections: true
number-offset: 1
pdf:
include-in-header:
text: |
\usepackage{fancyhdr}
\pagestyle{fancy}
toc: true
toc-depth: 3
geometry:
- top=1.90cm
# - bottom=1.27cm
- left=1.27cm
- right=1.27cm
mainfont: TimesNewRomanPSMT
fontsize: 11pt
number-sections: true
number-offset: -1
---
# INTRO
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
# SPECIFIC STUFF
## Running Code
When you click the **Render** button a document will be generated that includes both content and the output of embedded code.
如有任何建议,我们将不胜感激。谢谢!
如果您使用
number-offset: [-1]
和不同的 YAML 缩进,它对我有用:
---
title: "Section Numbering Test"
format:
html:
toc: true
number-sections: true
number-offset: 1
pdf:
include-in-header:
text: |
\usepackage{fancyhdr}
\pagestyle{fancy}
toc: true
toc-depth: 3
geometry:
- top=1.90cm
# - bottom=1.27cm
- left=1.27cm
- right=1.27cm
mainfont: TimesNewRomanPSMT
fontsize: 11pt
number-offset: [-1]
---
# INTRO
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
# SPECIFIC STUFF
## Running Code
When you click the **Render** button a document will be generated that includes both content and the output of embedded code.