Thursday 12 February 2015

Scrivener + Mendeley + LaTeX and references

There is a comment under my PhD Tools blog post asking about the workflow and using a reference manager with Scrivener. As I said in the comments, as far as I’m aware there isn’t a good and easy solution to that, although some workarounds have been suggested (I’ll try to find them and post links).

First, if you don’t know how LaTeX deals with references, it’s fairy simple. I store my references in Mendeley, assigning a unique cite-key to each paper. The library can be exported as .bib file, which will be automatically updated every time you add a new reference in Mendeley (it’s a one time setup, which is great). Imagine you have a paper written by Smith et al. in 2005. My cite-key for that reference would be Smith_etal2005. I tell LaTeX where it can find the .bib file (I give it the path to that file), so that it can access all the data.

When I write in LaTeX and want to cite this particular paper I use the cite-key Smith_etal2005 and a bit of code that tells LaTeX that this is a reference - it would look like \citep{Smith_etal2005}. LaTeX then goes to the .bib library, pulls out the full reference and sticks it in the “References” section at the end of the document. In the body of the text itself the reference is output as it should be i.e. "some text about the thing (Smith et al., 2005)”.

The beauty of this is that if I were to remove the reference from the body of the text LaTeX will automatically remove it from the reference list at the end. It saves me worrying about having references in text, but not in the reference list and vice versa. I really like it and plan on keeping using LaTeX and Mendeley combo to format and output my documents, likely including the thesis.

Now I am adding Scrivener to the mix. Scrivener will be used mainly for note-taking, early drafts, re-drafting, reverse outlining etc. Anything that doesn’t need to be formatted and look pretty will be done in Scrivener, saving me dealing with the majority of LaTeX syntax in everyday life and formatting once the text is ready to be seen by the outside world. Having said that I don’t want to wait with inputting all reference till the last minute, it’s just so much more efficient to deal with them as you go!

There are two options here.

(1) I can input references in the-LaTeX-way, as I go, just like I would have done if I were writing in LaTeX itself (i.e. use the \citep{Smith_etal2005} in Scrivener). Then, I can simply export (or even copy-and-paste) that document from Scrivener to LaTeX for outputting, compile it and voila! references are sorted.

(2) Alternatively, I could set up Scrivener with Multimarkdown (which is a syntax that allows you to write in plain text and then convert to a more complex format e.g. HTML), write using MMD to keep it simple and avoid having to put LaTeX-like bits of code in (the \citep{} in this case). It is then possible to export from Scrivener to LaTeX through MMD; all MMD specific syntax will be changed to LaTeX specific syntax.

I feel like after the initial set up the second option i.e. using MMD would be cleaner. But then again, I don’t really have issues with using LaTeX-style citation syntax, so that’s what I have stuck with for now, as I only needed to write fairly short pieces of text. For anything of a length greater than 5000-6000 words it might well be worth spending a couple of hours sorting MMD out and getting used to it*.


If you are interested in learning more about any of the above, check out the links below. If that’s not enough - google! There seems to be dozens of tutorials on those things out there already, hence my post is rather simple, no need to re-invent the wheel. 

BibDesk, Multimarkdow, Scrivener (those are way more detailed than this blog post too):
http://timbrandes.com/blog/2012/02/28/howto-write-your-thesis-in-latex-using-scrivener-2-multimarkdown-3-and-bibdesk/
http://timbrandes.com/blog/2014/04/08/optimize-bibdesk-multimarkdown-and-scrivener-for-a-nice-scientific-bibliography-and-citation-workflow/

More here: http://harrisonsweeney.com/posts/scrivener-multimarkdown-and-latex.html

Some good posts on having words too: https://onhavingwords.wordpress.com/2013/03/19/scrivener-multimarkdown-latex/
Using LaTeX code in Scrivener: https://onhavingwords.wordpress.com/2013/07/27/any-latex-scrivener/
Also replacements, if you are really into it all now! https://onhavingwords.wordpress.com/2013/10/06/replacements-latex-scrivener/

On Multimarkdown, from its creator: http://fletcher.github.io/peg-multimarkdown/mmd-manual.pdf




*but it’s not just because of the references, it’s because of the heading, subheading and other bits and pieces. 

Saturday 7 February 2015

Fieldwork. Of sorts

I have just spent two full weeks in Australia. Yes, it’s not much, considering how long it takes to get there from the UK. 

The trip was an odd one. The length was dictated by several factors - I wanted to get out and meet my Australian supervisor, as well as see the set up and my study system, in order to get a better idea of what I’m dealing with and discuss my PhD project in a bit more detail. On the other hand though it’s quite late in the year and the breeding season is pretty much over by now, hence there wasn’t much point in staying down under for a prolonged period of time.

I think that the trip was a successful one. The people are great there and the supervisor was happy to share his insights about all kinds of things. It was helpful to see the birds I’m working on and get a look at the field site. I hope it will aid me in fleshing out my ideas for next season’s fieldwork (behavioural observations, yay!), so that I’ll be off to a good start when I come back in September. Additionally, I feel like I managed to do some networking and for the first time it came easy to me - maybe it’s just the atmosphere there in general, but everyone was so chatty, nice and helpful that having a conversation was a pleasure.

If anybody I have met over there ever reads this I’d like to say thank you for all your hospitality. I really appreciate it and I hope our paths cross in the future and maybe one day I can return the favour.




On top of a successful PhD trip I also managed to spent some time bird watching, chasing the wild parrots (I’m a bit of a parrot geek). Some of the photos of Oz wildlife below if you fancy seeing them.


Crimson rosella
Superb fairy-wren chick
Wallaby
Sulphur crested cockatoos on a bird feeder