是否可以在R Markdown(.rmd)文件中为PDF输出添加背景图像?
我已经仔细查阅了Pandoc的R Markdown文档,但没有找到任何关于添加背景图像的说明。
从这个 tex.SE 回答中得知:将以下内容保存为 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
文档,了解如何自定义输出的技巧。