Generating a Publications List from BibTex files

Publications list in Markdown

For many years I’ve been using a convoluted process to generate my publications list from separate bibtex files for journals, conferences, books, patents, etc. I thought I could do it using pandoc, but it doesn’t appear that it parses bibtex files correctly.

After quite a lot of searching, I found pybtex which (unlike pandoc) understands bibtex bst files and can output markdown. This plus a little bit of python allowed me to generate directly from my .bib files.

import subprocess
import re
import os

# different bibliography categories with their names
bibs = {'journal': 'Journals',
    'conference': 'Conference Papers',
    'patent': 'Patents',
    'book': 'Books',
    'bookchap': 'Chapters in Books',
    'editor': 'Edited Books',
    'misc': 'Miscellaneous'}

pretex = """\\documentclass{article}
% whatever you need here, basically a good idea is to use your real thesis header

# create the .tex and .md files for each category
for k in bibs:
    intex = pretex + '\\bibliography{../' + k + '}\n\\end{document}\n'
    with open(k+".tex", "w") as tex_file:
        print(intex, file=tex_file)
    os.system("latex {}".format(k))
    os.system("bibtex {}".format(k))
    os.system("latex {}".format(k))
    cmd = "pybtex --style-language python --output-backend markdown {}".format(k)

out = """---
comments: false
permalink: papers
slug: papers
title: Publications
classes: wide
with open("", "w") as out_file:
    print(out, file=out_file)

    for k in bibs:
        with open(k+".md", "r") as text_file:
            text =
            print("# {}\n".format(bibs[k]), file=out_file)
            print(text, file=out_file)

Publications list in LaTeX

The next problem is to get it in \(\LaTeX\). Unfortunately, I couldn’t stay with bibtex and had to use biblatex/biber instead. Using biblatex, it is relatively straightforward and only a few issues needed to be handled:

I also had to remove keywords in the .bib files as my way of overwriting them didn’t work properly. Putting all this together, here is a skeleton of the latex file for my publications list.

  \maps[datatype=bibtex, overwrite]{
      \step[fieldset=KEYWORDS, fieldvalue=journal, append]
      \step[fieldset=KEYWORDS, fieldvalue=conference, append]

\printbibliography[title=Journals, resetnumbers=true, heading=subbibnumbered, keyword=journal]
\printbibliography[title=Conferences, resetnumbers=true, heading=subbibnumbered, keyword=conference]