From c86eea62449be60c1e0b8962ed1312eb68ccc483 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Tue, 20 Jan 2026 00:15:09 +0100 Subject: [PATCH 1/2] Add option to `begin-at-new-page` for (sub)tasks --- src/task.typ | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/task.typ b/src/task.typ index 8829ec4..335cfd8 100644 --- a/src/task.typ +++ b/src/task.typ @@ -82,6 +82,16 @@ points-show: true, /// The word that is displayed before the points. -> content | str points-prefix: context i18n.translate("Points"), + /// Whether to insert a colbreak before the task. + /// + /// Technically, this breaks the column and not the page + /// but a single-column layout is assumed. + /// + /// This does not apply to the very first task + /// where it usually makes no sense to break before. + /// + /// -> bool + begin-at-new-page: false, /// Whether the task is a bonus task. -> bool bonus: false, /// Whether bonus tasks are marked with a star in the title. -> bool @@ -155,6 +165,16 @@ } } + // maybe colbreak before task + context { + let is-first-task = ( + query(selector().before(here())).len() == 0 + ) + if begin-at-new-page and not is-first-task { + colbreak(weak: true) + } + } + block(width: 100%, above: space-above, below: space-below)[ #if label != none { if supplement == auto { supplement = task-prefix } @@ -244,6 +264,13 @@ /// /// -> length min-indent: 1.2em, + /// Whether to insert a colbreak before the subtask. + /// + /// Technically, this breaks the column and not the page + /// but a single-column layout is assumed. + /// + /// -> bool + begin-at-new-page: false, /// A function that provides styling to the description of a subtask. -> function task-text-style: emph, /// The body of the subtask. @@ -303,6 +330,10 @@ } } + if begin-at-new-page { + colbreak(weak: true) + } + grid( columns: (auto, auto, 1fr), column-gutter: 0em, From 605fea36423903d96c017f3892bc0da469ab9365 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Tue, 20 Jan 2026 00:17:21 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d0efcd..16e597c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Added an argument `todo` in `#task` to mark task with TODO - Added `definition` environment and `example` environment - Added task text handling +- Added `begin-at-new-page` option for `task` and `subtask` ## [0.4.0] - 2025-11-22