3

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.

3 Answers 3

5

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}'
0
2

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 ....
2
  • 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
    Commented Dec 17, 2018 at 19:50
  • Thx, @tarleb, you are right. You are a sharp observer, and I overlooked something. Commented Dec 17, 2018 at 21:52
0

In the reference word document, modify the style for the Table of Contents as follows:

  1. Select TOC
  2. Selects "styles"
  3. Under the styles, select "Modify"
  4. Under modify style, select "Format"
  5. From the format, select "Paragraph"
  6. Within Paragraph "Line and Page Breaks" section, check/select "Page break before"
  7. Click Ok and save the reference document (word_styles.docx) and mention the same in Yaml.

---
output:
word_document:
reference_docx: "word_styles.docx"
---

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .