Pandoc - how to get pagebreak between title block and the table of contents?

3

2

Simple markdown file, with YAML block:

---
title: Report 
author: Tom Brown 12345678
date: August 2018
toc: true
numbersections: true
geometry: margin=2.5cm
urlcolor: blue
header-includes: |
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \lfoot{Draft Prepared: 15 August 2018}
    \rfoot{Page \thepage}
---

When I create the PDF output, the title and ToC are on the same page. How can I get the title block on one page and the ToC on the next? I've searched high and low and cannot find a solution.

Rob

Posted 2018-08-15T05:18:30.050

Reputation: 31

Answers

3

Pandoc allows to insert LaTeX between title and the actual document via the include-before metadata field. Adding the following to your YAML header should be sufficient:

include-before:
- '`\newpage{}`{=latex}'

tarleb

Posted 2018-08-15T05:18:30.050

Reputation: 226

1

While @tarleb's method of course is correct and more 'YAMLish' (but less intuitive), you can also write the following into your source Markdown file:

---
title: Report 
author: Tom Brown 12345678
date: August 2018
toc: true
numbersections: true
geometry: margin=2.5cm
urlcolor: blue
header-includes: |
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \lfoot{Draft Prepared: 15 August 2018}
    \rfoot{Page \thepage}
---

\newpage{}

# First Headline

Here comes my markdown text ....

Kurt Pfeifle

Posted 2018-08-15T05:18:30.050

Reputation: 10 024

The above code only inserts a page-break between toc and content, not between title-block and toc. However, I agree that an alternative, non-YAML solution would be helpful: one could remove the toc entry from YAML and insert the \newpage{} \toc directly into the document. – tarleb – 2018-12-17T19:50:00.080

Thx, @tarleb, you are right. You are a sharp observer, and I overlooked something. – Kurt Pfeifle – 2018-12-17T21:52:04.517