From 1321862cd54eb4abefb5d435285e3de9e0848c4c Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 20 May 2023 21:36:24 +0200 Subject: Footnotes --- tests/ref/meta/cite-footnote.png | Bin 0 -> 58253 bytes tests/ref/meta/footnote-break.png | Bin 0 -> 90355 bytes tests/ref/meta/footnote-container.png | Bin 0 -> 45934 bytes tests/ref/meta/footnote-invariant.png | Bin 0 -> 28671 bytes tests/ref/meta/footnote.png | Bin 0 -> 18782 bytes tests/typ/meta/cite-footnote.typ | 5 +++++ tests/typ/meta/footnote-break.typ | 16 ++++++++++++++++ tests/typ/meta/footnote-container.typ | 32 ++++++++++++++++++++++++++++++++ tests/typ/meta/footnote-invariant.typ | 9 +++++++++ tests/typ/meta/footnote.typ | 34 ++++++++++++++++++++++++++++++++++ 10 files changed, 96 insertions(+) create mode 100644 tests/ref/meta/cite-footnote.png create mode 100644 tests/ref/meta/footnote-break.png create mode 100644 tests/ref/meta/footnote-container.png create mode 100644 tests/ref/meta/footnote-invariant.png create mode 100644 tests/ref/meta/footnote.png create mode 100644 tests/typ/meta/cite-footnote.typ create mode 100644 tests/typ/meta/footnote-break.typ create mode 100644 tests/typ/meta/footnote-container.typ create mode 100644 tests/typ/meta/footnote-invariant.typ create mode 100644 tests/typ/meta/footnote.typ (limited to 'tests') diff --git a/tests/ref/meta/cite-footnote.png b/tests/ref/meta/cite-footnote.png new file mode 100644 index 00000000..067d2c2e Binary files /dev/null and b/tests/ref/meta/cite-footnote.png differ diff --git a/tests/ref/meta/footnote-break.png b/tests/ref/meta/footnote-break.png new file mode 100644 index 00000000..625305c8 Binary files /dev/null and b/tests/ref/meta/footnote-break.png differ diff --git a/tests/ref/meta/footnote-container.png b/tests/ref/meta/footnote-container.png new file mode 100644 index 00000000..9327e7ee Binary files /dev/null and b/tests/ref/meta/footnote-container.png differ diff --git a/tests/ref/meta/footnote-invariant.png b/tests/ref/meta/footnote-invariant.png new file mode 100644 index 00000000..66b41182 Binary files /dev/null and b/tests/ref/meta/footnote-invariant.png differ diff --git a/tests/ref/meta/footnote.png b/tests/ref/meta/footnote.png new file mode 100644 index 00000000..4c67bbd7 Binary files /dev/null and b/tests/ref/meta/footnote.png differ diff --git a/tests/typ/meta/cite-footnote.typ b/tests/typ/meta/cite-footnote.typ new file mode 100644 index 00000000..03984752 --- /dev/null +++ b/tests/typ/meta/cite-footnote.typ @@ -0,0 +1,5 @@ +Hello @netwok +And again: @netwok + +#pagebreak() +#bibliography("/works.bib", style: "chicago-notes") diff --git a/tests/typ/meta/footnote-break.typ b/tests/typ/meta/footnote-break.typ new file mode 100644 index 00000000..9e213aeb --- /dev/null +++ b/tests/typ/meta/footnote-break.typ @@ -0,0 +1,16 @@ +// Test footnotes that break across pages. + +--- +#set page(height: 200pt) + +#lorem(5) +#footnote[ // 1 + A simple footnote. + #footnote[Well, not that simple ...] // 2 +] +#lorem(15) +#footnote[Another footnote: #lorem(30)] // 3 +#lorem(15) +#footnote[My fourth footnote: #lorem(50)] // 4 +#lorem(15) +#footnote[And a final footnote.] // 5 diff --git a/tests/typ/meta/footnote-container.typ b/tests/typ/meta/footnote-container.typ new file mode 100644 index 00000000..fa246162 --- /dev/null +++ b/tests/typ/meta/footnote-container.typ @@ -0,0 +1,32 @@ +// Test footnotes in containers. + +--- +// Test footnote in caption. +Read the docs #footnote[https://typst.app/docs]! +#figure( + image("/graph.png", width: 70%), + caption: [ + A graph #footnote[A _graph_ is a structure with nodes and edges.] + ] +) +More #footnote[just for ...] footnotes #footnote[... testing. :)] + +--- +// Test duplicate footnotes. +#let lang = footnote[Languages.] +#let nums = footnote[Numbers.] + +/ "Hello": A word #lang +/ "123": A number #nums + +- "Hello" #lang +- "123" #nums + ++ "Hello" #lang ++ "123" #nums + +#table( + columns: 2, + [Hello], [A word #lang], + [123], [A number #nums], +) diff --git a/tests/typ/meta/footnote-invariant.typ b/tests/typ/meta/footnote-invariant.typ new file mode 100644 index 00000000..e4d6ded1 --- /dev/null +++ b/tests/typ/meta/footnote-invariant.typ @@ -0,0 +1,9 @@ +// Ensure that a footnote and the first line of its entry +// always end up on the same page. + +--- +#set page(height: 120pt) + +#lorem(13) + +There #footnote(lorem(20)) diff --git a/tests/typ/meta/footnote.typ b/tests/typ/meta/footnote.typ new file mode 100644 index 00000000..8f56fea2 --- /dev/null +++ b/tests/typ/meta/footnote.typ @@ -0,0 +1,34 @@ +// Test footnotes. + +--- +#footnote[Hi] + +--- +// Test space collapsing before footnote. +A#footnote[A] \ +A #footnote[A] + +--- +// Test nested footnotes. +First \ +Second #footnote[A, #footnote[B, #footnote[C]]] \ +Third #footnote[D, #footnote[E]] \ +Fourth + +--- +// Currently, numbers a bit out of order if a nested footnote ends up in the +// same frame as another one. :( +#footnote[A, #footnote[B]], #footnote[C] + +--- +// Test customization. +#show footnote: set text(red) +#show footnote.entry: set text(8pt, style: "italic") +#set footnote.entry( + indent: 0pt, + gap: 0.6em, + clearance: 0.3em, + separator: repeat[.], +) + +Beautiful footnotes. #footnote[Wonderful, aren't they?] -- cgit v1.2.3