As in the title, I'd like to be able to select whether TeXShop uses biber or BibTeX in the document rather than using the command line or changing the default in the TeXShop preferences.
For TeX engines this is easy; i.e. you can put the following somewhere near the top of your TeX file
% !TEX TS-program = pdflatex
to tell TeXShop to compile with pdflatex, regardless of the default in the preferences. Does such a directive exist for bibliography passers? I want to be able to hit ⇧+⌘+B for this. Latexmk provides the ability to do this, but I want to do compilations manually.
Final note
The solution involved a shell script. I've made this available on GitHub, so please feel free to use and improve it.
Best Answer
I solved this is a mildly hacky way. First of all, I wrote a script called
TeXShopBib.sh
which looks likeand placed it somewhere TeXShop will find it (just
/usr/texbin
for quick testing in my case). Make sure the script's executable bit is set. If you have saved the script in/usr/texbin
then you need to issue the command:Then I simply altered the preference to pick up this script as the BibTeX engine.
If the TeX file has a line that looks like
or
in the first 20 lines then it figures the rest out and works properly with the TeXShop console, in a similar way to how TeXShop handles TeX engines. This script crudely defaults to BibTeX when nothing is detected in the
tex
file, but is no more sophisticated than necessary for my purposes. If there is any interest in this then I can make it more robust.