typst-env/templates/letter.typ

81 lines
1.8 KiB
Plaintext
Raw Normal View History

2023-12-13 11:55:12 +00:00
#let din5008(
returnaddr: none,
recipient: none,
recipientnote: none,
information: none,
header: none,
footer: none,
footermargin: none,
body,
) = {
let combinedfooter = stack(dir: ttb, spacing: 1in / 6, align(right, locate(loc => [
Seite #counter(page).display() von #counter(page).final(loc).at(0)
])), footer)
set page(
paper: "a4",
footer: combinedfooter,
footer-descent: 1in / 6,
header: header,
margin: (
top: 27mm,
left: 25mm,
right: 20mm,
bottom: if footermargin != none { footermargin } else { 35mm },
),
)
for item in (
(ref: top + left, dx: -25mm, dy: 60mm, len: 4mm),
(ref: top + right, dx: 20mm, dy: 60mm, len: 4mm),
(ref: bottom + left, dx: -25mm, dy: -80mm, len: 4mm),
(ref: bottom + right, dx: 20mm, dy: -80mm, len: 4mm),
(ref: top + left, dx: -25mm, dy: 121.5mm, len: 10mm),
) {
place(item.ref, dx: item.dx, dy: item.dy, line(length: item.len))
}
grid(
columns: 1,
rows: (60mm, auto),
gutter: 1in / 3,
rect(width: 100%, height: 100%, stroke: none, {
place(
top + left,
dx: 0mm,
dy: 0mm,
rect(height: 45mm, width: 80mm, stroke: none, grid(
columns: 1,
rows: (5mm, 12.7mm, 27.3mm),
text(8pt)[#returnaddr],
recipientnote,
recipient,
)),
)
place(
top + left,
dx: 100mm,
dy: 5mm,
rect(width: 75mm, stroke: none, information),
)
}),
body,
)
}
#let signature(image: none, width: 30%, name) = {
block(
width: width,
stack(
dir: ttb,
spacing: 5pt,
if image == none {
rect(stroke: (bottom: 1pt + black, rest: none), height: 20pt, width: 100%)
} else {
image
},
name,
),
)
}