reddit / emacs

Convert entry from bibtex to biblatex with elisp?

SterlingHooten · 2022-11-27 20:37
Is there a built in function or package to convert from standard bibtex form to biblatex form? When pulling in citations from sites like Google scholar there’s no option for biblatex, and I can’t just mix styles together. Certain fields (like date vs year/month) need to be combined and transformed, and some TeX syntax is removed, so it’s slightly nontrivial. I can make a call to Biber as an external process to do the conversion but it’s slow (around 2 seconds). I’m avoiding using Zotero or Jabref etc as I’m nearly finished implementing a system that totally replaces them. Thanks!
attento_redaz · 2022-11-27 22:38
Unfortunately, I'm not aware of such a function or package, but, as far as I know, biblatex/biber supports legacy BibTeX entries and fields, so, at least in theory, you should be able to use them without conversion.
sylvain_soliman · 2022-11-28 11:39
Indeed, since I happen to use a shared big bibTeX file with some colleagues, I very often use biblatex on those _legacy_ entries, and never had an issue with that… Worst case scenario was handled using biblatex entry rewriting in my TeX file.
[deleted] · 2022-12-30 20:38
[deleted]
SterlingHooten · 2022-12-30 20:39
Thanks, I was able to do this by using a temporary file in zsh with =(echo 'bibtex entry here') to pass it to the stdin of biber. Using a normal pipe didn't seem to work for buffering reasons, but maybe there's a better way. In elisp this looks like (with-temp-buffer (list :exit-status (call-process-shell-command (concat "biber --tool -q --output-file=- =(echo -n " (shell-quote-argument bib) ")") nil t) :output (buffer-string)))