Jean-Alexandre Patteet
Jean-Alexandre Patteet

Reputation: 159

Multiple bibliographies in quarto book (pdf)

I am trying to write my PhD thesis in quarto and render as pdf. The first part is in french and made of many chapters. I would like the last chapter of the first part to have a reference section that has the refs of all the citations of the first part (citations can be found in many different chapters).

The second part is made of articles in english. In this part, articles (chapters) have all a separate reference section.

I have 3 .bib file, one for the first part in french and one for each article and I would like that the ref sections display the proper refs. Right now I only manage that all ref sections display all the refs from all chapters and parts in the book.

Here are simplified files with curent issue.

_quarto.yml

project:
  type: book

book:
  title: "Test biblatex"
  author: "Me"
  date: today

  chapters:
    - index.qmd
    - part: "Manuscrit (français)"
      chapters:
        - Chap1.qmd
        - Chap2.qmd
        - Refsection.qmd
    - part: "Articles (english)"
      chapters:
        - Article1.qmd
        - Article2.qmd


format:
  html:
    theme: cosmo
  pdf:
    fig-pos: H
    documentclass: scrreprt
    keep-tex: true
    include-in-header: 
      text: |
        \usepackage{multirow} 
        \usepackage{hyperref} 
        \usepackage[capitalise,noabbrev]{cleveref}

        
    latex-max-runs: 3
editor: visual

bibliography: 
  - Biblio.bib
  - BibArt1.bib
  - BibArt2.bib

index.qmd

# Preface {.unnumbered}

This is a Quarto book with biblatex multiple reference sections.

The goal is to have a reference section at the end of Part 1.
All citations from Chap1.qmd and Chap2.qmd should be in the reference section called in Refsection.qmd
All these refs will be stored in a single .bib file, here Biblio.bib

Then in part 2 which are articles, each .wmd file has its own reference section.
So Article1.qmd has a ref section with references coming from BibArt1.bib
And Artcile2.qmd has a ref section with refrences coming from BibArt2.bib

Chap1.qmd

# Chap 1

This is chapter 1 and it has one citation [@knuth84]. Or @knuth84.

Chap2.qmd

# Chap 2

This is chapter 2 and it has one citation [@Chumbley2010].

Refsection.qmd

@article{knuth84,
  author = {Knuth, Donald E.},
  title = {Literate Programming},
  year = {1984},
  issue_date = {May 1984},
  publisher = {Oxford University Press, Inc.},
  address = {USA},
  volume = {27},
  number = {2},
  issn = {0010-4620},
  url = {https://doi.org/10.1093/comjnl/27.2.97},
  doi = {10.1093/comjnl/27.2.97},
  journal = {Comput. J.},
  month = may,
  pages = {97–111},
  numpages = {15}
}

@article{Chumbley2010,
   author = {Chumbley, L. Scott and Morris, Max D. and Kreiser, M. James and Fisher, Charles and Craft, Jeremy and Genalo, Lawrence J. and Davis, Stephen and Faden, David and Kidd, Julie},
   title = {Validation of Tool Mark Comparisons Obtained Using a Quantitative, Comparative, Statistical Algorithm},
   journal = {Journal of Forensic Sciences},
   volume = {55},
   number = {4},
   pages = {953-961},
   ISSN = {1556-4029},
   url = {http://dx.doi.org/10.1111/j.1556-4029.2010.01424.x},
   year = {2010},
   type = {Journal Article}
}

Article1.qmd

# Article1

This is article 1

should contain only references [@Cassidy1997] from this .qmd file coming from BiArt1.bib.


::: {#refs}
:::

BibArt1.bib

@article{Cassidy1997,
   author = {Cassidy, Frank H.},
   title = {Bolt Cutter Tool Marks},
   journal = {AFTE Journal},
   volume = {29},
   number = {4},
   pages = {484-486},
   year = {1997},
   type = {Journal Article}
}

Article2.qmd

# Article2

This is article 2

should contain only references [@Meuwly2017] from this .qmd file coming from BiArt2.bib.


::: {#refs}
:::

BibArt2.bib

@article{Meuwly2017,
   author = {Meuwly, Didier and Ramos, Daniel and Haraksim, Rudolf},
   title = {A Guideline for the Validation of Likelihood Ratio Methods Used for Forensic Evidence Evaluation},
   journal = {Forensic Science International},
   volume = {276},
   pages = {142-153},
   ISSN = {0379-0738},
   DOI = {https://doi.org/10.1016/j.forsciint.2016.03.048},
   year = {2017},
   type = {Journal Article}
}

Here is the ref section from Refsection.qmd I would like to only have the refs from Knuth and Chumbley as they are the ones from Cha1.qmd and Chap2.qmd. The other ref sections look exactly the same.

enter image description here

Upvotes: 1

Views: 647

Answers (1)

Shafee
Shafee

Reputation: 20097

Here's a solution directly using the raw latex commands.

You can use the biblatex package to get chapter wise bibliography from different bib files. biblatex provides an option refsection, from the package manual (page-54),

refsection=none, part, chapter, chapter+, section, section+, subsection, subsection+ default: none

This option automatically starts a new reference section at a document division such as a chapter or a section

_quarto.yml

project:
  type: book

book:
  title: "Mybook"
  author: "Norah Jones"
  date: "8/22/2023"
  chapters:
    - index.qmd
    - part: "Part 1"
      chapters: 
        - intro.qmd
    - part: "Part 2"
      chapters: 
        - summary.qmd

format:
  pdf:
    documentclass: scrreprt
    include-in-header: 
      text: |
        \usepackage[natbib=true,citestyle=authoryear,refsection=chapter]{biblatex}
        \addbibresource{references.bib}
        \addbibresource{pkg.bib}

intro.qmd

# Introduction

This is a book created from markdown and executable code.

See \citep{knuth84} for additional discussion of literate programming.

\printbibliography[heading=subbibliography]

summary.qmd

# Summary

In summary, this book has no content whatsoever. See \citep{R-dplyr}

\printbibliography[heading=subbibliography]

references. Bib

@article{knuth84,
  author = {Knuth, Donald E.},
  title = {Literate Programming},
  year = {1984},
  issue_date = {May 1984},
  publisher = {Oxford University Press, Inc.},
  address = {USA},
  volume = {27},
  number = {2},
  issn = {0010-4620},
  url = {https://doi.org/10.1093/comjnl/27.2.97},
  doi = {10.1093/comjnl/27.2.97},
  journal = {Comput. J.},
  month = may,
  pages = {97–111},
  numpages = {15}
}

pkg.bib

@Manual{R-dplyr,
  title = {dplyr: A Grammar of Data Manipulation},
  author = {Hadley Wickham and Romain François and Lionel Henry and Kirill Müller and Davis Vaughan},
  year = {2023},
  note = {https://dplyr.tidyverse.org},
}


first chapter with references

second chapter with references

Upvotes: 1

Related Questions