-
-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
geocompr.bib: attempt to add URL of r-spatial.org/book #661
Conversation
Thanks for this change and (even more!) for the discussion.
@Robinlovelace your thoughts could be also important here. |
Hi @Nowosad if you're prepared to try RStudio VME (beware, it may cause various Rmd syntax changes depending on project settings) I believe it can be done directly from there (not using Zotero groups myself however, and -admittedly- not VME either). Then that surely is the easiest way. We made a tutorial which may shed some further light (https://inbo.github.io/tutorials/tutorials/r_citations_markdown/). For manual insertion of bibliographic records from Zotero I use the RStudio addin of result: Your json file looks fine; if you do it manually with Zotero, always export as 'Better CSL JSON' (or 'Better CSL YAML') (from the Better BibTeX addon). I believe with The RStudio VME 'insert citation' addon is really cool though; it can read from various sources (including Zotero) while inserting a citation, meanwhile amending your existing bibliography file - not just overwriting the whole thing. So it is perfect for collaborative setups. BTW there's a pending request in the RStudio repo issues to make the addon available in Rmd source mode. |
I leave that totally to the author's preferences 😄 |
Zotero Groups are supported in RStudio VME: https://rstudio.github.io/visual-markdown-editing/citations.html#group-libraries |
Thanks! I am definitely not ready for RStudio VME - I have tried it but found it slow on my computer. Also, after writing many documents in the Rmd source mode, I got used to it. I will wait for the addon mentioned above. |
@Robinlovelace @jannes-m do you have any favorite csl? |
@florisvdh One important thing I forgot to ask before. Could we use CSL-JSON / CSL-YAML in LaTeX? We need both html and pdf versions for the Geocomputation with R book... |
Yes it's no problem as long as you use Pandoc as a front-end to LaTeX (e.g. by using rmarkdown 🙂) and it will give you consistency between outputs. For PDF output, Pandoc processes these files with its Just make sure that the PDF bibliography is not managed by the TeX packages So it's only when making PDF output with |
Thanks! Currently, we use natbib for pdfs. I will need to try out alternatives you mentioned. |
This one is pretty good: https://github.com/citation-style-language/styles/blob/master/elsevier-harvard.csl |
In terms of auto update: you can set Zotero to auto sync and auto update .bib files so it updates automatically, that's what I do. |
This is definitely a good change so going to merge. However, it should automatically updated after changing the online Zotero file. I think I've discovered why this has not happened, for some reason, default: no for "Add URLs to BibTeX export": https://retorque.re/zotero-better-bibtex/installation/preferences/export/ |
Previously it was 'no'. |
Yes, in preparing this PR I had to export as 'Better BibLaTex' from my Zotero record for this reference. Only then the URL was included. |
To get more automation ('syncing') for CSL-JSON and avoid a Zotero->BibTeX->CSL route, you could try the following in the YAML header:
See https://retorque.re/zotero-better-bibtex/exporting/pull/ To collect just specific Zotero records, there's the JSON-RPC call (https://retorque.re/zotero-better-bibtex/exporting/json-rpc/) which the |
The URL can also be obtained interactively in Zotero: right-click menu on group library collection: result: However for me this only succeeded for collections in 'My Library' (demoed below).
|
That looks like really useful functionality, thanks for sharing! For now my plan is to go with the "if not broken don't fix" philosophy but confident that this functionality will come in handy in the future. Many thanks! |
It was a pleasure to provide some hints @Robinlovelace! Just be aware that for HTML citations & bibliography you currently do a sort of roundtrip Zotero CSL -> BibTeX -> CSL-JSON. While BBT and Pandoc (respectively) do the best possible thing here, some differences between HTML & PDF bibliography may occur as a consequence. Of course it's up to you decide whether that's a problem. More background in https://retorque.re/zotero-better-bibtex/exporting/pandoc/#use-csl-not-bibtex-with-pandoc. |
We will need to think about it (especially due to the fact we need to have both HTML and PDF version). That being said - I learned a lot of new things in this discussion. Thank you a lot @florisvdh! |
Heads-up @florisvdh it is in there again #661
Heads-up @florisvdh it is in there again #661 728ba8b
Update on this, the hyperlinks are in the references section: https://geocompr.robinlovelace.net/references.html |
I'm not sure whether this will actually result in the URL appearing in the bibliography; should depend on the applied citation style.
What follows are two sidenotes 😉 . Feel free to make them into issues, or whatever!
Is the citation style actually set for HTML? From the Pandoc manual, it seems that
biblio-style
(currently inindex.Rmd
YAML header) is for LaTeX only:For HTML, one could use the
csl
YAML key.Apart from that, CSL-JSON (
*.json
) or CSL-YAML (*.yaml
) formats are actually better suited for storing bibliographic data when using Pandoc itself (not natbib) for producing citations & bibliography. It then uses its own CSL processor, pandoc-citeproc, which AFAIK is always used in case of HTML, and will by default be used for all formats including PDF. CSL-JSON / CSL-YAML are the preferred formats to use with pandoc-citeproc (with CSL-JSON being the official format for CSL, CSL-YAML is a one-to-one Pandoc-only converted format which is more human-readable/editable than json). Some more background in inbo/tutorials#207 (comment).BibTeX (
*.bib
) is supported by pandoc-citeproc, but the processing is necessarily lossy because the BibTeX format is less standardized than CSL-JSON.One way to create json/yaml from another file format, is by using RStudio in VME mode. Or by using pandoc-citeproc on the command line (file conversion). Probably there are ways to do it from the R console as well, perhaps with
rbbt
orrmarkdown
(didn't check).