Skip to content

Commit e53635e

Browse files
⚡ Linear title margins (#25)
* ⚡ Changed width of title box based on title length * 🎨 Reformatted frontmatter headers * 💄 Reprogrammed page borders * 🐛 Adjusted top and bottom borders for frontmatter and appendix entries * ⚡ Tweaked border size * 🩹 Added a ")" --------- Co-authored-by: BattleCh1cken <BattleCh1cken@larkov.de>
1 parent dbda589 commit e53635e

File tree

3 files changed

+80
-63
lines changed

3 files changed

+80
-63
lines changed

themes/linear/entries.typ

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,50 @@
3535

3636
#let frontmatter-entry(context: (:), body) = {
3737
show: page.with(
38-
//margin: (top: 8em),
3938
header: [
40-
#set align(center)
4139
#set text(size: 25pt)
42-
43-
#context.title
44-
40+
#set line(stroke: 1.5pt)
41+
#align(center + horizon, grid(columns: (1fr, auto, 1fr),
42+
[
43+
#line(length: 100%)
44+
],
45+
[
46+
#h(20pt)
47+
#context.title
48+
#h(20pt)
49+
],
50+
[
51+
#line(length: 100%)
52+
]))
4553
],
46-
background: set-margins(8%, 8%),
4754
)
55+
56+
set-border(context.type)
57+
4858
body
4959
}
5060

5161
#let body-entry(context: (:), body) = {
5262
show: page.with(margin: (top: 88pt),
5363
header: [
54-
#set align(center)
55-
#set text(size: 30pt)
56-
#box(
57-
//baseline: 2pt,
58-
fill: entry-type-metadata.at(context.type),
59-
width: 300pt,
60-
inset: 10pt,
61-
[#context.title],
62-
)
63-
],
64+
#set text(size: 30pt)
65+
#set line(stroke: 1.5pt)
66+
67+
#align(center + horizon, grid(columns: (1fr, auto, 1fr),
68+
[
69+
#line(length: 100%)
70+
],
71+
[
72+
#h(20pt)
73+
#box(fill: entry-type-metadata.at(context.type), outset: 10pt, [#context.title])
74+
#h(20pt)
75+
],
76+
[
77+
#line(length: 100%)
78+
]))
79+
],
6480
footer: [
65-
#grid(
66-
columns: (2fr, 2fr, 1fr),
81+
#grid(columns: (2fr, 2fr, 1fr),
6782
[
6883
Written by: #h(10pt) #context.author
6984
],
@@ -75,7 +90,9 @@
7590
]
7691
)
7792
],
78-
background: set-margins(8%, 8%))
93+
)
94+
95+
set-border(context.type)
7996

8097
show heading: it => {
8198
set-heading(it, context.type)
@@ -97,10 +114,24 @@
97114

98115
#let appendix-entry(context: (:), body) = {
99116
show: page.with(header: [
100-
#set align(center)
101117
#set text(size: 25pt)
102-
#context.title
103-
104-
], background: set-margins(8%, 8%))
118+
#set line(stroke: 1.5pt)
119+
#align(center + horizon, grid(columns: (1fr, auto, 1fr),
120+
[
121+
#line(length: 100%)
122+
],
123+
[
124+
#h(20pt)
125+
#context.title
126+
#h(20pt)
127+
],
128+
[
129+
#line(length: 100%)
130+
]))
131+
]
132+
)
133+
134+
set-border(context.type)
135+
105136
body
106137
}

themes/linear/format.typ

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,35 @@
11
#import "entry-types.typ": *
2-
/// Sets the length and width of the margins
2+
/// Formats the border lines
33
///
44
/// Example Usage:
55
///
66
/// ```typ
7-
/// #set-margins(8%, 15%)
7+
/// #set-border()
88
/// ```
9-
///
10-
/// - x (size, ratio): the distance from the edge of the page to the left and right margins
11-
/// - y (size, ratio): the distance from the edge of the page to the bottom margin
12-
/// -> content
13-
#let set-margins(x, y) = {
9+
#let set-border(type) = {
10+
let top-axis = -8.4% // The title line height
11+
let bottom-axis = 100% // The automatic bottom border
12+
13+
// Adjusts top and bottom borders for frontmatter and appendix entries
14+
if (type == none) {
15+
top-axis = -6.6%
16+
bottom-axis = 106%
17+
}
18+
19+
let left-axis = -8% // 8% less than the automatic left border (0%)
20+
let right-axis = 108% // 8% more than the automatic right border (100%)
21+
1422
set line(stroke: 1.5pt)
15-
// TL: top left
16-
// TR: top right
17-
let border-TL = 0% + 15%
18-
let border-TR = 100% - 15%
19-
place(
20-
// Left border line
21-
line(start: (0% + x, 5%), end: (0% + x, 100% - y)),
22-
)
23-
place(
24-
// Right border line
25-
line(start: (100% - x, 5%), end: (100% - x, 100% - y)),
26-
)
27-
place(
28-
// Bottom border line
29-
line(start: (0% + x, 100% - y), end: (100% - x, 100% - y)),
30-
)
31-
place(
32-
// TL border line -> ——
33-
line(start: (0% + x, 5%), end: (border-TL + x, 5%)),
34-
)
35-
place(
36-
// TR border line -> ——
37-
line(start: (100% - x, 5%), end: (border-TR - x, 5%)),
38-
)
39-
place(
40-
// TL border line -> ︱
41-
line(start: (border-TL + x, 4%), end: (border-TL + x, 6%)),
42-
)
43-
place(
44-
// TR border line -> ︱
45-
line(start: (border-TR - x, 4%), end: (border-TR - x, 6%)),
46-
)
23+
// Top left border
24+
place(line(start: (left-axis, top-axis), end: (0%, top-axis)))
25+
// Top right border
26+
place(line(start: (right-axis, top-axis), end: (100%, top-axis)))
27+
// Left border
28+
place(line(start: (left-axis, top-axis), end: (left-axis, bottom-axis)))
29+
// Right border
30+
place(line(start: (right-axis, top-axis), end: (right-axis, bottom-axis)))
31+
// Bottom border
32+
place(line(start: (left-axis, bottom-axis), end: (right-axis, bottom-axis)))
4733
}
4834

4935
#let set-heading(it, type) = {

themes/linear/linear.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import "rules.typ": rules
22
#import "entries.typ": cover, frontmatter-entry, body-entry, appendix-entry
3-
#import "format.typ": set-margins, set-heading
3+
#import "format.typ": set-border, set-heading
44
#import "components/components.typ"
55
#import "colors.typ": *
66

0 commit comments

Comments
 (0)