Quarto Book: Put footnote on chapter header

86 Views Asked by At

I want to put a footnote on chapter headers in Quarto book format. It seems to work fine when rendered to PDF, but does crazy things when rendered to HTML.

Specifically, suppose these are chapter headers in two Quarto book files:

# A Chapter Header^[Footnote text for A Chapter Header.] {#sec-a_chapter}
# B Chapter Header[^ch_head] {#sec-b_chapter}


[^ch_head]: Footnote text for B Chapter Header.

They work fine when rendered to PDF. But when rendered in HTML, multiple copies of the footnotes appear, and the footnotes appear on the index.qmd page, and the header footnotes get incorporated into the chapter titles in the table of contents.

How can footnotes be put on chapter headers, and render properly in both PDF and HTML?

(I have also posted this question at the Quarto forum on GitHub.)


A complete, minimal example is below. Because it is a Quarto book project, it has multiple files.

File _quarto.yml:

project:
  type: book

book:
  title: "Quarto Book Test"
  author: "Firstname Lastname"
  chapters:
    - index.qmd
    - a_chapter.qmd
    - b_chapter.qmd

format:
  html:
    theme: default
  pdf:
    documentclass: book

File index.qmd:

# Preface {.unnumbered}

This is a Quarto book.

**There are no footnotes specified on this page.**

File a_chapter.qmd:

# A Chapter Header^[Footnote text for A Chapter Header.] {#sec-a_chapter}

This chapter header has a footnote with `^[text]` format.

This sentence has a footnote^[Text of sentence footnote.]

Check chapter links: See @sec-b_chapter.

File b_chapter.qmd:

# B Chapter Header[^ch_head] {#sec-b_chapter}

[^ch_head]: Footnote text for B Chapter Header.

This chapter header has a footnote with `[^label]`, `[^label]: text` format.

This sentence has a footnote^[Text of sentence footnote.]

Check chapter links: See @sec-a_chapter.

Here are screenshots of output in HTML.

The table of contents with undesired footnotes in the chapter headers:

enter image description here

The preface with mysterious footnotes:

enter image description here

Chapter 1 with mysterious footnotes:

enter image description here


0

There are 0 best solutions below