Guide

Page layout

Set the paper size and margins, and add headers, footers and page numbers in the front matter.

On this page

The page block

The page key in the front matter sets up the printed page.

rechnung.md
---
page:
  size: A4
  margin: {top: 45mm, right: 20mm, bottom: 30mm, left: 25mm}
  header:
    first: none
    rest: "{{ section }} · Rechnung {{ rechnung.nummer }}"
  footer:
    left: "{{ firma.name }}"
    center: "Seite {{ page }} von {{ pages }}"
    right: "{{ rechnung.datum | date }}"
---
Key Values Meaning
size A4, Letter, … Paper size.
margin {top, right, bottom, left} Page margins, for example 20mm or 1in.
header.first none or text Header on page 1. none leaves page 1 without a header.
header.rest text Header on page 2 and later.
footer.left text Footer, left.
footer.center text Footer, centre.
footer.right text Footer, right.

Page numbers

Headers and footers know two extra fields:

  • {{ page }} is the current page, starting at 1.
  • {{ pages }} is the number of pages.

All other {{ }} tags take their value from your data, as in the body.

Section titles in the header

A long report can show the current chapter at the top of each page. Mark the chapter headings with the class section-title:

<h1 class="section-title">1. Introduction</h1>

Then use {{ section }} in a header. Each page shows the last section title that started on or before it.

Small print

Legal text often needs small type. The class small-print keeps it readable: at least 7 pt, with a line height of 1.2.

<div class="small-print">
  <p>Gerichtsstand ist Frankfurt am Main.</p>
</div>

You can also write @page rules in your own CSS, as in Your first document. The page block is a shorter way to write the common cases.