I need to obtain separate page numbers for the frontmatter and mainmatter sections of a book in the 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

推荐答案

使用\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}usinginclude-before-body,它紧跟在标题页之后开始Roman页编号.然后在Ch01.qmd的顶部使用\pagenumbering{arabic}重新设置arabic数字的页码.

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.

R相关问答推荐

R:如何自动化变量创建过程,其中我需要基于ifelse()为现有变量的每个级别创建一个单独的变量

R的GG平行坐标图中的排序变量

提取R中值和列名的所有可能组合

无法将传奇添加到cowplot多情节中

从gtsummary包中使用tBL_strata()和tBL_summary()时删除变量标签

lightgbm发动机在tidymmodels中的L1正则化""

是否可以创建一个ggplot与整洁判断的交互作用

如何自定义3D散点图的图例顺序?

如何在ggplot图中找到第二轴的比例

用关联字符串替换列名的元素

如何指定我的函数应该查找哪个引用表?

从圆到R中的多边形的标绘雷达图

R中有约束的优化问题:如何用复数和对数效益函数解决问题?

如何将Which()函数用于管道%>;%

自定义gggraph,使geom_abline图层仅在沿x轴的特定范围内显示

如何从向量构造一系列双边公式

如何将一列中的值拆分到R中各自的列中

带RStatix的Wilcoxon环内检验

R将函数参数传递给ggploy

R没有按顺序显示我的有序系数?