Skip to content

Instantly share code, notes, and snippets.

@ThomasA
Created September 22, 2014 07:43
Show Gist options
  • Save ThomasA/7833b52350c2f8d21d6e to your computer and use it in GitHub Desktop.
Save ThomasA/7833b52350c2f8d21d6e to your computer and use it in GitHub Desktop.
I wrote this Python script as a "bridge" to generate a fake `.aux` file for use with xcite and Biblatex. It is a very crude attempt, but it worked for the case I needed it for. Run it as `python gen_dummy_bib.py document.bbl document_fake.aux`
import sys
import re
replace_count = 1
infile = open(str(sys.argv[1]), 'r')
outfile = open(str(sys.argv[2]), 'w')
for line in infile:
if '\\entry' in line:
outfile.write(re.findall('\\\\entry\{[^{]+', line)[0].replace('entry', 'bibcite') + '{' + str(replace_count) + '}\n')
replace_count += 1
infile.close()
outfile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment