From 89f2e71852e96062ea9b756bf92fbf4e894871b1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 17 Nov 2021 17:09:19 +0100 Subject: Align node --- tests/typ/layout/align.typ | 21 +++++++++++++++++++++ tests/typ/layout/containers.typ | 21 --------------------- tests/typ/layout/grid-1.typ | 3 +-- tests/typ/layout/grid-3.typ | 4 ++-- tests/typ/layout/grid-5.typ | 13 +++++++------ tests/typ/layout/page.typ | 8 ++++---- 6 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 tests/typ/layout/align.typ (limited to 'tests/typ/layout') diff --git a/tests/typ/layout/align.typ b/tests/typ/layout/align.typ new file mode 100644 index 00000000..1454542a --- /dev/null +++ b/tests/typ/layout/align.typ @@ -0,0 +1,21 @@ +// Test alignment. + +--- +#page(height: 100pt) +#stack(dir: ltr, + align(left, square(size: 15pt, fill: eastern)), + align(center, square(size: 20pt, fill: eastern)), + align(right, square(size: 15pt, fill: eastern)), +) +#align(center, center, rect(fill: eastern, height: 10pt)) +#align(bottom, stack( + align(center, rect(fill: conifer, height: 10pt)), + rect(fill: forest, height: 10pt), +)) + +--- +#align(center)[ + Lorem Ipsum + + Dolor +] diff --git a/tests/typ/layout/containers.typ b/tests/typ/layout/containers.typ index b2835b5e..d4556a0f 100644 --- a/tests/typ/layout/containers.typ +++ b/tests/typ/layout/containers.typ @@ -19,24 +19,3 @@ First! But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. ] - ---- -// Test shrink-to-fit vs expand. - -// Top-level paragraph fills page -L #align(right)[R] - -// Block also fills page. -#block[ - L #align(right)[R] -] - -// Boxed paragraph respects width. -#box(width: 50pt)[ - L #align(right)[R] -] - -// Boxed paragraph without width doesn't expand. -#box[ - L #align(right)[R] -] diff --git a/tests/typ/layout/grid-1.typ b/tests/typ/layout/grid-1.typ index afd01a5f..2d13452b 100644 --- a/tests/typ/layout/grid-1.typ +++ b/tests/typ/layout/grid-1.typ @@ -34,11 +34,10 @@ --- #page(height: 3cm, margins: 0pt) -#align(center) #grid( columns: (1fr,), rows: (1fr, auto, 2fr), [], - [A bit more to the top], + align(center)[A bit more to the top], [], ) diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ index 82472e55..6f7f6977 100644 --- a/tests/typ/layout/grid-3.typ +++ b/tests/typ/layout/grid-3.typ @@ -24,7 +24,7 @@ row-gutter: 10pt, column-gutter: (0pt, 10%), align(top, image("../../res/rhino.png")), - align(right, rect(width: 100%, fill: eastern)[LoL]), + align(top, rect(fill: eastern, align(right)[LoL])), [rofl], [\ A] * 3, [Ha!\ ] * 3, @@ -55,7 +55,7 @@ column-gutter: (0pt, 10%), [A], [B], [C], [D], grid(columns: 2, [A], [B], [C\ ]*3, [D]), - align(right, rect(width: 100%, fill: eastern)[LoL]), + align(top, rect(fill: eastern, align(right)[LoL])), [rofl], [E\ ]*4, ) diff --git a/tests/typ/layout/grid-5.typ b/tests/typ/layout/grid-5.typ index 18736b90..585fc6ce 100644 --- a/tests/typ/layout/grid-5.typ +++ b/tests/typ/layout/grid-5.typ @@ -16,13 +16,14 @@ #grid( columns: 2, gutter: 10pt, - [#align(bottom) A], + align(bottom)[A], [ Top - #align(bottom) - Bottom \ - Bottom \ - Top + #align(bottom)[ + Bottom \ + Bottom \ + Top + ] ], - [#align(top) B], + align(top)[B], ) diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 315680a6..1d2fdb62 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -15,10 +15,10 @@ // Set individual margins. #page(height: 40pt) -[#page(left: 0pt) #align(left) Left] -[#page(right: 0pt) #align(right) Right] -[#page(top: 0pt) #align(top) Top] -[#page(bottom: 0pt) #align(bottom) Bottom] +[#page(left: 0pt) #align(left)[Left]] +[#page(right: 0pt) #align(right)[Right]] +[#page(top: 0pt) #align(top)[Top]] +[#page(bottom: 0pt) #align(bottom)[Bottom]] // Ensure that specific margins override general margins. [#page(margins: 0pt, left: 20pt) Overriden] -- cgit v1.2.3