11

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?

Next Door Engineer
  • 2,818
  • 4
  • 20
  • 33
  • 1
    Check answer [here](http://stackoverflow.com/questions/29389149/add-image-in-title-page-of-rmarkdown-pdf/32675074#32675074) is a solution using *LaTeX* – user3498523 Sep 20 '15 at 04:14

1 Answers1

12

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

If you want the table of contents on the title page, just leave \clearpage command out.

I included \centering and \raggedright commands to center the image on the title page but not the text.

Hope that works for you.

jmjr
  • 2,090
  • 2
  • 21
  • 31