an R markdown file index.rmd:

title: title
author: author
bibliography: bib.bib
    latex_engine: xelatex
    toc: true
    pandoc_args: ["--biblatex"]
  - \usepackage[]{biblatex}

# heading
lorem \autocite{mycite}

Results in:

pdf page with table of content with the first section, and references not included in table of contents

I want to add the references section to ToC. I tried half a dozen of solutions, one of which is Bibliography not in ToC when using biblatex/biber.

Much like all other solutions, adding \printbibliography[heading=bibintoc] resulted in duplicating the references section: enter image description here

Is there a way to suppress the references section entirely to configure it manually?

(Being able to rename the references section would be nice, too)



\printbibliography[heading=bibintoc, title={Works Cited}]

would be the correct choice. But with Rmarkdown/pandoc the bibliography is produced automatically for you, so adding a \printbibliography in the code yourself produces a second bibliography.

The pandoc template located at https://github.com/jgm/pandoc-templates/blob/master/default.latex suggests that there is no way to inject options like heading=bibintoc into the \printbibliography produced by pandoc. But it is possible to set the bibliography title with

biblio-title: Works Cited

If pandoc does not sanitise the input you give there with braces, it may be possible to inject options that way

biblio-title: Works Cited, heading=bibintoc

I'm not sure if that works, but even if did, it would be an incredibly dirty trick.

With a modern biblatex version (at least v3.12 from 2019-08-17) you can add


to your preamble to make heading=bibintoc the default for all \printbibliography calls.

If that command is not available because you biblatex is too old you can add


to your preamble. That makes the default bibliography heading bibliography have the same definition as bibintoc.

If I understand correctly it should be possible to use

    citation_package: biblatex
biblio-style: numeric
biblatexoptions: [backend=biber, maxbibnames=999]

to have Rmarkdown/pandoc load biblatex for you instead of adding it via \usepackage[]{biblatex} and the --biblatex option.

Compare for example Using biblatex with R Markdown.

  • I couldn't get biblatex-chicago to work with the piece of code at the end. – simohamed May 21 '20 at 19:22
  • 1
    @simohamed Ah yes, biblatex-chicago is a special case since it should generally be loaded via its own wrapper package \usepackage{biblatex-chicago} instead of \usepackage[style=<style>]{biblatex}. You could try citation_package: biblatex+biblio-style: chicago-authordate/biblio-style: chicago-notes, but this may not get everything right. Maybe that's worth a feature request to the pandoc developers? – moewe May 21 '20 at 19:27

Add the following:

\section*{Works Cited} % adds section
\addcontentsline{toc}{section}{Works Cited} % adds section to table of content
\defbibheading{bibliography} % replaces bibliography heading with nothing 

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.