# Page layout

How Dunjii sets a document into columns and pages, and the settings and markers that change where the text goes.

## Columns

Dunjii shows a document as the pages it will print, with the text in columns. To change the columns, click **Layout** at the foot of the page (⌘⇧L on a Mac, Ctrl+Shift+L elsewhere) and open **Page**:

- A portrait page takes one to three columns. Two is the default.
- A landscape page takes two to four. Three is the default.

Dunjii saves the choice in the document's frontmatter:

```markdown
---
print:
  orientation: landscape
  columns: 4
---
```

- `orientation: landscape`: Leave it out for portrait.

Card sheets, coin sheets and maps have layouts of their own and no **Layout** button.

![The Page menu in Layout.](https://dunjii.com/docs-assets/layout-and-printing/layout-page.webp)

## Text flow

Dunjii fills the first column from top to bottom, then the next, and starts a new page when the columns are full. It evens out the columns on a page where it can.

- The `#` title runs across the top of the first page.
- To fill a column, Dunjii cuts a long block: a paragraph between lines, a list between items, a table between rows with the header row repeated, and a callout between its parts.
- A heading never ends a column on its own. It moves to the next column with the text under it.
- A column that picks up a section partway through starts with a line naming it, such as *The Lamp Room, continued*.
- When the text between two full-width blocks fits in one column, Dunjii sets it across the page so the other column isn't left empty. It may set short sections side by side instead, one to a column.

![Page 2 of a two-column scene. The first column picks up The Lamp Room from page 1.](https://dunjii.com/docs-assets/layout-and-printing/layout-continued.webp)

## Keeping a block together

To stop Dunjii cutting a block across columns or pages, open its block menu in **Edit** and pick **Keep together** under **Breaks**. The block menu is the icon to the left of the block; ⌘/ opens it from the keyboard. Dunjii moves the whole block to the next column with room for it. A block taller than a column is still cut.

**Keep together** works on paragraphs, lists, tables, callouts and quotes that aren't inside another block. Dunjii writes a comment line above the block, which other markdown editors hide:

```markdown
<!-- block: keep -->
- A light moving on the marsh, low and steady.
- A voice calling the names of the watch.
- Footprints in the frost that stop halfway up the stair.
```

- `<!-- block: keep -->`: Keeps the list below in one piece.

![The block menu for a list, with Keep together picked.](https://dunjii.com/docs-assets/layout-and-printing/layout-keep.webp)

## Page breaks

A page break starts the text after it on a new page. To add one in **Edit**, type `/page` on an empty line, or pick **Page break** from the **+** menu. Typing `\page` alone on a line and pressing Enter does the same. The editor shows the break as a dashed line labeled **Page break**.

```markdown
# Orders for the Night Watch
Keep both lamps lit until the first bell after sunrise.

<!-- page-break -->

# Orders for the Day Watch
Walk the road a mile north and a mile south before noon.
```

- `<!-- page-break -->`: Everything after this line starts on a new page.

- Two page breaks in a row leave a blank page. One at the end of the document adds a blank last page.
- A page break inside a callout, quote or list does nothing.
- There is no column break. To fit a document onto fewer pages, use **Shrink to fit**.

![A page break between two handouts in one document.](https://dunjii.com/docs-assets/layout-and-printing/layout-page-break.webp)

## Full-width blocks

A table too wide for one column runs across the page, and the text above and below it stays in columns. To decide for one table, open its block menu and pick under **Width**: **Auto** lets Dunjii decide, **Full** always runs across the page, and **One column** keeps it in a column. Pictures and callouts have a **Width** setting too.

To keep a whole document in its columns, check **Keep everything in columns** under **Page** in Layout. Then only the title runs across the page, even for blocks set to **Full**.

```markdown
---
print:
  flexibleColumns: false
---

<!-- block: span=full -->
| d6 | Encounter |
| --- | --- |
| 1 | A watchman's lantern, still lit, hanging from a branch |
| 2 | Two wolves that will not cross the road |
```

- `flexibleColumns: false`: Keep everything in columns.
- `<!-- block: span=full -->`: span=full runs the table across the page. span=none keeps it in one column.

![The block menu for a table.](https://dunjii.com/docs-assets/layout-and-printing/layout-width.webp)

## Text size and shrink to fit

Under **Text** in Layout, pick the document's text size: **Compact** (10 pt), **Standard** (12 pt, the default), **Large** (14 pt) or **X-Large** (16 pt).

**Shrink to fit** lets Dunjii set the text smaller when that puts the document on fewer pages. It never goes below 7.5 pt.

| Shrink to fit | Value | Text may shrink by | At Standard |
| --- | --- | --- | --- |
| Off | `none` | 0 pt | 12 pt |
| A little (default) | `some` | 1.65 pt | down to 10.35 pt |
| More | `more` | 3 pt | down to 9 pt |
| A lot | `most` | 4.5 pt | down to 7.5 pt |

```markdown
---
print:
  fontSize: large
  shrink: more
---
```

- `fontSize: large`: compact, large or xlarge. Leave it out for Standard.
- `shrink: more`: A value from the table above. Leave it out for A little.

The Print preview's **Text size** prints every document at 100% to 200% of its own size, for that print only. A table's block menu has **Scale**, from 80% to 125%, for that table alone. The space between lines and blocks is part of a [custom theme](https://dunjii.com/docs/layout-and-printing/themes.md).

![The Text menu in Layout.](https://dunjii.com/docs-assets/layout-and-printing/layout-text.webp)
