Porting Word citations to latex with \cite{}

  • There is no way to access BBT citekeys via Zotero's server API that I know of (though this is the part that I may be wrong about)
    You can sometimes sorta get them -- if they are "pinned", that is, they're in the extra field as

    Citation Key: thePinnedKey

    then the stock bib(la)tex exporter will pick that up as the citekey, and if I'm not mistaken, the Zotero server API uses the stock exporters.

    These are not technically BBTs keys, but BBT will generate that line in the extra field if you request the citekey to be pinned, and will use that citekey instead of generating one itself.
  • Going to BibTeX will work okay with journal articles and most books/chapters, but most other item types will have some pretty serious loss of information in the CSL—BibTeX—CSL loop, so if your plan is to work with pandoc, I recommend sticking with CSL-JSON data.
  • Plus you forego the problems of sentence-case vs title-case.
  • In case not using LaTeX is not an option here, could Zotero Better BibTeX (BBT), or some spin-off, be used to convert a CSL JSON file to a Bib(La)TeX file, possibly via the command line?

    As far as I know, BBT and pandoc-citeproc are the only biblio database conversion tools that actually offer title case conversion between Bib(La)TeX to CSL JSON (and pandoc-citeproc only from Bib(La)TeX to CSL JSON, so not helpful in the present context).

    I have not tested citation-js so far either (actually, could not; it errors out with “TypeError: Cannot read property 'toLowerCase' of undefined”; haven’t found time to investigate), but from what I’ve read in its documentation, I very much doubt it attempts to do title case conversion. Besides, it does not seem to include any support for BibLaTeX - which I consider a serious drawback.
  • It depends on what you mean by "from the command line". BBT can be driven using HTTP; my python test setup uses this to run the test suite, but it requires Zotero to be running, and that's not what people usually mean by command line.

    Since 5.2 it should actually be somewhat feasible to run BBT outside Zotero; translators/workers/zotero.ts shows what should be shimmed. But it'd not be trivial. It's not a route I would recommend unless you're primarily curious whether it can be done. It's very likely saner to try to get pandoc csl to bibtex conversion done.
  • I meant “command line” in a very broad sense (like, for example, the pandoc-zotxt filter, which requires a running instance of Zotero, too).

    And you’re right, I’m primarily curious whether it can be done at all.

    For merely testing whether bib(la)tex files generated by ref-extractor → CSL JSON → BBT → bib(la)tex work better than bibtex from ref-extractor → citation-js → bibtex, the OP wouldn’t need a command line prog; they’d just have to import the former into Zotero, and reexport using BBT. Only if they wanted to do the former on a regular basis, a CLI might be an improvement worth thinking about.
  • Oh yeah, for one-offs you could just use Zotero manually.

    If it's not too high-volume, you can automate the import-export using the stuff I use for my test suite (https://github.com/retorquere/zotero-better-bibtex/tree/master/test/fixtures/debug-bridge). If you put the import CSL-JSON into a unique filename (let's say you rename it to {GUID}.json, you can import it, recognize the imported collection, re-export it and delete the collection from a script to drive the debug-bridge (I happen to use python).

    This is much easier than running BBT outside Zotero.
Sign In or Register to comment.