A bash script for reformatting BibTeX bibliographies in place using BibTool. Takes special care to don't break cross references and handle German umlauts correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tex.define {\"[1]=#1e} | |
tex.define {\ss=ss} | |
tex.define {\AE=AE} | |
tex.define {\OE=OE} | |
tex.define {\aa=aa} | |
tex.define {\AA=AA} | |
tex.define {\o=o} | |
tex.define {\O=O} | |
tex.define {\l=l} | |
tex.define {\L=L} | |
tex.define {\i=i} | |
tex.define {\j=j} | |
tex.define {\TeX=TeX } | |
tex.define {\LaTeX=LaTeX } | |
tex.define {\LaTeXe=LaTeX2e } | |
tex.define {\BibTeX=BibTeX } | |
tex.define {\AMSTeX=AMSTeX } | |
resource{biblatex} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | |
tmpfile=$(mktemp /tmp/bibtool.XXXXXX) | |
bibtool -f "{%-2n(author) # %-2n(editor)}-%2d(year)" -r "${SCRIPTPATH}/bibtool-umlauts.rsc" -r "${SCRIPTPATH}/sorting.rsc" -q "$1" > "${tmpfile}" | |
mv "${tmpfile}" "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort.format = {{%1.#s(crossref)a#z}$key} | |
sort.reverse = off | |
sort = on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment