Search code examples
rr-markdownbookdown

Can't use PLOS rticles template with bookdown


Following this post, I'm trying to put @YihuiXie 's answer in practice with the PLOS template of rticles but it doesn't work. Any help would be very appreciated!

Below in a minimal example:

---
title: Title of submission to PLOS journal
author:
  - name: Me
    affiliation: Here

# output: rticles::plos_article
output:
  bookdown::pdf_document2:
    base_format: rticles::plos_article
---

# Introduction

Some text \@ref(fig:fig1)

# References {#references .unnumbered}

The error message reads

Error in pdf_book(..., base_format = rmarkdown::pdf_document) :    formal argument "base_format" matched by multiple actual arguments 
Calls: <Anonymous> -> create_output_format -> do.call -> <Anonymous> 
Execution halted

Solution

  • You cannot change the base_format for bookdown::pdf_document2. You can do so for bookdown::pdf_book, though:

    ---
    title: Title of submission to PLOS journal
    author:
      - name: Me
        affiliation: Here
    
    #output: rticles::plos_article
    output:
      bookdown::pdf_book:
        base_format: rticles::plos_article
    ---
    
    # Introduction
    
    Some text \@ref(fig:fig1)
    
    # References {#references .unnumbered}
    

    Note to other readers: Make sure that .../rticles/rmarkdown/templates/plos_article/skeleton/PLOS-submission.eps is present in that directory.