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.

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

  1. Bernhard

    I will definitely try that out. Have youn considered citing

    @Manual{,
    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 = {http://www.R-project.org/},
    }

    in the template?

    Cheers,
    Bernhard

    Reply
    1. Petr Keil Post author

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

      Reply
  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?

    Reply
    1. Petr Keil Post author

      Hi,
      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.

      Reply
      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,
        JN

        Reply
      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.

        Reply
  3. Pingback: Distilled News | Data Analytics & R

Leave a Reply

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