I'm trying to create a chapter function, similar to Latex's \chapter{title}
The idea is this function performs a few tasks to start a new chapter, such as starting a new page, creating the title with a certain font and adornment, etc.
So far, I have something like the attached image.
The chapter function looks like this.
#let Chapter(title) = {
set text(size: 24pt)
pagebreak(weak: true)
stack(
v(5mm),
heading[#title],
line(length: 100%, stroke: 2pt + luma(50%)),
v(5mm)
)
}
Additionally, there is a #show heading: ... that performs some styling on the chapter heading (level 1).
The #Chapter() function is defined as a heading of level 1. Then, headings with = start at level 2 (This is for the sake of TOC and PDF bookmarks).
The issue I'm having is that I have to modify the heading explicitly after the use of the #Chapter() function. Like this:
#Chapter[Set Theory]
#set heading(offset: 1) // move this info Chapter()
I would like to put that set call, or its equivalent, within #Chapter() to have all the functionality self contained.
Is there some way to affect that heading.offset value from within the #Chapter() function?