Making Ulysses and Bookends play together nicely


After a great deal of experimentation and trial and error, I’ve come up with a workflow to help in academic writing for the web. Ulysses is a great tool for this, but its footnote capacity does not integrate well with a reference manager like Bookends. The latter is also a superb tool, so I was highly motivated to make them play together.

Here’s what I’ve come up with. This workflow provides you at the end with an html document using numbers for in-text citations. Clicking on a citation number takes you to the corresponding reference in your reference list. That reference has a link to return you to the place in your document where that reference was first cited. Note the “first”. The reference also has a link to its PubMed abstract.

Here’s a description of the workflow. However, before attempting this, there is some essential setup to do.


Ulysses setup

In Ulysses preferences, under the “Markup” tab, choose “Markdown”.

Bookends setup

Download the Ulysses citations.fmt file here, and drag it onto the Bookends icon in the dock. It will be installed as a custom format. Note that this format has been set up for journal articles only.

Regular expression find and replace

You will need a text editor or word processor that does find and replace using regular expressions (also called regex or regexp). I use TextMate. But the free text editor TextWrangler can do this also.

The workflow

  1. While writing your article in Ulysses, when you want to enter a citation, switch to Bookends, and with the reference you want to use selected, hit command-Y to copy the citation to the clipboard. Switch back to Ulysses, and paste (command-V) the citation into your text.
  2. If you have multiple citations at a given point in your text, each must show up as an individual citation, ie bracketed with a pair of curly braces, and separated by spaces from neighboring citations.
  3. When you are ready to create your list of references, export your Ulysses document as a text document, formatted as markdown, to a file on your computer; switch to Bookends, and use the “Scan document…” dialogue under the “Biblio” menu. In this dialogue, find the exported file and open it, then select the options to generate a bibliography after scan, using the Ulysses citations format. You will want to generate a new file, and have it open in your text editor, either TextWrangler or TextMate.
  4. Paste the list of references (put into the clipboard by Bookends) into the new file at the appropriate location, and save the file.
  5. a. In TextWrangler: open the Find dialogue (command-F); paste \[%(\d{1,3})\] into the find box, and <a name=a\1>[(\1)](#f\1) into the replace box; select the “Grep” option, and do a “Replace all”. Save.
    b. In TextMate: same as for TextWrangler, except use <a name=a$1>[($1)](#f$1) in the replace box. Select the options “Regular Expression”, “Ignore Case”, and “Wrap Around”.
  6. Go to the file in a finder window, and do an “Open With…” choosing Ulysses as the app.
  7. Export the Ulysses sheet to html, with the various options available to you, such as preview, open with an app such as Safari, save to a file, or publish (for example, to Medium or to WordPress).
  8. That’s it! You’re done!

Keep in mind that with this workflow, the generated document will have citations in the text looking like this: (3) . You can, of course, change this by modifying the replace string. An important limitation is that when using the link within a reference to return to the citation, you will return to your original citation ONLY if you started from the first appearance of that citation in your document. If you started from a different citation location, your return will be to the first appearance.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.