summaryrefslogtreecommitdiff
path: root/tests/typ/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-13 16:51:30 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-13 16:54:05 +0100
commit05c8c6045cd831a98776b418a7b176af8c6ec546 (patch)
treef0c59c273f98d83210c7ed2a01e6c1d81023287e /tests/typ/layout
parent8f68bc7a8ea619af12d95bec7025bd9f3a86625f (diff)
Configurable numbering for nested enums
Diffstat (limited to 'tests/typ/layout')
-rw-r--r--tests/typ/layout/enum-numbering.typ55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/typ/layout/enum-numbering.typ b/tests/typ/layout/enum-numbering.typ
new file mode 100644
index 00000000..1d905f69
--- /dev/null
+++ b/tests/typ/layout/enum-numbering.typ
@@ -0,0 +1,55 @@
+// Test enum numbering styles.
+
+---
+// Test numbering pattern.
+#set enum(numbering: "(1.a.*)")
++ First
++ Second
+ 2. Nested
+ + Deep
++ Normal
+
+---
+// Test full numbering.
+#set enum(numbering: "1.a.", full: true)
++ First
+ + Nested
+
+---
+// Test numbering with closure.
+#enum(
+ start: 3,
+ spacing: 0.65em - 3pt,
+ tight: false,
+ numbering: n => text(
+ fill: (red, green, blue).at(calc.mod(n, 3)),
+ numbering("A", n),
+ ),
+ [Red], [Green], [Blue], [Red],
+)
+
+---
+// Test numbering with closure and nested lists.
+#set enum(numbering: n => super[#n])
++ A
+ + B
++ C
+
+---
+// Test numbering with closure and nested lists.
+#set text("Latin Modern Roman")
+#set enum(numbering: (..args) => math.mat(args.pos()), full: true)
++ A
+ + B
+ + C
+ + D
++ E
++ F
+
+---
+// Error: 22-24 invalid numbering pattern
+#set enum(numbering: "")
+
+---
+// Error: 22-28 invalid numbering pattern
+#set enum(numbering: "(())")