Integrating .docx and BibTeX

I have nearly every paper I’ve ever read stored in a BibTeX database, so I wrote a BASH script to build a list of citations using BibTeX that could be easily copied into LibreOffice Writer.  I would prefer to write all my papers in LaTeX, but there are some disadvantages–poor adoption and inefficient track-changes methods–so I have to use LibreOffice Writer instead.  None of the available bibliography managers that integrate with LibreOffice seem particularly reliable to me, and I plan to convert my manuscripts back to LaTeX anyway when I put my thesis together.

My reference keys in BibTeX all follow a similar pattern, starting with a hash (#), then a capital letter, followed by up to 3 lower-case letters, then two numbers for the year, and possibly another lower-case letter if the same author wrote two papers in the same year.  If you speak regex, it looks like this :

#[A-Z]{1}[a-z]{0,3}[0-9]{2}[a-z]{0,1}

To cite a paper written by Dr. Blaggs et al. in 1978, I would write #Bla78 in text where I wanted the citation to appear.  The script then pulls the citations out of the .docx file in order, creates a list of citations, and replaces the in-text key with a number (in the current version, though it could be adapted for bracket citations).

If this sounds useful to you, you can grab the script here.

1 thought on “Integrating .docx and BibTeX

  1. dannagifford Post author

    Also, the regex for an in-text cite of the format Blaags 2008, or Blaags and Quargs 2010, or Blaags et al. 2013, is

    [A-Z]{1}[a-z]*[ \t ]*[A-Za-z \.]*[ \t][0-9]{4}
    Reply

Leave a comment...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s