Scrivener-Latex integration 1: Setting up BibDesk

The process of getting Scrivener and my LaTeX writing set up was divided into three separate/linked sub-processes (if you like…) This article details the first, how to set up BibDesk to allow you to drag works from your bibliographic database and have them appear as properly formatted citations in your final document – they look different in the intermediate Scrivener document but that doesn’t really matter, the important things for that are (1)that they’re human-readable (i.e. you know what they are!) and (2)that they’re not too intrusive and distract you from your real content.

So here goes. I am assuming you’ve got something in a BibDesk  database to play with. If not, add something manually, it doesn’t matter what as long as you make sure it’s got a citation key – BibDesk will nag you to choose one or auto-generate one if you prefer that.

Now, in order to allow us to drag this from the BibDesk (BD hereon) library window to Scrivener (or any other text editor) we need to make a template file and make changes to a couple of BD’s preferences.

First of all the MMDTemplate file. Copy this and paste it into a plain text document…

[pp][#<$publications>
<$citeKey.stringByRemovingCurlyBraces/><?$publications>
,</$publications>
]

Save the file, somewhere your not going to lose it or accidentally delete it, as  MMDTemplate.txt

Next we have to tell BD about this template and what we want to use it for; look in BD preferences and find the Template Files panel, add the file you just made as the default MMD Template – make it look like this… (without the green stuff of course!)

When that’s done you can move on to the next step, this is telling BD how and when you want to use this template. For this we go to another of BD’s preference panels, Citation Behaviour and change a couple of the settings. I have things set up so dragging an item from the main window of BD results in a normal LaTeX-style citation command with curly brackets, but when I do the same thing with the option key held down I get an citation command with square brackets and a hash mark, Multimarkdown-style.

They look like this…

LaTeX-style: \cite{Worth:1974}
MMD-style: [pp][#Worth:1974]

..but they both result – when we’re done with all the LaTeX shenanigans – in the same citation and bibliography entry. The [pp] bit in the MMD-style command is where you put the page number of the reference, it’s there to remind me to be accurate and consistent with referencing as much as anything else.

So, set the “Format when holding Option key” setting to “Template”, then choose the MMDTemplate option that appears (should be the only one!) in the menu below. The result should look like this…

When this is done close the preferences dialog and you should be able to drag items from your main BD window and have the two different citation commands appear in whatever text document you’ve dropped them on. [Any problems with this, leave a comment and I’ll look into it ;)]

The next step is to get Scrivener set up to be LaTeX friendly so you can turn all those citation commands into properly formatted citations and a beautiful (and automatically generated, typing-free) bibliography. This will take a bit more explanation!

UPDATE: 29 June 2012 – The description of how to set up Scrivener to produce LaTeX (using in part Multimarkdown) is now here>>>

Advertisements

2 comments

  1. Joe

    This is great. A really helpful explanation of how to make BibDesk work with LaTeX. I can’t wait for the next installment, to learn how to actually make BibDesk LaTeX markdown work in Scrivener!

    Thanks.

  2. PD

    hello!

    That’s a great description for your setup! When is the next one coming? Desperately need it!

Leave a Reply

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: