Monday 6 February 2012

Switching between Scrivener and Bibdesk

For the past 8 years or so, I've used LaTeX almost exclusively to write my (academic) papers. Once it is up and running it takes care of the nitty gritty of formatting and referencing, meaning you can focus more on the writing. For several of those 8 years I've been on a mac, and finding the combination of TeXShop and BibDesk pretty darn awesome. BibDesk is a reference manager for the Mac that stores its database in BibTeX format (a standard bibliographical format used by LaTeX). TeXShop is an editing program built for editing LaTeX files; these are plain text and could be edited in any old text editor, but TeXShop provides nice LaTeX syntax highlighting and a fairly useful macro system (and is less busy than other editors I've looked at).

Having said that, TeXShop is pretty ugly to work in sometimes when there are lots of comments and insertions around and things start to get messy. So recently I've been using Scrivener to write my papers and similar documents. Scrivener is basically a lovely looking writing environment that let's you make comments separate from the doc (a la Word), and has some nifty features for managing project-related files and snippets (great for collecting random thoughts you want to put in a paper somewhere at a later date...but not just now!). It doesn't do LaTeX natively, but I've got a pretty smooth system converting to LaTeX via multimarkdown (more on that another time). One thing I miss about TeXShop is the ability to quickly search for BibDesk references inside the editor. We can't do this (at least while it isn't scriptable), but the next best thing is to set up some shortcuts to switch between the apps. My setup is as follows:

* In Scrivener, I have BibDesk set as my bibliography manager (under Preferences > General). This does little more than switch to BibDesk when I press command-Y.

* I have a little applescript in BibDesk that it is triggered by the same command-Y key combination. It will take the references currently highlighted in BibDesk and copy them to Scrivener. The applescript is as follows:
tell application "System Events" to keystroke "c" using {command down}
tell application "Scrivener"
activatetell application "System Events" to keystroke "v" using {command down}
end tell
* All this will do is copy whatever BibDesk usually copies into Scrivener. We want to copy the references over in multimarkdown's referencing format, and can do this using templates in BibDesk; see  here for a discussion and examples. Mine looks like this:
[#<$publications.citeKey.@componentsJoinedByComma/>][]
So when I press command-Y in BibDesk (having selected a few references) I get something like [#Estes55;][] back in the Scrivener doc. It's a bit slow and clunky but does the job. Also, I'm not really an Applescript programmer, so there may be a more sensible way to do this.

4 comments:

  1. Hi Simon, I currently use LaTeX and BibDesk but am contemplating switching to Scrivener (compile to LaTeX) and BibDesk, like your workflow. Just some questions: How big was the learning curve? Are you more productive with Scrivener? How has Scrivener enhanced your writing in ways that LaTeX can't? What about equations in Scrivener?

    -Zachary Steinert-Threlkeld

    ReplyDelete
  2. @Zachary, I think the main improvement is that it clears a lot of crud out of the writing--I like using markup languages like LaTeX, but don't always like looking at the markup. I also rather like the ability to use Scrivener comments rather than tex % comments, as it also keeps them out of the way if I don't want to look at them. To do equations I write latex code embedded in triple angle brackets <<< >>>, and have Scrivener turn these into html comments which mmd passes through as raw latex code.

    I have no idea whether this has made me more productive, but it is more pleasant to use, and I do sometimes make use of the other features in Scrivener (corkboard, composer). The question is whether I'm still using it in a year...

    ReplyDelete
  3. Hi Thanks for your post. Not quite a year exactly, but curious about how you got on? I have been messing about with Scrivener, but miss some of the directness of the formatting instructions. Wish LaTex had a corkboard and snippets feature too...

    ReplyDelete
  4. @pdagraphicdesign: I gave up on Scrivener as it is quite bloated. I miss the corkboard etc. in Scrivener, but have been happily using MultiMarkdown Composer with a variant of the script above. Pluses: syntax highlighting, drag and drop of sections (great when using beamer, where each slide is a subsection in multimarkdown), and supports Critic Markup. Downside: mac only.

    ReplyDelete