Search code examples
rr-markdownbookdown

How to use preamble.tex with Rmarkdown rticles template for R Journal Submission


I have a problem with the preamble.tex file used in the Rmarkdown rticles template for R Journal Submission. This is the procedure I'm following:

  1. Create a new Rmarkdown rticles template for submission to the R Journal
  2. Knit the document and everything seems to be fine
  3. Add some latex code to preamble.tex (like \usepackage{subfig})
  4. Knit the document and it doesn't compile anymore.

If I just remove \usepackage{subfig} from preamble.tex then everything works fine. I think the problem is related to the fact that the \usepackage{...} code isn't put in the preamble of the .tex document but I don't know how to fix that.

If you want to test I created I git repo here with all the Rmarkdown files up to point 3 of the previous list. If I knit the Rmd document that I get an error.

Hope it's clear


Solution

  • This is due to a bug in the rticles package, which I just resolved on Github. If you install the Github version, it should work now:

    remotes::install_github('rstudio/rticles')