New writing workflow

I wrote Functional programming in R using Ulysses and have used Ulysses to write the first part of Object oriented programming in R as well. It is a very nice editor and I am definitely using it in the future for other writing projects, but for the workflow with these books it doesn’t really work for me anymore.

The way I write the books is this: I write in R Markdown that I then need to run through ‘knitr’ to get the R code executed, this generates Markdown files that I then process using ‘pandoc’.

To get the full set of features in Ulysses, I have to use their internal file format, which means I have to export files ever time I need to compile the text. It is not a major hassle, but it is a little annoying.

It is especially annoying with Object-oriented programming in R where the second chapter has some performance measurement code that takes a while to run. I don’t want to run that every time I compile the book, so having a make file that makes sure I only compile and run the R code when necessary is the way to go, but either I have to be careful to export chapters in separate files (and remember to do that every time I change the text), or I have to just edit the raw Markdown files and not bother with the internal file format.

I have decided on the latter. I can’t use the more advanced features then, so I will edit with iA Writer instead, I think, just to give that a good try for comparison with Ulysses. I already use iA Writer for most Markdown editing, but I haven’t tried using it for a book yet. I will miss Ulysses’ sheets — they make it easy to move sections about — but I am sure I can manage without them.

With iA writer I can’t use the more advanced features like embedded files and such outside of iCloud, as far as I can see, but that wouldn’t really work well with the book compilation framework anyway. Embedding figures, for example, doesn’t really work for me because I need different figures when compiling to PDF and when making EPub. So I have to have the figures external to the text in any case.

You can see my current setup at github. I just have a Makefile for processing the files. First I send the R Markdown through a pre-processor — this is how I can have different code run depending on whether I’m making a PDF or an ebook — and after that through knitr and finally through pandoc.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.