The code does compile, but it always the same picture (see image in first post). As I only want the background on certain pages the suggestions unfortunately don’t fit.
I think the problem in my code, is that I don’t “consume” the step in next_bird(). Which makes Typst ignore it. However when I try to do this:
#let next_bird() = {
let bird = birds.birds.at(counter("bird").step())
bird.path = "birds/" + bird.path
return bird.path
}
I get the following error:
error: expected integer, found content
┌─ birds.typ:8:28
│
8 │ let bird = birds.birds.at(counter("bird").step())
│ ^^^^^^^^^^^^^^^^^^^^^^
I might be able to make Y.D.X’s example work by calculating at which pages I expect the background to be at.
Edit:
I’m using next_bird() like this:
#let lines_a5(title: "", alignment: left) = {
let bird = next_bird()
page(background: image(bird), {
let total_lines = 26
if title != "" {
pad(bottom: 8pt,
align(alignment)[
#heading(level: 1)[
#text(size: 27pt, title)
]
])
total_lines -= 2
}
for _ in range(0, total_lines) {
pad(y: 3pt, line(length: 100%))
}
})
}
And lines_a5() is used like this:
#let day_with_notes(date) = {
day_overview(date)
lines_a5(title: "Notities", alignment: right)
}
#let week_with_notes(week, year) = {
week_overview(week, year)
lines_a5(title: "Notities", alignment: right)
let first_day = week_to_date(week, year)
let one_day = duration(days: 1)
for _ in range(0, 7) {
day_with_notes(first_day)
first_day += one_day
}
}
#let weeks_with_notes(first_week, last_week, year) = {
for week in range(first_week, last_week + 1) {
week_with_notes(week, year)
}
}
#context [
#pagebreak(to: "even")
#align(center + horizon, heading()[#text(size: 27pt)[Weekoverzichten Januari]])
#month_with_notes(1, 2026)
#weeks_with_notes(1, 5, 2026)
#pagebreak(to: "even")
#align(center + horizon, heading()[#text(size: 27pt)[Weekoverzichten Februari]])
#month_with_notes(2, 2026)
#weeks_with_notes(6, 9, 2026)
]