Skip to content

Commit 659a161

Browse files
committed
core: Use correct side for top margin calculation
The fallback to the smaller page should only occure when the margin is `auto`, but unconditionally used the smaller page beforehand. Closes #31.
1 parent 600615c commit 659a161

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

src/core.typ

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// `+ 0%` forces this to be a relative length
3030
margin = util.auto-or(margin, () => (2.5 / 21) * min) + 0%
31-
margin.length.to-absolute() + (min * margin.ratio)
31+
margin.length.to-absolute() + (height * margin.ratio)
3232
}
3333

3434
/// #property(requires-context: true)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# generated by tytanic, do not edit
2+
3+
diff/**
4+
out/**
47.5 KB
Loading
87 KB
Loading
87 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// Synopsis:
2+
/// - Tracked in #31.
3+
/// - The smallest page should only be used for the `2.5 / 21` fallback.
4+
5+
#import "/src/lib.typ": hydra
6+
7+
#set page(
8+
paper: "a4",
9+
margin: (top: 10%),
10+
header: context hydra(1, skip-starting: false),
11+
)
12+
13+
#show heading.where(level: 1): it => pagebreak(weak: true) + it
14+
15+
= Chapter 1
16+
#lorem(100)
17+
18+
= Chapter 2
19+
#lorem(200)
20+
21+
= Chapter 3
22+
#lorem(200)

0 commit comments

Comments
 (0)