Hello everyone !
I am creating my own template where I have environments which look like this:
where the background of the environment extends until the limit of the page
This is done by having a block which takes the width + 2*margin inside a move which moves the block on the left by margin:
#let environment(body, name: "Environment", subtitle: none, counter: auto, follows: false, boxed: true, margin: 2.5cm, scheme: light) = [
#v(10pt)
#move(block(
width: 100% + 2*margin,
inset: (left: margin, right: margin, top: 1em, bottom: 1em),
fill: scheme.env.bg,
stroke: (top: scheme.env.stroke, bottom: scheme.env.stroke),
breakable: true,
text(fill: scheme.env.fg)[
#place(
block(
fill: scheme.env.bg,
inset: .4em,
radius: .2em,
stroke: scheme.env.title-stroke,
)[
#text(
name + if counter != none { " " + count(counter, follows) } + if subtitle != none { ":" },
weight: if not follows { "bold" } else { "regular" },
style: if follows { "italic" } else { "normal" },
fill: scheme.env.fg
)
#if cite != none {
subtitle
}
],
dx: -3em, dy: -1.8em
)
#body
]),
dx: -margin)
]
But, this obviously makes the environment unbreakable, which create issues with long proofs:
My ideas on how to solve this would be:
- To have the background being managed by a
#place
, which would be extremely hacky. - To have the page’s margin set to 0 and applying an inset to everything else.
- ???
I wanted to ask the community to see if anyone had any other better solution or tips on how to proceed !