Zotero-better-bibtex: Extra field does not get exported any more

Created on 26 Aug 2020  路  22Comments  路  Source: retorquere/zotero-better-bibtex

Today I realised that BBT has stopped exporting the extra field from Zotero. Up until the update that changed this (not sure what version it is), the extra from Zotero was exported as notes in the .bib file. As an example, consider the Zotero entry below.

image

Its extra field gets exported as note in the .bib file as shown below:
In the past, its extra field would get exported as note in the .bib file as shown below:

@misc{hamman_technical_2000,
    title = {The Technical as Aesthetic: Technology, Art-making, Interpretation},
    url = {http://www.michaelhamman.com/resources/montpelier_2000.pdf},
    shorttitle = {The Technical as Aesthetic},
    author = {Hamman, Michael},
    urldate = {2019-02-04},
    date = {2000},
    note = {pdf},
    file = {Full Text:/home/gilberto/Zotero/storage/7TXU8P2T/Hamman - The Technical as Aesthetic Technology, Art-making.pdf:application/pdf}
}

I often use these to customise how my bibliography looks.

image

When I enable the option _Export Notes_ when exporting my collection through BBT, the bib file will contain the note field, but it will also contain all my personal notes from Zotero's Notes tab. These make the files huge, as I take extensive notes and quotes on every file.

I am running Zotero 5.0.89 and BBT 5.2.61.

So my question is: is there a way of exporting the extra field to my .bib file, preferably as note, without exporting all Notes taken in Zotero?

edit: clarifying that my example shows the old (and desired) behaviour, not the current one

enhancement

All 22 comments

Thanks for this -- I hadn't properly thought through the meaning of the note and annotation fields that I used for notes/extra.

It seems to me that the contents of the extra field would best end up in annotation, and notes in note, but that leaves me with one edge case -- BBT can stick the item URL in the note field for bibtex (not biblatex) exports, but then I don't know what to do with items that have an URL and notes which are exported to bibtex.

Thank you for the quick reply! Perhaps another idea would be to export the extra field from Zotero to an extra field in the .bib file, and let the user who wants to make use of this data define some custom ways of handling this non-default field. This has the downside of using a custom field, but it will solve the issue of bibtex export you mention and it would also make it very transparent to the user what goes where, that is Zotero notes go to notes, Zotero extra go to extra, etc.

On the other hand, some styles do use the note field, and you'd have no way to get data into that.

Concerning the edge case, would it make sense for BBT to give priority to the URL field when dealing with bibtex? I understand bibtex does not have a default url field and probably that's the most important thing for users when both an URL and Extra are defined in Zotero. (I myself use BibLaTeX so this is just an idea from the top of my head)

:robot: this is your friendly neighborhood build bot announcing test build 5.2.61.7048 ("adjust tests")

Install in Zotero by downloading test build 5.2.61.7048, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

I tested the build 5.2.61.7048 with BibLaTeX and the extra field is still not exported. When I enable the option Export Notes in BBT, my zotero notes are exported to the field note and the extra field goes to annotation. With the option disabled, the extra field is ignored.

That's correct, but I'm going to make one more change: if the target is bibtex, not biblatex, and you have to url-to-note field on, I think it makes sense that you'd only expect urls to end up there, not url-and-maybe-extra. So under that circumstance, I'll only export the url to the note field (if present).

WRT is note vs annotation field, I could just always put the extra in the annotation field, and if you don't want it, you can add it to the skip fields.

I think the behaviour you propose for bibtex sounds very logical.

And just to clarify it, your test build did not change the behaviour of the biblatex export, right?

I'm happy to test the next test build.

:robot: this is your friendly neighborhood build bot announcing test build 5.2.61.7049 ("special handling for note field in bibtex")

Install in Zotero by downloading test build 5.2.61.7049, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

@retorquere Apologies if I am misunderstanding something, but I am still facing the original issue I reported when using the biblatex export in version 5.2.61.7049. The extra field from Zotero is not being exported to the .bib file.

Even when you enable "export notes"?

Even when you enable "export notes"?

With that open toggled on, the extra field is indeed exported to annotation. The issue is that all my personal notes end up in the bib file too, and the file is now 10 times larger than before. Is there a reason for not exporting the extra field from Zotero to annotation in biblatex by default?

I've scheduled a new release (5.2.63) that will export annotation by default.

Thank you so much, I really appreciate the fix!

Just tested 5.2.63 and it all works like a charm, thank you once again!

Is there any way to get the old behavior back? I had a workflow that relied on automatic export of the Zotero notes and no inclusion whatsoever of the "Extra" field. Now I have a bunch of stuff from the extra field that I don't want showing up in my document and I can't figure out how to get the Zotero notes to export with the references.

Putting annotation in skipfields should do it

Thanks! Is it possible for me to export Zotero notes to annotation like before, or am I going to have to rewrite some LaTeX macros to use the note field instead of annotation?

You can do this with a postscript:

if (Translator.BetterTeX) {
  if (reference.has.note) {
    if (reference.has.annotation) delete reference.has.annotation
    reference.has.note.name = 'annotation'
  }
}

It is a bit hacky to change the name, but to cleanly change it would take more code, and this will in fact work.

Hi @retorquere,

I am using Zotero 5.0.92-beta.4+679a1acb9. I use BBT along with BibTex to export to LaTeX. I ran into the same issue as stated above. I used to use the 'extra' field to enter extra information I wanted to be displayed in my bibliography. Now if I put information into the 'extra' field it does not get displayed at all, since it is no longer exported as 'note' but rather as 'annotation'. I am at the end of my thesis and would like to be able to add extra information again. How can I accomplish this? I should mention that I use a code snippet you once wrote for me in case this messes with anything.

if (Translator.BetterBibTeX && item.itemType === 'webpage') {
  if (item.accessDate) {
    reference.add({ name: 'note', value: "Zuletzt gepr眉ft " + item.accessDate.replace(/^(\d+)-(\d+)-(\d+).*/, '$3.$2.$1') + " " });
  } 
  if (item.url) { 
    reference.add({ name: 'howpublished', bibtex: "{\\url{" + reference.enc_verbatim({value: item.url}) + "}}" });
  } 
}

Hi @retorquere,

I am using Zotero 5.0.92-beta.4+679a1acb9.

5.0.92 is out. Or is this a beta for 5.0.93?

I use BBT along with BibTex to export to LaTeX. I ran into the same issue as stated above. I used to use the 'extra' field to enter extra information I wanted to be displayed in my bibliography. Now if I put information into the 'extra' field it does not get displayed at all, since it is no longer exported as 'note' but rather as 'annotation'. I am at the end of my thesis and would like to be able to add extra information again. How can I accomplish this? I should mention that I use a code snippet you once wrote for me in case this messes with anything.

I'm sorry that you bumped into this at such a stressful time. Try this:

if (Translator.BetterBibTeX) {
  if (item.itemType === 'webpage') {
    if (item.accessDate) {
      reference.add({ name: 'note', value: "Zuletzt gepr眉ft " + item.accessDate.replace(/^(\d+)-(\d+)-(\d+).*/, '$3.$2.$1') + " " });
    }
    if (item.url) {
      reference.add({ name: 'howpublished', bibtex: "{\\url{" + reference.enc_verbatim({value: item.url}) + "}}" });
    }
  } else if (reference.has.annotation) {
    if (reference.has.note) delete reference.has.note
    reference.has.annotation.name = 'note'
  }
}

It is what it says in Zotero's 'about' section.

image

Thank you! This seems to work. I'll continue using that and see how it works.

Was this page helpful?
0 / 5 - 0 ratings