Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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,

ToC

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading