-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
Exporting a page-range 'x-y' (single hyphen) from Zotero results in 'x--y' in bib-file. #1602
Comments
I'm conflicted on what to do with this one. One soft-goal of BBT is to generate bib(la)tex that renders to the same (or as close as possible) bibliography you would get when Zotero renders the bibliography itself; BBT aims to translate the "intent" in terms of how Zotero would understand the item (I hope that sentence is parsable). When you create a bibliography with Zotero itself for the item in But I do realize this leaves you without an avenue to generate hyphen-separated numbers. What problem are you experiencing with the current behavior? Maybe another fix can be made. |
Thanks for the explanation @retorquere , sorry to keep you waiting. Your answer is clear and helpful. And indeed, it seems like a logical choice. I didn't know about these things and had 'just' assumed something had gone wrong when I noted the difference. Thanks also for the provided links! I also found this reference for CSL: https://docs.citationstyles.org/en/1.0.1/specification.html#range-delimiters I provide some background which may be of some interest and for later reference. We have been testing our corporate csl + bst on 1) a bib file in connection to the rmarkdown R package (hence pandoc, using either csl with pandoc or bst with latex (natbib)) and 2) Zotero (csl). This test bib file has some history, involving records probably exported by Mendeley (anyway, double hyphens do occur, see e.g. here) and others by JabRef, which apparently doesn't change hyphens to double ones (e.g. here) after entering a record. [The fact that JabRef doesn't change it probably makes sense as JabRef is a direct frontend to the bib file.] More recently, some BBT-like fixes have been made by hand in the bib file, for JabRef-generated records. Summarising, when this bib file is imported in Zotero (with BBT) and then re-exported:
While this seemed a little weird to me, the implications are indeed consistent. The Zotero-generated bibliography (in the Style Editor) after importing the two above referenced records, i.e. one time
I.e., two times a n-dash, consistent indeed. 👍 Also R markdown generated bibliography from the bib (with mix of
Pinging my colleague @ThierryO who will be interested as well. So the way BBT approaches this at export seems excellent - it would further straighten the bib file after importing to and re-exporting from Zotero. BTW we also want to make more use of the citr package in R, which makes use of Zotero & BBT, in order to use Zotero with rmarkdown. Summarizing, I don't see a need for an avenue to generate hyphen-separated numbers from Zotero. |
The reason I retain the single dash on import is that I can always make changes correcting the export, but damage done during import I cannot correct. The import is more conservative than the export. Also, a vanishingly small minority of the items that come into zotero come through my import, so a lot of items have hyphen-separated ranges anyhow. |
@retorquere We've been discussing the hyphenated numbers problem over on the CSL repos, and we will probably recommend some markup syntax to indicate to not parse numbers, so I would suggest keeping your current behavior for now. |
@florisvdh I take it you are satisfied with the current behavior? @bwiernik if there's news feel free to hail me here or on the forums. |
Sure @retorquere 👍 , and thanks for helping out. |
@florisvdh I would suggest though that you use CSL YAML as a data format if you are working with RMarkdown/pandoc, rather than .bib. BibLaTeX and CSL data are not fully compatible and using .bib with pandoc will often generate incorrect output for non-journal, non-book items (e.g., reports, software). Internally, pandoc converts everything to CSL data. |
That is correct. |
@bwiernik IFAIK we still need .bib data for the RMarkdown > pandoc > latex + natbib output. I like having a single source for different output formats. |
I mean technically you still would have a single source, it would just be zotero. The translation zotero - bib - csl that all pandoc paths go through except for latex + natbib has 2 unnecessary (and not necessarily lossless/reversible) steps in it. |
@retorquere I'm not sure, but I think that when natbib is used, pandoc passes the bib file unchanged. |
@ThierryO That makes sense, but be advised that if you don't use natbib (e.g., if you use pandoc's built-in citation formatting with latex), using a CSL data format will be better. |
That's what I had meant to say. The pandoc path for latex + natbib is the one instance where I would say you're better off using the biblatex export. In all other cases you'll get better results using CSL exported from Zotero. |
@bwiernik thanks for pointing at the CSL YAML alternative, I wasn't aware of that. BTW for pandoc, is there some preference over CSL JSON? I see at citr there are some issues on the topic. In our environment, different reference managers are used by different scientists (Endnote, Zotero, Mendeley). Converging on / enforcing one system or one common group library is not really an option. For maximizing cooperation in R Markdown projects on GitHub, we need to settle on a common textfile where every collaborator can add references to. If that could be CSL YAML/JSON (for pandoc with pandoc-citeproc), in se that seems OK - unless there are usecases where we actually need Currently I see added benefit for our situation in using a bib file, because of the citr RStudio addin. Allowing to add references in a shared bib file from a local Zotero database (using BBT) is interesting in our usecase. Hence not all references in the file need to be present in the Zotero database (meaning, someone is allowed to add records from elsewhere). Of course some errors can't be excluded when the bib file is changed in this way, and that has to been taken care of manually. But maybe if citr supports CSL YAML or CSL JSON in the future, we need to reconsider. On the other hand, I saw this comment, which still considers the bib format as the currently most widely supported one. |
CSL JSON and CSL YAML are compatible. CSL YAML can accept full Markdown formatting and is more human readable/editable. JSON is currently more supported outside of pandoc. |
I would recommend using the rbbt package over citr. It works much better with Zotero, especially if your library is large (citr can't even load my Zotero library), and it doesn't require the lossy Zotero-bib-CSL conversion. You could also just start using RStudio's first-party built in Zotero integration that's currently available in the Daily build. That can output to CSL YAML or JSON, as well as to bib (that's currently not the greatest). |
There are minimal differences in date formatting between CSL JSON and CSL YAML that can be converted to each other without loss. It's mostly an aesthetic preference which one you prefer.
Whether that's true depends on what you mean by "supported". CSL is a standardized format that's easy to produce and consume without ambiguity. Bib(la)tex on the other hand has a million subtle rules about how it should be produced/consumed. No two consumers will interpret a given bibtex exactly the same. So if "supported" includes "will be interpreted roughly the same, for relatively simple cases", then yes, they are supported. If it means "whatever stack I put this through, I'm going to end up with the same rendered bibliography", then absolutely not. CSL gets you that. And the Zotero data model is (probably by design) much closer to CSL than to bib(la)tex, so the conversion from Zotero to CSL requires way less changes to the input data to produce CSL, and it's unambiguous from that point on. Many years into BBT development I still find problems to fix in producing/consuming bib(la)tex. I can vouch for the quality of the interpretation of BBT (which isn't perfect, because it cannot be given how much more bibtex allows in virtue of having all of TeX at its disposal than CSL), and I'm ready to trust pandoc being on par because it'd be pretty foolish to underestimate jgm (although there used to be edge cases where BBT was better, but I haven't kept track), but in my experience, outside the limited group of pandoc, BBT and of course the actual LaTeX stacks, everything else that consumes or produces bib(la)tex ranges from passable to garbage. |
Thanks for sharing your experience and view on this @retorquere . I agree that the broad support for bib is only true in a loose sense. My earlier described case indeed demonstrates that different syntaxis will occur inside the same bib file, if different origins have been at work. |
@bwiernik Thanks for sharing, I didn't know the
|
For the first point: this is not currently possible, but it'd be easy to build it. You can also build it with bibtex, but amending yaml or json is absolutely trivial in comparison. |
@florisvdh Check out the RStudio daily build with the new Markdown editor and citation integration. It does that without needing any additional packages. |
@bwiernik sorry for the delay, I needed to find some time to better look into this. Thanks a lot for the hint! It appears that a nice documentation website is in the making for many new features in RStudio 1.4 (Visual Markdown). It's here: https://rstudio.github.io/visual-markdown-editing (the info on citations & Zotero is under 'technical writing'). And YES, it has it all! 👍 This will indeed fullfil the explained needs. Some extracts:
I didn't try it yet, but it seems rather convincing already, and some issues have in the meantime been solved in the RStudio github repo. They also provide integration with BBT when using Zotero (e.g. https://github.com/rstudio/rstudio/blob/master/src/cpp/session/modules/zotero/ZoteroBetterBibTeX.cpp). |
I have installed the RStudio daily build and had a quick look. It's important to add that the 'insert citation' feature (currently?) is only available in the visual editor mode (which is comparable to a word processor interface), not in the plain Rmd mode. I feel this may be a limitation on its own, compared to |
I'll give the new RStudio a shot, but maybe this doesn't really connect to the reported issue anymore. |
@retorquere It surely doesn't connect to this issue anymore, you're right. (I don't know where else we should do the ongoing discussion). On the other hand maybe it's worth to keep this broader discussion in one place until some well-defined need emerges that can then be re-initiated in the right place (e.g., rbbt, rstudio). |
It's fine to have the discussion here, I just needed to know whether something was expected of me for this. |
FYI. I filed some issues at https://github.com/rstudio/rstudio/issues |
Some preliminary conclusions after further tests with RStudio visual markdown editing (VME), @retorquere, @bwiernik can you please have a look at this? Further comments/corrections are most welcome!! 0 means no, 1 means yes.
(*) due to not being able to use another Zotero profile (to which I switched) from RStudio VME (even after restart, reinstall etc); will file an issue. Below are some possible (suggested) development paths (discussed with my colleagues @ThierryO and @hansvancalster) which could provide a solution for the aforementioned usecase (#1602 (comment)). I.e., collaborative researchers contributing to the same bibliographic file in a common git repo, each using its own (manual / (semi-)automated) tools to do that, and each adding citations inside Rmd files from RStudio. We are really interested in getting to a solution for one of the following.
We intend to add an issue on these topics at the respective repositories, referring to this table here. I will first await further considerations and ideas from you, which may lead to edits of the above table and suggestions. |
Important to remember that If someone wanted to cite from a bib or YAML file with rbbt, the intended workflow would be to import those files to their Zotero library. |
I wouldn't expect much more development on citr. Frederick Aust happily described the RStudio development as "effectively making citr obsolete". |
I can't really speak on what rbbt can do; I've collaborated to make it possible by extending the BBT backend, but I've not used it myself. |
Thank you for the advice. We'll have a further look into RStudio first. BTW just found this nice tutorial on Zotero + BBT + Rmarkdown + |
Be sure to try out the |
@bwiernik I did try |
Oh, right. The name of the function changed from my initial propsal. |
BTW there's still another option when going the bibtex/csl-json route: it is possible to set up an auto-export through the BBT HTTP API. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm using Zotero 5.0.89 and Better BibTeX 5.2.47.
Report ID: XSEF3MV8-euc
Exporter used: Better BibTeX
Exported item:
Screenshot
Copy from the Pages field:
3-10
Expected output:
Actual output:
Note the double dash. This seems to be the problem that was mentioned here.
When importing this result in Zotero, a long dash is shown in Zotero, see below screenshot. Copy from the Pages field:
3–10
. So the double dash seems to cause unwanted changes.Screenshot
The text was updated successfully, but these errors were encountered: