Is it possible to obtain bibtex entries directly from an external database?

I use Zotero to organize papers. And I write my own papers in latex, so I need to generate bibtex entries to cite papers. In my field (particle physics) the INSPIREhep database has the most complete and up-to-date information about all publications. And most importantly it produces almost never broken bibtex entries.

So what I would like is:
1. Import papers to Zotero from Inspire, and use their citation key.
2. Being able to select papers in Zotero and generate bibtext entries for them exactly as Inspire would generate them.

(1) is already achieved by Zotero Inspire plugin. I have an issue with (2) however, because Zotero does not store bibtex entries, instead it attempts to generate them on its own. And here unfortunately I frequently get unsatisfactory results, even though the data originally came from Inspire.

My idea of solving this would be to have some custom action which upon request generates a bibtex entry by directly querying Inspire (it has an API), instead of trying to generate it in-house.

Is this something which can be achieved with plugins perhaps?
I do not mind to write some code myself, but I am not sure yet how to approach this. Does anyone have suggestions?
  • Are you already using the BBT add-on in Zotero? That should get you quite good bibtex.

    If you do want to get the exact INSPIRE Bibtex, yes, that's certainly possible -- there are various add-ons that query external APIs in all sorts of ways -- but I'm not seeing any direct identifier from INSPIRE saved to Zotero, so the query to send to the API would need to be somewhat carefully constructed, taking into account both the type of data you're likely to find in Zotero and the queries the API accepts.
  • Using BBT will remove the "almost", but truth of the matter is that bib(la)tex can do things that zotero can't (like math in titles) and pushing things through zotero does incur data loss in such cases. I can't reproduce what zotero can't store.

    The closest you can get with current BBT/zotero is to set BBT to raw mode, but the resulting entries in Zotero won't be any use for anything outside bib(la)tex, word/LO will usually not produce anything remotely usable, and even then I can't guarantee this to always be lossless.
  • Sorry, I should have mentioned that I already use BBT. And indeed it kind of works ok-ish, but then sometimes it doesn't. So I anyway have to carefully check the export, which then defeats the purpose of automation.


    > there are various add-ons that query external APIs in all sorts of ways

    Would you perhaps have some example in mind? I could then probably take a look and that and maybe write something similar.


    > but I'm not seeing any direct identifier from INSPIRE saved to Zotero

    Actually Zotero inspire plugin pulls the cite keys from inspire already, so this is definitely not an issue.


    > but truth of the matter is that bib(la)tex can do things that zotero can't (like math in titles) and pushing things through zotero does incur data loss in such cases

    Exactly this, and this is why I'd like to use Zotero to organize things, but still automatically generate bib externally.


  • You can try raw imports and see if that gets you what you want, but managing bibtex (with perfect fidelity) is just not what Zotero is fundamentally about, and you may end up fighting Zotero because you want it to be JabRef.
Sign In or Register to comment.