From 286dec3f0ad633683c238b33d573017f740ccb5a Mon Sep 17 00:00:00 2001 From: lolstork <137357423+lolstork@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:38:04 +0200 Subject: [PATCH] Make default margin behavior more precise (#1666) --- crates/typst-library/src/layout/page.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/typst-library/src/layout/page.rs b/crates/typst-library/src/layout/page.rs index 3b81f92c1..a4324b0c7 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::::from(0.1190 * min); + let default = Rel::::from((2.5 / 21.0) * min); let margin = self.margin(styles); let two_sided = margin.two_sided.unwrap_or(false); let margin = margin