Making Mendeley and apacite play nicely together
This is apparently becoming a series on making various parts of my reference-managing toolchain play nicely together. One of the great features of Mendeley is that it can automatically sync up your library with a BibTeX file. One of the annoying things about Mendeley is that you can’t control what fields it puts in that file. Why is this annoying? Because apacite overloads the @article entry type to cover both journal articles and newspaper/magazine articles. These have different APA citation formats, though: one should include the month of publication, while the other shouldn’t. The only way to control which format is produced is to include or omit the month in the BibTeX entry.
At this point you might be wondering why I haven’t just switched to something a little more sensible for doing APA citations in LaTeX. I probably will. But in the mean time, here’s the solution I’ve cobbled together: monitor the library.bib file that Mendeley exports for changes, and then remove all the month lines. The monitoring can be accomplished very easily on Mac OS X using launchd, and the removing is done with a shell script: