BibLaTeX export translator

2»
  • I've moved development to GitHub, implemented some new features, and written better documentation.
    See https://github.com/andersjohansson/zotero-biblatex-translator.
  • Cool. From what I understand, Aurimas is working on a BibLaTeX export translator to be included in Zotero natively, but that'll likely take some more time. Also, it won't cover some of the special features (arguably hacks ;-)) that you've built into your version so having this available will likely still be of interest to people. Just wanted to give a heads up.
  • edited May 15, 2013
    @anjo7539, I used the biblatex translator but I found that the date field is inconsistent after translation, whereas that of BibTex Tan -revised by Robin was consistent. Can you please fix that field and don't you think changing its name to year =, or may be add this field as year only would be more useful in LaTeX and biblatex? Here is an example for the same reference in Zotero after exporting using the two translators:
    Biblatex translator gives:
    @article{arend_il-1_2008,
    title = {{IL-1}, {IL-18}, and {IL-33} families of cytokines},
    volume = {223},
    issn = {1600-{065X}},
    url = {http://www.ncbi.nlm.nih.gov/pubmed/18613828},
    doi = {10.1111/j.1600-065X.2008.00624.x},
    pages = {20-38},
    journaltitle = {Immunological Reviews},
    shortjournal = {Immunol Rev},
    author = {Arend, William P and Palmer, Gaby and Gabay, Cem},
    urldate = {2011-09-05},
    date = {Jun 2008},
    note = {{PMID:} 18613828},
    keywords = {...truncated...18, and IL-33 families of cytokines.pdf:application/pdf}
    }

    BibTeX Tan -revised (from Robin)gives:
    @article{arend2008,
    title = {{IL-1}, {IL-18}, and {IL-33} families of cytokines},
    volume = {223},
    issn = {{1600-065X}},
    url = {http://www.ncbi.nlm.nih.gov/pubmed/18613828},
    doi = {10.1111/j.1600-065X.2008.00624.x},
    abstract = {{SUMMARY:} The interleukin-1 ...truncated...stimulates T-helper 2 responses as well as mast cells.},
    journal = {Immunological Reviews},
    author = {Arend, William P and Palmer, Gaby and Gabay, Cem},
    month = jun,
    year = {2008},
    note = {{PMID:} 18613828},
    keywords = {Alternative Splicing, Animals, Carrier Proteins, cytokines, expression source, Humans, {IL-18}, {IL-1b}, {IL-33}, Immune System Diseases, Immunotherapy, Interleukin-1, Interleukin-18, Interleukins, Mice, Mutation, Receptors, Interleukin-1, Signal Transduction, Th2 Cells},
    pages = {20--38}
    },

    Note: Biblatex cannot parse these: {Feb 2000}, {Sep1, 2006}, etc... please see this post for date format accepted by biber for biblatex http://tex.stackexchange.com/questions/46868/biblatex-sorting-by-date/46879#46879


    Please in the meantime can you refer to a biblatex style that you use for a PhD thesis after being exported by your translator, that would be much appreciated, or may be describe the workflow of getting the job done using Zotero, Biblatex in LaTeX.

    Many thanks in advance
  • Hi,
    I copied the BibLaTeX.j in my Translators folder. But it wont show as an option to export my bibliography. May you help me?
  • edited June 13, 2013
    @Blaight,BibLaTeX translator in its current state is very buggy, especially the date field, I don't recommend using it, instead you can use the bibtex translators (which are fortunately readable by Biblatex), but if you really want to do this using the very nice biblatex package in LaTeX you may want to have a look at the complete workflow to get the job done, which I posted here: http://tex.stackexchange.com/questions/18848/workflow-for-managing-references/114973#114973.
  • Thank you very much. I will try that tomorrow. I am completely new to LaTeX and it kinda bugs me that there is no native implementation, because Zotero is on of the best tools I ever worked with. For some other reason I think Biblatex or biber seems incorrectly installed but I will tend to that tomorrow!
  • @ffsammak:
    You have a very good point. The problem results from me trying to simplify things and assuming the date-field in Zotero would be stored in iso standard format (yyyy-mm-dd) so that it could just be written to the biblatex file which assumes this format [1][2].

    That's a pretty bad assumption of course, many translators get dates from online databases in a variety of formats (dd/mm/yyyy, "june 4, 2011", etc.) and Zotero is pretty good at parsing these.

    What I should actually do then is using Zotero's built in functions to translate the date into an iso-date that biblatex will accept. I'll look into this.

    Sorry for responding late, for some reason I didn't get a notification although I'm subscribed to this thread. You are all also very welcome to submit problems like these as issues on github where they can be properly tracked: https://github.com/andersjohansson/zotero-biblatex-translator/issues

    [1] Or date ranges in format yyyy-mm-dd/yyyy-mm-dd (see biblatex documentation section 2.2.1), but since Zotero does not support date ranges yet this is of no concern.
    [2] Biblatex does also support the old bibtex convention of using fields "year" and "month" (with month abbreviations as keys) but recommends against using that and for instead using "date" + "issue" (for journal issues). Just use the issue-field in Zotero to get this right.
  • Fixed the output of the date fields. New version: https://raw.github.com/andersjohansson/zotero-biblatex-translator/master/BibLaTeX.js

    @ffsammak, if there are other things that are "very buggy", please notify me!
    I've successfully used the translator since I created it and this makes biblatex behave better than with the standard bibtex files (but perhaps this becomes less of a problem with time as more modern practices seem to be implemented in the bibtex translator now: https://forums.zotero.org/discussion/24554/bibtex-doubled-url/#Comment_157802)
  • @anjo7539, thanks a lot for the fix, I didn't try it though, of course I will, there are other buggy issues, which are not necessarily specific to biblatex translator but for other translators as well, but you might want to fix it, that will be very appreciated if you could:

    1. Translation of the manually introduced HTML-tags in the title of Zotero references, e.g., italicized word , things are getting really buggy especially if more than one is introduced.

    2. I am aware of the difficulty to translate what is equivalent to \emph{} in LaTeX, i.e., in context emphasis, is that possible now?

    3. Other issue is the citation key itself, one problem is that if it happens that an HTML-tagged word were in the beginning of the title then the tagging will show up in the citation key, which I don't think is an elegant way. One workaround of course would be to consider using a different citatoin key strategy, or just avoid such tags if present, you can judge this issue better than me.

    4. It would be VERY USEFUL indeed, if you could enable a clipboard copy of the citation key ONLY of the selected reference(s), and assigning a dedicated keyboard shortcut to serve this purpose, a classical one like CTRL+ALT+B would be very nice I think

    similar things I posted here:
    http://tex.stackexchange.com/questions/114297/tweaking-of-biblatex-style-to-show-emphasized-species-name/115173#115173
  • Thanks for providing this biblatex translator. I am using it with biblatex/biblatex-apa.

    My question: Is there a way to prevent URLs and DOIs from showing up for @article and @inproceedings in biblatex? Or do I have to manually delete the URL entries in Zotero?

    I also found that when one uses capitalized words in Zotero ("A Survey About Humans"), everything except gets transformed to lowercase by biblatex ("A survey about humans"). Is this normal/expected behavior? Is this even desirable? (I am not an English native speaker)

    Thanks!
  • I also found that when one uses capitalized words in Zotero ("A Survey About Humans"), everything except gets transformed to lowercase by biblatex ("A survey about humans"). Is this normal/expected behavior? Is this even desirable? (I am not an English native speaker)
    yes, basically that is desired. APA requires titles to be in "sentence case," i.e. as if they were written as a sentence, which means everything except proper nouns should be lowercased.
  • edited July 23, 2013
    @tgrossen, in general you can tweak biblatex package settings in LaTeX to hide whatever field you want from the biblatex Zotero exported database (please refer to tex.sx community for many examples), while keeping your Zotero database undeleted.
  • (I'll check with Aurimas again, but I'm inclined to add the BibLaTeX translator to Zotero at this point. I don't see a reason not to - we can always replace it again if he finishes his work on a comprehensive version).
  • oh and second ffsammak's advice - don't mess with data in Zotero, this should be handled on the style (i.e. in this case the biblatex) side of things.
  • edited July 23, 2013
    @adamsmith, can you please mention the link to that biblatex translator of Aurimas? is there any solution in the latest version to the four issues already mentioned in a previous comment above? that would be very much appreciated.
  • he doesn't have a published version - I'm talking about the version by anjo above. Aurimas has been working on making the bibtex translator versatile enough to allow both a BibLaTex and a BibTeX output (which saves a _lot_ of dublicate code). In general, issues 1 and 3 should be solvable. 2 likely won't be as Zotero doesn't have separate emph and italic markup. 4 will be hard to solve with a specific translator, but should be easy enough as a separate citekey translator (which already exists for bibtex, also only as an unofficial version).
  • My question: Is there a way to prevent URLs and DOIs from showing up for @article and @inproceedings in biblatex? Or do I have to manually delete the URL entries in Zotero?

    I also found that when one uses capitalized words in Zotero ("A Survey About Humans"), everything except gets transformed to lowercase by biblatex ("A survey about humans"). Is this normal/expected behavior? Is this even desirable?
    To prevent all URLs and DOIs from being shown, try

    \usepackage[url=false,doi=false]{biblatex}

    The url field of @online entries is always printed, however.

    More fine-grained control can be achieved, too; see the biblatex manual, "4.5.2 Dynamic Modification of Data".

    As to capitalization, biblatex (and bibtex) expect titles in the biblatex data to be in title case, converting these to sentence case if necessary while the latex document is formatted. Words that should remain capitalized must be protected by enclosing them in curly braces.

    Haven't checked, but a good zotero -> biblatex translator will have to convert titles from sentence case to title case. Ideally, some way of dealing with words that have to remain capitalized will have to be found, too.
  • Thanks a lot for the hint with

    \usepackage[url=false,doi=false]{biblatex}

    That should do it so far.
  • I tried to export data with the biblatex translator but I always get an error message: "Ein Fehler ist aufgetreten bei dem Versuch, die ausgewählte Datei zu exportieren" (An error happened when you tried to export the selected file, my translation).

    I used different files, but got always this error message. Nothing at all is exported. Did I something wrong or is the translator buggy?

    Using FF 23.0 und Zotero 4.0.11 on Mac OSX 10.8.4.
  • Is this the case for any individual item you export, or just for a large batch? In case it's the latter, try to reduce this to a minimal example so we can take a look.
  • When I tried it the first time, I tried to export just one item. I tried it again with a different item, just to be sure, there was no offending code in the test item.

    Maybe there is something wrong with my installation? There is no biblatex translator installed in my standalone version.
  • Try exporting in regular BibTex. If that works, this is likely not a problem with your install. I'll have a look, though likely not super soon.
  • BibTex and other export formats are no problem.
  • @petzi,
    If you could have a look at the error console (shift+ctrl+j) in firefox after the problem happens it usually indicates what line of javascript in the translator caused the error. If you could post this information it would help debugging.
    It works for me so it is not so easy to spot.
  • Thanks for the suggestion to look deeper into the issue: The problem was on my side: I had (additionally) still an old BibTex-Translator installed which caused the error messages. Thanks for your help!
  • I've just added the BibLaTeX translator as a regular Zotero export translator.
    I removed all Special Features/Hacks - while I very much see their use and value, we can't put hacks into official translators for a number of reasons, most importantly that we can't promise to support them in the future. Because I understand why people may want to keep the hacks, I used a different translator ID for the official BibLaTeX translator, so it won't overwrite anjo's version. If you do want to keep using anjo's version, I recommend you give it a slightly different label
    (i.e. modify line 4 https://github.com/andersjohansson/zotero-biblatex-translator/blob/master/BibLaTeX.js#L4 ) so you can distinguish the two.

    If there are problems with LaTeX mappings etc. we're happy to fix them, though obviously we'd be even happier if anjo is willing to submit pull requests for fixes.
  • That's great!

    I changed the translator name and file name of my version to "BibLaTeX-with-hacks" so people won't confuse things.
  • Hi,

    i really want to thank you for this hacked translator, because the "origdate" field is very important for me. I’m really looking forward to zotero 4.2, where it shall be implemented. btw: Does anyone have a rough date for the release of that version?

    Now to my question: In the .js-file it says that for the bibkeys charakters like "ä", "ü" or "ö" are replaced with "ae", "ue" or "oe". But actually this doesn’t seem to work. E.g. i have an entry where the author is "Krüger" and the bibkey is "kruger…". That would not be a problem; but since i tend to use the "BibTeX (\cite)"-exporter for quick copy, it is a problem, because this one replaces the charakters with "ae" etc. So the bibkyes won’t match. Is there an easy solution for this problem?
  • Hi, mobam.
    Yeah, I really needed origdate too, that was why I added that feature. (BTW, which biblatex style do you use for this? It is not implemented in the standard style? I hacked my own style some years ago to make that work).

    As regards your problem: I think the reason why the conversions are not those you see in the code is because you use "Zotero 3.0 or higher" which uses Zotero.Utilities.removeDiacritics() (which actually replaces ü with u) instead of the list in the code.

    I guess that the BibTeX (\cite) exporter you talk about doesn't use the same mechanism for generating citekeys.

    So the problem really lies in the cite-exporter, which doesn't seem to use the removeDiacritics function that my, the official BibLaTeX and the official BibTeX translator uses. It should be updated to reflect these changes.
Sign In or Register to comment.