List of Tables and List of Figures in Table of Contents using Quarto book in pdf format

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

List of Tables and List of Figures in Table of Contents using Quarto book in pdf format

问题

我想获取目录中的表格列表(lot)和图表列表(lof)以及书籍的[标签: quarto] [标签: pdf]格式。我在我的 _quarto.yml 文件中有以下 YAML 代码。我对实现这一目标的方法很感兴趣。

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
英文:

I would like to get List of Tables (lot) and List of Figures (lof) in Table of Contents (toc) 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

使用 LaTeX 包tocbibind。根据该包的文档,

> tocbibind 包使得目录、图表目录、表格目录、参考文献和索引的标题都可以添加到目录中。默认情况下,如果存在这些文档元素,它们都会被并入目录。

因此,它还会包括Table of Contents的标题,这可能不是你想要的。要禁止包含Table of Contents,请使用 nottoc 作为 classoption。

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
    classoption: nottoc
    toc: true
    toc-depth: 3
    lof: true
    lot: true
    include-in-header: 
      text: |
        \usepackage{tocbibind}

现在目录的样子如下:

List of Tables and List of Figures in Table of Contents using Quarto book in pdf format

英文:

Use the latex package tocbibind. From the package documentation,

> The tocbibind package enables the titles of the Table of Contents, the List of
Figures, the List of Tables, the Bibliography and the Index all to be added to the
Table of Contents. By default, all of these document elements, if they exist, will
be incorporated into the Table of Contents.

So it will include the title Table of Contents too, which probably you do not want. To disable the inclusion of Table of Contents, use nottoc as classoption.

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
    classoption: nottoc
    toc: true
    toc-depth: 3
    lof: true
    lot: true
    include-in-header: 
      text: |
        \usepackage{tocbibind}

And the ToC looks like this now,

List of Tables and List of Figures in Table of Contents using Quarto book in pdf format

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

发表评论

匿名网友

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

确定