What are your recommendations for thesis writing with RStudio and Rmarkdown?



First things first: I wrote (& submitted/defended! :tada:) my own dissertation in RMarkdown in May 2017.

You can find the public version of that here, including a README:

I say the "public version" because the second chapter of my dissertation involved private student data that is under a restricted publishing agreement -- I can't publish the text of that chapter for a while (though I did include the filenames / a few references to that chapter, so it's not totally obscured).

Also note that there are lots of idiosyncrasies to how my institution requires a dissertation to be formatted. I bootstrapped heavily on an existing LaTeX template that was found "in the ether" among my peers -- caveat that I can't promise this will translate well to your own situation.

That said, a few broad takeaways:

  • Since my chapters came from really different places (one with one set of co-authors [in raw LaTeX], another of my own [Rmd], and a third with a different set of co-authors [Rmd]), a lot of the effort in converting things to Rmarkdown involved wrangling these disparate pieces together in as programmatic a way as possible. aggregator.sh script is what pulls these from their own project into the dissertation folder
  • Dissertation formatting is the worst. So many little things... the whole body_extractor.R script consisted of finding something that was compiling OK elsewhere and all-but manually tinkering with it until it was fixed & presentable in dissertation format. See convert_sideways helper function for converting sidewaystable tables back to vertical
  • I managed references through the individual papers' .bib files, and just concatenated them, basically. This may not have been ideal... liberal use of \cite within the papers also went far.

I'm starting to rust a bit on all the details, but happy to follow up on any questions you have.


I see that thesisdown (the one that started it all) and huskydown (my contribution to this topic, and used by more than a few students on campus) have already been mentioned in this thread, and these are worth a close look because they take care of a lot of the fuss of formatting because they have beautiful built-in latex templates.

Here are a few other posts and packages relevant to this topic that might help you decide how to proceed:

My vote is for R Markdown and RStudio for thesis writing, plus another text editor that has good on-the-fly spell-checking (spacemacs is my choice), and Zotero for free and open source reference management, and because of great integration with the citr addin). I also agree with making an R package as a thesis, as noted above.


I have been writing in LaTeX for about thirty years. I like it. I don't really know markdown well enough to say.

I have written my thesis in LaTeX and R. It's in food science (honey wine to be specific) and my PI requires me to send them new content in Word first, because they don't really want to deal with LaTeX. But I really, really like LaTeX. It helps that there's a document class created specifically for my school's thesis style.

Use what you know, what you want to know, and what you want to get to know very very well. Good luck!


Just wanna say thanks to all the awesome contributions on this thread. I've been using rmarkdown recently (a bit of org in the past with emacs) and I can see there are terrific options to work with text, code, and output withing R framework


It comes down to a few issues. 1) Will the graduate school accept the format? 2) Can you use a template that the graduate school provides? If not you might find yourself reprinting the dissertation several times for small issues like the margins are too small/large or something is shifted 1/2 mm out of place. Yes, the graduate school will reject the dissertation for something so "minor." 3) Will your advisor and committee accept the document and be able to edit and provide comments. 4) How will you deal with citations? Bibliography programs like Endnote will save you time. They track citations and remove/add them as you edit your documents. Otherwise you are responsible for reading through your document to make sure that all citations are present in the literature cited and all elements in the literature cited are actually cited. There is also the issue of formatting for the dissertation, then reformatting for a journal. If the manuscript is rejected then formatting for a new journal. If you have many citations, or expect to be publishing more articles then learning and using a bibliography program is essential. 5) Will the journal accept the file format?


You'll want to check with your supervisor and the Faculty of Graduate Studies. Most universities have strict rules on formatting. This includes things like font types and sizes for different heading levels, the format to be used for the table of contents, a list of tables, and a list of figures, etc. Maybe you ought to ask FGS if they have Rmarkdown or latex formatting templates, and use whichever system will mean less work for you.

I think most universities will have latex style sheets for you to use.

If your work is at all technical, you'll be using latex within the Rmarkdown for equations and symbols within the text, so you ought not to find a transition from Rmarkdown to latex to be especially bothersome. Where you once wrote # blah you will now write \section{blah}, etc. You could write a one-page trial in Rmarkdown, and convert it to latex to see how it works, and then all you'd need to do is to insert a bunch of invocations like \degreetype{PhD} and \convocationDate{blah} so that the first few pages are formatted properly. Any university that provides a latex style sheet will probably also provide a sample file, and that makes it a lot easier; where it says \author{insert author name here}, just ... do what it suggests.


Yet another resource... a series of blog posts on exactly this, but 2 year old now:

I personally write mine in Emacs org mode (with babel for code chunks). Not nearly as popular as RMarkdown which really took off the past few years because it involves Emacs, but it is a more developed markdown format and allows to insert raw LaTeX chunks whenever you need to do something really specific that only LaTeX allows. If you were at all interested in hearing more about this, I could share some info on it.


Not sure how the new Radix will fit into this, but it might be worth having a look:



Good catch! I'm excited about Radix but it relies on RStudio v1.2, which (to the best of my knowledge) is only available through preview releases. I don't use previews, so I haven't had a chance to try Radix yet, but I suspect it would be fantastic for writing scientific theses!



RStudio v 1.2 is available on its cloud platform https://rstudio.cloud. It good opportunity to kick the tire.

I am sold on Radix cos of a good review here. I intend to use Radix to showcase some pet project I did when applying for data jobs.


pandoc is the Swiss Army Knife of document format conversions and is under the hood of RMarkdown/knitr. But it's also available standalone and you will get the ability to convert between a wealth of formats. Sometimes you may need to tweak, of course, but anyone needing to go LaTeX => HTML, for example, should have it.



I would disagree with this, but only slightly. I wrote my thesis using RMarkdown and I found it was much easier to write than using Overleaf or ShareLatex for the simple reason that once you have your settings setup there is less code to produce your text (makes it easier to review).

Once you refer to the proper cls document (which my university provided) and write your preamble in latex rmarkdown will compile the document and you can even save the .tex file.

Just my 2 cents!


Yet another resource: Taking inspiration form Chester Ismay's thesisdown, i built oxforddown for writing theses that are formatted with the most commonly used LaTeX template for Oxford University thesis writing. Perhaps useful for others!