书的四开PDF格式中,前言(frontmatter)和正文(mainmatter)的页码不同。

huangapple go评论90阅读模式
英文:

Different page numbers for `frontmatter` and `mainmatter` of book in quarto pdf format

问题

我需要获取书的frontmattermainmatter部分的单独页码,以[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{&lt;style&gt;} command, where the &lt;style&gt; 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: &quot;Title&quot;
  author: &quot;Author&quot;
  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.

huangapple
  • 本文由 发表于 2023年5月29日 01:29:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76352735.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定