I want to include separate references sections for main text and supplementary text in an Rmarkdown document. The approach suggested here and here largely works, but if there are references that appear in both specified .bib files, then they appear in both lists, even if they are cited in only one section.
I got around that issue by renaming the keys in the second .bib file and then using the altered citation keys in the supplement. This worked, until I cited the same paper in the main text and the supplement. Then they were construed as different citations, so they are labeled with "a" and "b", e.g., (Smith et al. 2000a) and (Smith et al. 2000b), even though it is the exact same reference.
I got around this issue by including in the 2nd .bib file only those references that are cited in the supplement. If those references are also cited in the main text, I leave them unmodified, but if they appear only in the supplement, then I modify the cite key. Then the modified keys generate an appearance in only the 2nd bibliography. This seems to work but is cumbersome (and prone to error, if in-text citations are added or removed, etc.).
Is there a better way? What I would like is to specify a single .bib file, which includes any possible reference that will be cited (plus a bunch more - it's linked to Zotero, and I use the citr
package to insert citations). Then I'd like some way to reset the range over which citations are scanned. For example, I'd have
---
bibliography: "My Library.bib"
output:
bookdown::pdf_book:
fig_caption: yes
df_print: paged
number_sections: no
pandoc_args: --lua-filter=multiple-bibliographies.lua
toc: no
keep_tex: true
base_format: rticles::elsevier_article
---
# Main text
A bunch of text here with citations.
<!-- list all citation (and only those) occurring before the "\restartbib" function. -->
# Refereneces
::: {#refs}
:::
\restartbib
# Supplement
Some more text with citations, some of which also may be cited in the main text.
<!-- list all citation occurring after the "\restartbib" function. -->
# Supplemental Refereneces
::: {#refs}
:::
The \restartbib
function would specify that any citations occurring prior to the function command (and only those citations) are listed in the reference that also is specified before the function command. Similarly, any citations occurring after the command appear only in the following bibliography (unless they also are cited in the previous section). In short, the function would make the two bibliographies independent from each other.
Ideally, this function could be invoked as often as necessary for >2 independent bibliographies.
Is this any way to accomplish this?
\begin{refsection}
and\end{refsection}
. You can print the independent bibliography for each section using\printbibliography
before\end{refsection}
, as described here: tex.stackexchange.com/questions/19326/section-bibliographies. – Mouton