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

后端 未结 4 1582
终归单人心
终归单人心 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:20

    I had a similar problem: a loop to render PDF reports that contained a table. PDF would not render with booktabs = T. My solution was to manually load all of the latex packages in my setup chunk in the Rmd script that was being called from the loop.

    So in the Rmd script that was being called multiple time I have:

    usepackage_latex("booktabs")
    usepackage_latex("longtable")
    usepackage_latex("array")
    usepackage_latex("multirow")
    usepackage_latex("xcolor", "table")
    usepackage_latex("wrapfig")
    usepackage_latex("float")
    usepackage_latex("colortbl")
    usepackage_latex("pdflscape")
    usepackage_latex("tabu")
    usepackage_latex("threeparttable")
    usepackage_latex("threeparttablex")
    usepackage_latex("ulem", "normalem")
    usepackage_latex("makecell")
    

    This fixed the issue - the PDFs rendered with formatted tables.

    Hopefully, this helps someone.

提交回复
热议问题