Closed Robinlovelace closed 4 years ago
Hi Robin, have you looked at citr::md_cite()
? If this is what you are looking for, I admit the function name could be more descriptive. I could add insert_citation_cli()
or insert_citation_console()
as an alias.
I have but that still doesn't help if you're in a shell on a remote server.
Hmm, I'm not sure I understand your setup and/or the problem. That function does not rely on either Zotero or shiny
. It returns the citation key to the R console. Is this where you are looking for a solution? An automatic insertion into an R Markdown file?
Aha I see this:
citr::md_cite(x = "geocomp", bib_file = "vignettes/references.bib")
Lovelace, Nowosad, & Muenchow (2019). Geocomputation with R.
[1] "[@lovelace_geocomputation_2019]"
That is news to me. Great job, and resolves this issue. My only additional comment would be that it could be useful to output the citation in alternative formats, e.g. as a RefManageR::as.BibEntry()
object, or character strings representing .bib files. I could imagine a format_out
argument could do that but that may be mission creep. I'm thinking about the situation where you want to search for a citation in a big .bib file and then append the result to a smaller one manually.
Great. Indeed, this seems a little beyond the scope of the package. However, a simple way to achieve the same goal would be to simply work off of a copy of the complete bibliography file and, once all desired citations have been inserted, use tidy_bib_file()
to remove everything that's not needed.
Thanks for quick-fire follow up on this, definitely answers the question.
When using
citr
in an environment that does not support shiny, it's hard to insert citations. I think a command line interface version of the excellentinsert_citation()
function would be possible and useful.Describe the solution you'd like
A function for inserting citations that does not rely on shiny.
Describe alternatives you've considered
Currently I open the bib file(s) or Zotero and copy paste. There must be a better way!