英文:
Different page numbers for `frontmatter` and `mainmatter` of book in quarto pdf format
问题
我需要获取书的frontmatter和mainmatter部分的单独页码,以[tag:quarto] [tag:pdf]格式。我在我的_quarto.yml文件中有以下YAML代码。我对实现这一目标的方法很感兴趣。
project:
type: book
execute:
echo: false
warning: false
book:
title: "标题"
author: "作者"
chapters:
- index.qmd
- Ch01.qmd
- Ch02.qmd
- references.qmd
bibliography: references.bib
format:
pdf:
documentclass: scrreprt
toc: true
toc-depth: 3
lof: true
lot: true
英文:
I need to obtain separate page numbers for the frontmatter and mainmatter sections of a book in the [tag:quarto] [tag:pdf] format. I have the following YAML code in my _quarto.yml file. I'm curious about the approach to achieve this.
project:
type: book
execute:
echo: false
warning: false
book:
title: "Title"
author: "Author"
chapters:
- index.qmd
- Ch01.qmd
- Ch02.qmd
- references.qmd
bibliography: references.bib
format:
pdf:
documentclass: scrreprt
toc: true
toc-depth: 3
lof: true
lot: true
答案1
得分: 1
使用\pagenumbering{<style>}命令,其中<style>可以是以下之一:
arabic:使用阿拉伯数字(1、2、3、...)roman:使用小写罗马数字(i、ii、iii、...)Roman:使用大写罗马数字(I、II、III、...)alph:使用小写字母(a、b、c、...)Alph:使用大写字母(A、B、C、...)
因此,要将页码设置为Roman并在Ch01之前使用\pagenumbering{Roman},可以使用include-before-body,这将在标题页之后开始Roman页码。然后,在Ch01.qmd的顶部使用\pagenumbering{arabic}将页码重置为阿拉伯数字。
Ch01.qmd
\pagenumbering{arabic}
# Introduction
This is a book created from markdown and executable code.
See @knuth84 for additional discussion of literate programming.
请注意,这只是代码的翻译部分,没有其他内容。
英文:
Use the \pagenumbering{<style>} command, where the <style> could be one of,
arabic: use Arabic numerals (1, 2, 3, ...)roman: use lowercase roman numerals (i, ii, iii, ...)Roman: use uppercase roman numerals (I, II, III, ...)alph: use lowercase letters (a, b, c, ...)Alph: use uppercase letters (A, B, C, ...)
So to get Roman page-numbering up to the Ch01, use \pagenumbering{Roman} using include-before-body which starts Roman page-numbering just after the title page. And then at the top of Ch01.qmd use \pagenumbering{arabic} to reset the page-numbering in arabic numerals.
project:
type: book
execute:
echo: false
warning: false
book:
title: "Title"
author: "Author"
chapters:
- index.qmd
- Ch01.qmd
- Ch02.qmd
- references.qmd
bibliography: references.bib
format:
pdf:
documentclass: scrreprt
toc: true
toc-depth: 3
lof: true
lot: true
include-before-body:
text: |
\pagenumbering{Roman}
Ch01.qmd
\pagenumbering{arabic}
# Introduction
This is a book created from markdown and executable code.
See @knuth84 for additional discussion of literate programming.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论