Initial commit
This commit is contained in:
commit
940f1f64b2
10 changed files with 406 additions and 0 deletions
69
environment.typ
Normal file
69
environment.typ
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#import "palette.typ": *
|
||||
|
||||
#let envc = counter("environment")
|
||||
|
||||
#let count(counter, follows) = {
|
||||
let c = counter;
|
||||
if c == auto {
|
||||
c = envc;
|
||||
}
|
||||
|
||||
if type(c) == str {
|
||||
c
|
||||
} else if not follows {
|
||||
c.step()
|
||||
context c.display()
|
||||
} else {
|
||||
context c.display()
|
||||
}
|
||||
}
|
||||
|
||||
#let environment(body, name: "Environment", subtitle: none, counter: auto, follows: false, boxed: true, margin: 2.5cm, scheme: light) = [
|
||||
#v(10pt)
|
||||
|
||||
// #v(margin + 2pt)
|
||||
|
||||
#pad(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
|
||||
]),
|
||||
left: -margin,
|
||||
right: margin)
|
||||
// top: -margin - 2pt,
|
||||
// bottom: -margin - 2pt)
|
||||
|
||||
// #v(margin + 2pt)
|
||||
]
|
||||
|
||||
#let environment_(body, name: "Environment", counter: auto, follows: false, boxed: true, margin: 2.5cm, scheme: light) = {
|
||||
scheme.env.insert("bg", scheme.bg)
|
||||
scheme.env.insert("title-stroke", none)
|
||||
scheme.env.insert("stroke", scheme.env.sub-stroke)
|
||||
|
||||
environment(body, name: name, counter: counter, follows: follows, boxed: boxed, margin: margin, scheme: scheme)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue