rpdflatexquarto

How to change font size in TOC of Quarto PDF


With a simple Quarto book using a custom sans serif font (Lato in the example below) for chapters and sections headings, the chapter headings in the Table of Contents are also modified and appear slightly smaller than the section headings. Section headings are changed to the sans serif font in the document but not in the TOC.

_quarto.yml file:

project:
  type: book

book:
  title: "book"
  author: "Norah Jones"
  date: "29/08/2024"
  chapters:
    - intro.qmd

format:
  pdf:
    documentclass: scrbook
    pdf-engine: lualatex
    toc: true
    sansfont: "Lato"

intro.qmd file:

# Introduction

## first subtitle

This is a book created from markdown and executable code.

See @knuth84 for additional discussion of literate programming. \cite{knuth84}

## second subtitle

table of contents


Solution

  • Maybe try something like this, idea from here (untested):

    sansfont: "Lato"
    include-in-header: 
        text: |
          \usepackage{tocloft}
          \renewcommand{\cftchapfont}{\sffamily\Large}
          \renewcommand{\cftsecfont}{\sffamily}