3

I like to have multiple bibliographies in a Quarto document (PDF output). Could you give me a hint what is wrong with this code? (I've tried the refsection evironment from biblatex Separate bibliographies per chapter? )

---
title: "resize image"
bibliography: refs.bib 
format: pdf
header-includes:
  \usepackage{biblatex}
---

\begin{refsection}
Text \cite{ref1}
\printbibliography
\end{refsection}

Produces strange output like: Text [ref1]

ckluss
  • 1,477
  • 4
  • 21
  • 33

2 Answers2

3

Update (using pandoc filter)

Using the pandoc filter section-bibliographies as a Quarto Extension, provided by @tarleb, section-wise bibliographies can be created more neatly.

---
title: "Sectionwise Bibliography"
bibliography: pkg.bib 
format: pdf
keep-tex: true
filters:
  - section-bibliographies
reference-section-title: References
---

# Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

[see @R-knitr]

# Running Code

When you click the **Render** button a document will be generated that includes both content and the output of embedded code. 

[see @R-ggplot2]


using pandoc filter section-bibliographies


Using Latex

Quarto itself has an option cite-method to specify to use the biblatex as the citation manager.

---
title: "resize image"
bibliography: pkg.bib 
format: pdf
cite-method: biblatex
biblatexoptions:
  - citestyle = authoryear
---

\begin{refsection}
Text \cite{R-knitr}
\printbibliography
\end{refsection}

chapter wise referencing with biblatex


Contents of the associated pkg.bib file,

@Manual{R-ggplot2,
  title = {ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics},
  author = {Hadley Wickham and Winston Chang and Lionel Henry and Thomas Lin Pedersen and Kohske Takahashi and Claus Wilke and Kara Woo and Hiroaki Yutani and Dewey Dunnington},
  year = {2022},
  note = {https://ggplot2.tidyverse.org},
}

@Manual{R-knitr,
  title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
  author = {Yihui Xie},
  year = {2022},
  note = {R package version 1.39},
  url = {https://yihui.org/knitr/},
}
shafee
  • 15,566
  • 3
  • 19
  • 47
3

An alternative to the LaTeX-based solution is to use a Quarto extension. The sections bibliographies filter should do what you need, while also supporting other output formats. See here for usage instructions: https://github.com/pandoc-ext/section-bibliographies#quarto

tarleb
  • 19,863
  • 4
  • 51
  • 80
  • thank you very much for the hint, that makes it even easier – ckluss Sep 25 '22 at 17:11
  • @tarleb should it work for HTML output as well? I can't get it to work. All references show up in the first page only. All others are empty – Felipe Jun 10 '23 at 06:03