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
- Is it possible to avoid changing fonts in the TOC? (i.e., keep all chapters and sections in default Computer Modern font)
- Is it possible to customize the fonts in TOC only? (e.g., increase the size of chapters in TOC, or change all chapters and sections to the sans serif font)
Maybe try something like this, idea from here (untested):
sansfont: "Lato"
include-in-header:
text: |
usepackage{tocloft}
renewcommand{cftchapfont}{sffamilyLarge}
renewcommand{cftsecfont}{sffamily}
1