Simple template for scientific manuscripts in R markdown

By | March 12, 2015

I've made a really simple template for the classical manuscript format for R markdown and knitr. Here are the resulting .pdf and .html.

The template contains the four usual components of any scientific manuscript:

  • equations (using LaTeX syntax)
  • table with caption (done by kable package, but you can also use xtable)
  • figure with caption
  • citations and references (done by knitcitations package)

The template uses Methods in Ecology and Evolution reference style, which is stored in the mee.csl file.

The template does not have line numbers nor wide line spacing. To add these you will have to edit the .tex file, i.e. you will need to learn a little bit of LaTeX.

How to use the template?

  1. Go to the GitHub repository.
  2. Save the .Rmd and .csl files to your local folder.
  3. Open the .Rmd file with R studio.
  4. Edit freely.
  5. Hit the Knit html or Knit PDF button.
(Visited 10,129 times, 2 visits today)

8 thoughts on “Simple template for scientific manuscripts in R markdown

  1. Bernhard

    I will definitely try that out. Have youn considered citing

    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2014},
    url = {},

    in the template?


    1. Petr Keil Post author

      Good idea, thanks! I have included the R citation.

  2. jn

    1. What's about referencing to a figure or a table in a text?
    2. Do you have any experience in sending a result of .Rmd files to a journal?

    1. Petr Keil Post author

      ad 1: Good idea, I will try to add that asap.
      ad 2: I have experience with submitting LaTeX's .tex files to journals, but not .Rmd. I would not even expect journals to take .Rmd now. But you don't have to do that, because knitr can also give you the .tex file, which almost every journal takes. However, the .tex file is not a default output, you need to check a box in the "Knit PDF settings", and then the .tex will be produced alongside your .pdf.

      1. jn

        ad 2: I'm writing my papers in .Rnw format, but I was thinking about writing them in .Rmd. Although, I've found few problems:
        1. bibliography citations and references
        2. captions for figures and tables
        3. references to a figure or table
        (Probably, there were more problems, but those above I can think right now). So my previous question wasn't about "did you ever send .Rmd file", but more "did you ever send .tex file, which was prepared in knitr to a journal?"

        Thanks for your good work,

      2. Tom

        Thanks, Petr, this is really excellent. I wish I had this last year!
        Do you have any idea why the Figure and Table numbers don't show up in the HTML file? Maybe it's just my browser. And lastly, yes, if you can add the figure reference in the text that would be wonderful.

  3. Pingback: Distilled News | Data Analytics & R

  4. Máy Chạy Bộ Chính Hãng

    Having read this I thought it was very informative. I appreciate you spending some time and energy to put this informative article together.
    I once again find myself personally spending way too much
    time both reading and commenting. But so what, it was still worthwhile!


Leave a Reply

Your email address will not be published. Required fields are marked *