summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorlolstork <137357423+lolstork@users.noreply.github.com>2023-07-06 09:38:04 +0200
committerGitHub <noreply@github.com>2023-07-06 09:38:04 +0200
commit286dec3f0ad633683c238b33d573017f740ccb5a (patch)
treed78f3e3ccd4bf26434fc091c482ef5991905ca5c /crates
parenta4756d8576199eaee7cc82ed2a15689d94617798 (diff)
Make default margin behavior more precise (#1666)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-library/src/layout/page.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/typst-library/src/layout/page.rs b/crates/typst-library/src/layout/page.rs
index 3b81f92c..a4324b0c 100644
--- a/crates/typst-library/src/layout/page.rs
+++ b/crates/typst-library/src/layout/page.rs
@@ -90,8 +90,9 @@ pub struct PageElem {
/// The page's margins.
///
+ /// - `{auto}`: The margins are set automatically to 2.5/21 times the smaller
+ /// dimension of the page. This results in 2.5cm margins for an A4 page.
/// - A single length: The same margin on all sides.
- /// - `{auto}`: The margin is set to the default value for the page's size.
/// - A dictionary: With a dictionary, the margins can be set individually.
/// The dictionary can contain the following keys in order of precedence:
/// - `top`: The top margin.
@@ -325,7 +326,7 @@ impl PageElem {
}
// Determine the margins.
- let default = Rel::<Length>::from(0.1190 * min);
+ let default = Rel::<Length>::from((2.5 / 21.0) * min);
let margin = self.margin(styles);
let two_sided = margin.two_sided.unwrap_or(false);
let margin = margin