将背景图像添加到R Markdown(.rmd)文件以进行PDF输出?

时间:2017-05-18 09:00:56

标签: r-markdown pandoc

是否可以将背景图像添加到R Markdown(.rmd)文件以进行PDF输出?

我已经浏览过Pandoc's R Markdown文档,但找不到添加背景图片的提及。

1 个答案:

答案 0 :(得分:5)

this tex.SE answer开始:将以下内容保存为header.tex(将image.jpg替换为背景图片的路径):

\usepackage{background}

\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
pages=all,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{image.jpg}
  }%
}

并添加到你的yaml:

---
output: 
  pdf_document:
    includes:
      in_header: header.tex
---

有关如何自定义输出的提示,请参阅background documentation

相关问题