在Rmarkdown中,以下设置生成pdf文档的上下文:
---
title: "My Report"
author: NDE
output:
pdf_document:
fig_caption: true
toc: true
highlight: kate
---
我想在打印目录之前插入带有图像的标题页,标题。有没有办法实现呢?
答案 0 :(得分:10)
对我而言,它使用了LaTeX命令\clearpage
和\tableofcontents
:
---
title: "image before toc"
output: pdf_document
---
\centering

\raggedright
\clearpage
\tableofcontents
# header 1
lore ipsum
## header 2
lore ipsum
## header 3
lore ipsum
# header 4
如果您想在标题页上找到目录,只需退出\clearpage
命令。
我添加了\centering
和\raggedright
命令,将图片置于标题页的中心,而不是文本。
希望对你有用。