在Rmarkdown中插入带有图像的标题页以呈现pdf文档 [英] Inserting title page with image in Rmarkdown to render a pdf document
本文介绍了在Rmarkdown中插入带有图像的标题页以呈现pdf文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Rmarkdown中,以下内容设置了上下文以生成pdf文档:
In Rmarkdown, the following sets the context to generate the pdf document:
---
title: "My Report"
author: NDE
output:
pdf_document:
fig_caption: true
toc: true
highlight: kate
---
我想在打印目录之前插入带有图像的标题页,标题.有办法可以实现吗?
I want to insert a title page with an image, title before table of contents gets printed. Is there a way I can achieve it?
推荐答案
对我来说,它使用LaTeX命令\clearpage
和\tableofcontents
:
For me it worked using LaTeX commands \clearpage
and \tableofcontents
:
---
title: "image before toc"
output: pdf_document
---
\centering
![Caption](folder/image.png)
\raggedright
\clearpage
\tableofcontents
# header 1
lore ipsum
## header 2
lore ipsum
## header 3
lore ipsum
# header 4
如果要在标题页上显示目录,只需省略\clearpage
命令即可.
If you want the table of contents on the title page, just leave \clearpage
command out.
我包括了\centering
和\raggedright
命令,以使图像位于标题页而不是文本的居中位置.
I included \centering
and \raggedright
commands to center the image on the title page but not the text.
希望对您有用.
这篇关于在Rmarkdown中插入带有图像的标题页以呈现pdf文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文