Last Updated: February 25, 2016
· qubyte

Switch to select BibTeX or biber.

Originally discussed on

Repo with code can be found at:

With TeXShop, TeXworks and some other TeX IDEs, the TeX engine to use can be selected near the top of the file with a directive like:

% !TEX TS-program = pdflatex

Bibliography management is shifting from BibTeX, which is showing its age, toward biber in the community. Unfortunately there is no similar directive in these IDEs for bibliography engine. I decided to code one myself in bash. By using the code below, and telling your IDE that it is the bibliography engine, you can use the usual hotkeys, and select the engine you want near the top of the file with:

% !BIB TS-program = bibtex


% !BIB TS-program = biber

The code:


bibtype=`head -n20 "${filestem}.tex" | sed -n 's/\%[ ]*![ ]*BIB[ ]*TS-program[ ]*=[ ]*\([a-z]*\)/\1/p'`

if [ -z $bibtype ]; then
    echo "No option detected in TeX file. Defaulting to BibTeX."
    echo "Option $bibtype detected in TeX file."

eval $bibtype $filestem

1 Response
Add your response

Inspired by this tip, the TeXShop developers have integrated support for bibliography engine selection. See

over 1 year ago ·