Max
Max

Reputation: 679

Insert page breaks for Meta Data block header and TOC for Pandoc

I'm struggling to get line breaks in exported pdf files with Pandoc.

I have the following markdown:

---
title: "Linux assignment"
subtitle: "Very hard"
author: Max
geometry: margin=2cm
output: pdf_document
---

# Introduction
Hello

This is some `code`

\pagebreak

# Technical sections

\pagebreak

I export the input to pdf with this command:

pandoc task.md -f markdown \
    --toc \
    --metadata date="`date +%D`" \
    -s -o test1.pdf \

The output looks like this:

enter image description here The explicit \pagebreak works as they should. But I want page breaks between the header and the TOC, and between the TOC and the content, which is not what I achieve.

I've read that templates can be adapted. The pandoc -D latex template is quite massive, and I've tried to introduce page break, without success.

Upvotes: 1

Views: 1555

Answers (1)

If you insert the toc manually, you can control if there should be pagebreaks around it:

---
title: "Linux assignment"
subtitle: "Very hard"
author: Max
geometry: margin=2cm
output: 
  pdf_document:
    toc: false
---

\pagebreak
\tableofcontents
\pagebreak

# Introduction
Hello

This is some `code`

\pagebreak

# Technical sections

\pagebreak

Upvotes: 1

Related Questions