Semantic Werks

Thoughts on people, machines and systems.

Some notes on integrating Mendeley, Scrivener, MultiMarkdown and (Xe)Latex

with 7 comments

I’m using Scrivener for my thesis. It has good outlining options, full-screen mode, rich text, and this neat feature that lets you mark things as comments (annotations). I can use Multimarkdown to mark up the text (commonly ** to do italics) and lists are much simpler than \begin{itemize}\end{} format of Latex.

To manage my references I have been using Mendeley. It’s a little alpha still. There’s no way to search for specific fields, for example Actually, it is possible: either use search fields or click the arrow dropdown menu. Yay! And it doesn’t integrate at all with Scrivener, although it will with other editors. There is, however, a web API and it uses a SQLite backend, so hacking is possible.

For example, if there’s one thing I hate it is trying to remember the citation key for a reference – it completely kills my flow. So I’ve hacked up an Apple automator script that will take the highlighted text, search Mendeley’s SQLite db for that text, and return a list of possible matches (yes, this is how I procrastinate about actually writing). Then I can stick that in. Here’s the gist (code).

Generally the Latex export works quite well. You must set an XSLT transform in Scrivener which takes the MultiMarkDown export and converts it to Latex. The code I have online shows how to export this to the UofToronto thesis class.

A few tips:

– generally Latex code, e.g. math mode, is passed through with no problems. However, I’ve found that it is a good idea to surround complex Latex with HTML quotes comments.
– special characters like % and & get escaped, which is not always what you want, particularly if you have cut and paste.
– you can’t use double-dash inside HTML comments, so switch to using single dash or Mac’s en-dash (Opt-dash). If you use XeTex, you can specify a font like Times New Roman which will display this properly.
– You can’t directly show characters like φ too easily in Latex, yet. You are better off with $\phi$ until math fonts improve.

Advertisement

Written by Neil

2010 September 4 at 16:01

7 Responses

Subscribe to comments with RSS.

  1. How exactly do you surround LaTeX with HTML comments? An example would be great!

    Alexy Khrabrov

    2010 September 23 at 14:29

    • If you use Scrivener and MMD export, anything between is passed directly through as Latex. So for complex tables or math I prefer this approach to the MMD footnotes and Unicode math symbols.

      e.g.

      <!--
      \begin{table}[h]
      \caption{Harker's types of requirements change (after \cite{harker93})}
      \centering
      \label{tbl:harker}
      \begin{tabular}{c|c|c}
      -->

      will be skipped in the output conversion (since it is converted to XHTML), the comments removed, then parsed by Latex as a table. Very handy.

      Neil

      2010 September 23 at 21:16

  2. Do you know of any way to keep italics in my text from being converted to underlines when I compile the document. I’m using OSX and converting the document to a Kindle format. Every time I compile my italicized text gets underlined. It’s driving me a little crazy

    Keith

    2010 November 11 at 15:00

    • Markdown doesn’t use typefaces but rather HTML tags. So the only options available are <strong> and <em>. I suspect something in the Kindle conversion is translating <em> into underlines. I’d look for the intermediate files – the XSLT for the Kindle conversion.

      Neil

      2010 November 11 at 15:17

  3. I’m wondering how you use those tools during revision process.
    I use Mendeley to manage my references and LaTeX for writing. I was trying Scrivener and it was great for drafting and smooth to move to LaTeX for further processing. Then my draft is going back and forth between my supervisor and me. In this step, I use mainly LaTeX but I’m worried a little bit the draft in Scrivener because it becomes outdated from the current version.
    Do you somehow sync back or just leave the draft as draft?

    microbe

    2011 January 28 at 10:16

    • My supervisor makes comments on the PDF I create, and I then fix things up in the Scrivener file. That way I can save a “snapshot” of my work prior to making his changes. So the Scrivener version is always canonical.

      I would say to pick one version and make it the main one, otherwise you’re right, it’s a nightmare. If your supervisor makes changes in Latex (lucky!) I’d just use version control (e.g., Git) and stick with Latex.

      For safety I have my latex export in a Dropbox folder, and save Scrivener backups (zip files) to the same folder.

      Neil

      2011 January 28 at 10:40

  4. [...] have another post that discusses my approach to writing my thesis using Scrivener. It’s out of date now because [...]


Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 198 other followers