Notes on Bibtex and bibliography management
fixing tandfonline citation exports
When I export a citation (with references) from tandfonline.com, all of the references fail to have a citation key assigned and so it is an invalid bibtex file.
If you load it up in Vim (which you should have access to and be able to use) you can type the following one-liner to fix up the keys:
:%s/@article {,/=“@article{“.line(“.”).”,”/
Translated: ‘%’ whole file; ‘s///’ substitute (find and replace are between ‘/’ characters); ‘@article {,’ find this string; replace it with the next string, ‘line(“.”)’ means calculate the current line number
Citation keys
I write mostly in Scrivener and switched from using Multimarkdown as the output, to using pandoc. From there I generate LaTeX and my PDFs. I ran into an issue where the citation keys automatically generated by the bibliography tool that I use (Bibdesk) were not being parsed by pandoc in the TeX generation process. This seems to be by design in pandoc as it only allows ‘internal punctuation’. So I need to regenerate all my keys.
There is a discussion on StackExchange about ‘good practice’ for cite keys, and the only viable option is that which Google Scholar also uses #lastname#year#first_word_of_title. But that doesn’t cut it with titles beginning with ‘the’ for example.
My new/current key generation format is: %p2%Y%u1.%T3 which translates to 1 or 2 author or editor surnames (%p2), then publication year (%Y), a unique letter (like 1999a) (%u), a full stop, and then three 4 or more letter words from the title (%T3).
BibDesk Scripting
With a little Apple Scripting hooked into the BibDesk application, I’ve managed to generate slightly more verbose keys without the punctuation issue.
- https://sourceforge.net/p/bibdesk/feature-requests/830/
- Some Example BibDesk scripts
- AppleScript documentation
- And more detail
And the script is:
Save that into ~/Library/Application Support/BibDesk/Scripts/
In BibDesk’s preferences, select ‘Script Hooks’ and then ‘Did Generate Cite Key’ and link it to the script. Done.
Misc notes
- dealing with odd keys and names http://tex.stackexchange.com/questions/108595/bibtex-key-definition
- you can change Bibdesk to supprt all the biblatex fields rather than only bibtex ones https://sourceforge.net/p/bibdesk/wiki/Tips_and_Tricks/
- original and published dates https://tex.stackexchange.com/questions/59483/original-date-of-publication-in-biblatex