How can one extract works cited in project-manuscripts from a larger .bib-file and write them to a local project-bound .bib-file? #8160
-
DescriptionHello, this is probably an odd question. For R-Code, the print(getwd())
a <- quarto::quarto_inspect()
root <- a$dir
setwd(root)
refs <- grateful::scan_packages(pkgs="All",dependencies = T)
table <- grateful::cite_packages(output=c("table"),out.dir = stringr::str_c(root,"\\.pandoc"),pkgs = "All",cite.tidyverse = T,bib.file = "packages",dependencies = F) So far I always cited from my personal reference lib, and didn't have to provide a bib-file. Therefore, I could reference my large main-lib bib-file by an absolute path in the manuscript's A quick overview on the project structure: root/
.pandoc/
X.csl
packages.bib (autogenerated by pre-render script mentioned above)
references.bib // this is the desired output location of the file I am trying to generate and then reference to in the manuscript's YAML
report/
manuscript.qmd
scripts/
pre-render/
compile_bibs.R I am now trying - and failing - to figure out how/if I can implement this for citations within non-code files (e.g. Is something like this possible? I've done a somewhat deep search for how to do this, but so far I could not find anything that is of any substantial help. I am aware this is only partially a quarto-related question at its core. I would need a solution written in R for proper implementation into the project's workflow. I am open for any suggestions. Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Yes and you can write your own script as a pre-render script, including R script, see https://quarto.org/docs/projects/scripts.html#pre-and-post-render. Note that I find this approach a bit cumbersome, i.e., your described workflow is:
Why not export the needed citations from your bibliography manager such as Zotero and use the bib file directly? |
Beta Was this translation helpful? Give feedback.
-
I want to share this as its own answer what was already mentioned in another thread in this discussion. The Visual Editor for Quarto document (available in VS CODE and RStudio IDE) brings support for Zotero Citation which includes adding to the bibliography file for the project This enables a workflow where:
So it does not really answer the extraction of the bibliography items already in Qmd file, but it could be quite helpful for future projects IMO. Links to doc: |
Beta Was this translation helpful? Give feedback.
I want to share this as its own answer what was already mentioned in another thread in this discussion.
The Visual Editor for Quarto document (available in VS CODE and RStudio IDE) brings support for Zotero Citation which includes adding to the bibliography file for the project
This enables a workflow where:
So it does not really answer the extraction of the bibliography items already in Qmd file, but it could be quite helpful for future projects IMO.
Links to doc: