I'm creating PDFs from markdown files and would like to customize the output. Specifically, I'd like to change the title of the table of contents in the resulting PDF.

Currently, it's "Contents":


How can I change that title?

I'm calling Pandoc 2.7.2 on Arch Linux 5.1.2 like this:

pandoc --pdf-engine=xelatex --toc test.md -o doc.pdf

For completeness, this is test.md:

# First Heading
Some text

# Second Heading
More text

# Third Heading
Even more text

1 Answer 1


with -V toc-title:"Custom text"

Having a look at the template at /usr/share/pandoc/data/templates/default.latex, there's this part:


This suggests that we can pass a parameter toc-title to Pandoc:

pandoc --pdf-engine=xelatex --toc test.md -V toc-title:"Custom text" -o doc.pdf

And indeed, the title of the table of contents has changed:


For more on modifying the templates, see this answer and the documentation.

To change also the abstract title from "Abstract" to something else, you can insert

  \renewcommand{\abstractname}{Different abstract title}

in the file's metadata block. This is described here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.