将 Posterdown Package (R) 中的 HTML 文件渲染为 PDF

Tan*_*a94 3 pdf latex r r-markdown

我正在尝试使用posterdownRMarkdown ( https://pythonawesome.com/use-rmarkdown-to-generate-pdf-conference-posters-via-html-or-latex/ ) 中的包来生成一个漂亮的 PDF 文件。我注意到安装包后默认模板会生成为 HTML 文件。有什么方法可以将其设置为生成 PDF 文件而不是 HTML 文件吗?

此外,是否可以将页眉和标题中的默认颜色(绿色)自定义为我选择的 HTML 颜色代码?

这是默认的 YAML

---
title: Generate Reproducible & Live HTML and PDF Conference Posters Using RMarkdown
author:
  - name: Brent Thorne
    affil: 1
    orcid: '0000-0002-1099-3857'
  - name: Another G. Author
    affil: 2
affiliation:
  - num: 1
    address: Department of Earth Science, Brock University
  - num: 2
    address: Department of Graphics and Layouts, University of Posters; Canada
column_numbers: 3
logoright_name: https://raw.githubusercontent.com/brentthorne/posterdown/master/images/betterhexlogo.png
logoleft_name: https://raw.githubusercontent.com/brentthorne/posterdown/master/images/betterhexlogo.png
output: 
  posterdown::posterdown_html:
    self_contained: false
bibliography: packages.bib
---

Run Code Online (Sandbox Code Playgroud)

蒂亚!

Dan*_*iii 6

您可以使用YAML或内联 CSS控制颜色,您需要添加knit: pagedown::chrome_print到 YAML 以打印到 PDF 并保留 CSS 代码。self_contained: TRUE我还出于习惯更改了代码。当我运行下面的代码时,我的posterdown标题颜色发生了变化,并且它在我的默认 PDF 查看器中打开,因为它现在是.PDF

---
title: Generate Reproducible & Live HTML and PDF Conference Posters Using RMarkdown
author:
  - name: Brent Thorne
    affil: 1
    orcid: '0000-0002-1099-3857'
  - name: Another G. Author
    affil: 2
affiliation:
  - num: 1
    address: Department of Earth Science, Brock University
  - num: 2
    address: Department of Graphics and Layouts, University of Posters; Canada
column_numbers: 3
logoright_name: https://raw.githubusercontent.com/brentthorne/posterdown/master/im    ages/betterhexlogo.png
logoleft_name: https://raw.githubusercontent.com/brentthorne/posterdown/master/ima    ges/betterhexlogo.png
output: 
  posterdown::posterdown_html:
    self_contained: TRUE
knit: pagedown::chrome_print
---

```{css, echo=FALSE}
div.title_container{
   background-color: #ff7f50;
}

div.logo_left{
  background-color: #ff7f50;
}
div.logo_right{
  background-color: #ff7f50;
}
```
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述