Why does rendering a pdf from rmarkdown require closing rstudio between renders?

后端 未结 4 1584
终归单人心
终归单人心 2020-12-08 11:38

Background

I am trying to make a rmarkdown document that is rendered using render(). The render call has two elements that are parameteri

4条回答
  •  心在旅途
    2020-12-08 12:21

    I found an easy way to do this for multiple .Rmd files was to make a "headers.tex" file with the list of these kableExtra-added \usepackage{} commands. Then in the YAML header of the .Rmd file:

    output: 
      pdf_document:
        includes:
          in_header: headers.tex
    

    Here's what I put in the header.tex file -- I'd copied it from one that worked, and it's also the output of kableExtra_latex_packages() stripping off the "header-includes:" line and the dashes.

    \usepackage{booktabs}
    \usepackage{longtable}
    \usepackage{array}
    \usepackage{multirow}
    \usepackage{wrapfig}
    \usepackage{float}
    \usepackage{colortbl}
    \usepackage{pdflscape}
    \usepackage{tabu}
    \usepackage{threeparttable}
    \usepackage{threeparttablex}
    \usepackage[normalem]{ulem}
    \usepackage{makecell}
    \usepackage{xcolor}
    

提交回复
热议问题