bibtex export suggestion: space in page range

Hi,
Currently bibtex.js replaces any number of dashes in a page range by '--'.
I would like to suggest to also remove any white space between the page numbers and the dashes by changing line 1485 from
writeField("pages", item.pages.replace(/[-\u2012-\u2015\u2053]+/g,"--"));
to
writeField("pages", item.pages.replace(/\s*[-\u2012-\u2015\u2053]+\s*/g,"--"));

Best regards,
Paul
  • I'm not necessarily opposed, but how does that whitespace get there in the first place?
    One export translator doesn't seem like the right place to fix this as it would also be incorrect for citations and other export formats.
  • Hi,
    The answer to your question is probably: sloppy manual entry. To me it feels natural to enter the range with spaces.
    I don't understand what you mean by " incorrect for citations and other export formats."
    I think most citation styles want this range without the spaces. Or is it possible to implement the removal of superfluous space in a bibtex style?

    Paul
  • Remember that while you seem to be using it that way (and that's obviously fine) Zotero isn't only, or even principally, a bibtex manager. When I say "citation styles" I mean Zotero's built-in citation functionality; same for export. If you have spaces in your page ranges, citations generated by Zotero would be incorrect as would export to other formats and/or reference managers such as MODS, RIS, etc.

    I don't think we'd be super inclined to fix things in one single export format that should really be fixed in the data in Zotero (and would then be fixed across the board). FWIW, it probably wouldn't be terribly hard to do via the built-in javascript API https://www.zotero.org/support/dev/client_coding/javascript_api or the web api.
  • I conclude from what you say that there should be no spaces in the zotero pages field, regardless of how and where it is exported to?
    Is it then possible to filter the field when editing is finished?

    Paul
  • We could do that pretty easily, if that's universally desirable. We'd probably also want to filter values coming out of there at export time to handle existing values.

    We could also normalize hyphens/dashes to be a single en dash, which is the typographically correct approach in U.S. English, but I don't know if that's universally true.
  • We could also normalize hyphens/dashes to be a single en dash, which is the typographically correct approach in U.S. English, but I don't know if that's universally true.
    No, it's not, unfortunately. We had to allow localizing page-range-delimiter in CSL because some languages use hyphens (French, as one might expect ;), as do some US citation styles (for some reason AMA insists, don't know why).
Sign In or Register to comment.