Refactor handout.typ
Reviewed-on: #7 Co-authored-by: Mark <mark@betalupi.com> Co-committed-by: Mark <mark@betalupi.com>
This commit is contained in:
71
lib/typst/local/handout/0.1.0/header.typ
Normal file
71
lib/typst/local/handout/0.1.0/header.typ
Normal file
@ -0,0 +1,71 @@
|
||||
#import "misc.typ": ored
|
||||
|
||||
#let solution_warning() = {
|
||||
set text(ored)
|
||||
align(
|
||||
center,
|
||||
block(
|
||||
width: 60%,
|
||||
height: auto,
|
||||
breakable: false,
|
||||
fill: rgb(255, 255, 255),
|
||||
stroke: ored + 2pt,
|
||||
inset: 3mm,
|
||||
(
|
||||
align(center, text(weight: "bold", size: 12pt, [Instructor's Handout]))
|
||||
+ parbreak()
|
||||
+ align(
|
||||
left,
|
||||
text(
|
||||
size: 10pt,
|
||||
[
|
||||
This handout contains solutions and notes. \
|
||||
Recompile without solutions before distributing.
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#let make_header(
|
||||
title,
|
||||
subtitle: none,
|
||||
by: none,
|
||||
top_left: "",
|
||||
top_right: "",
|
||||
) = {
|
||||
let date = datetime
|
||||
.today()
|
||||
.display("[month repr:long] [day padding:none], [year]")
|
||||
|
||||
if (by != none) {
|
||||
by = text(size: 10pt, [Prepared by #by on #date])
|
||||
}
|
||||
|
||||
// Main title
|
||||
align(
|
||||
center,
|
||||
block(
|
||||
width: 60%,
|
||||
height: auto,
|
||||
breakable: false,
|
||||
align(
|
||||
center,
|
||||
stack(
|
||||
spacing: 7pt,
|
||||
// Top
|
||||
text(size: 10pt, top_left) + h(1fr) + text(size: 10pt, top_right),
|
||||
line(length: 100%, stroke: 0.2mm),
|
||||
// Title
|
||||
text(size: 20pt, title),
|
||||
// Subtitle
|
||||
if (by != none) { text(size: 10pt, by) },
|
||||
if (subtitle != none) { text(size: 10pt, subtitle) },
|
||||
line(length: 100%, stroke: 0.2mm),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user