|
| 1 | + |
| 2 | +// This style is for internal research notes. |
| 3 | +// It is modeled roughly after the Dagstuhl LIPIcs style, https://submission.dagstuhl.de/documentation/authors |
| 4 | + |
| 5 | +#import "@preview/pergamon:0.6.0": * |
| 6 | + |
| 7 | +#let sans = ("New Computer Modern Sans", "Libertinus Serif") |
| 8 | +#let sans-weight = 800 |
| 9 | +#let serif = "Libertinus Serif" |
| 10 | + |
| 11 | +#let text-size = 11pt |
| 12 | + |
| 13 | +#let darkgreen = green.darken(20%) |
| 14 | +#let darkblue = blue.darken(20%) |
| 15 | + |
| 16 | +#let fcite = format-citation-authoryear() |
| 17 | +#let fref = format-reference( |
| 18 | + name-format: "{given} {family}", |
| 19 | + format-quotes: it => it, |
| 20 | + print-date-after-authors: true, |
| 21 | + reference-label: fcite.reference-label, |
| 22 | + suppress-fields: ( |
| 23 | + "*": ("month", "day",), |
| 24 | + "inproceedings": ("editor", "publisher", "pages", "location") |
| 25 | + ), |
| 26 | + eval-scope: ("todo": x => text(fill: red, x)), |
| 27 | + bibstring: ("in": "In"), |
| 28 | + bibstring-style: "long", |
| 29 | +) |
| 30 | + |
| 31 | +#let print-bananote-bibliography() = { |
| 32 | + print-bibliography( |
| 33 | + format-reference: fref, |
| 34 | + sorting: "nyt", |
| 35 | + label-generator: fcite.label-generator, |
| 36 | + ) |
| 37 | +} |
| 38 | + |
| 39 | +#let note( |
| 40 | + title: none, |
| 41 | + authors: (), |
| 42 | + date: datetime.today(), |
| 43 | + version: none, |
| 44 | + highlight-by: (), |
| 45 | + banana-color: yellow, |
| 46 | + doc |
| 47 | +) = { |
| 48 | + set text(font: serif, size: text-size) |
| 49 | + set page(margin: (x: 2.5cm, y: 3cm), numbering: "1") |
| 50 | + set par(first-line-indent: 0em, spacing: 1.4em, justify: true, leading: 0.7em) |
| 51 | + |
| 52 | + // TITLE AND AUTHORS |
| 53 | + if title != none { |
| 54 | + text(font: sans, size: 17pt, weight: sans-weight, title) |
| 55 | + parbreak() |
| 56 | + } |
| 57 | + |
| 58 | + for (i, author) in authors.enumerate() { |
| 59 | + let name = if type(author) == array { author.at(0) } else { author } |
| 60 | + let affiliation = if type(author) == array and author.len() > 1 { author.at(1) } else { "" } |
| 61 | + |
| 62 | + |
| 63 | + text(size: text-size, weight: "bold", name) |
| 64 | + if i == 0 and date != none { |
| 65 | + h(1fr) |
| 66 | + date.display("[day] [month repr:long] [year]") |
| 67 | + } |
| 68 | + |
| 69 | + if affiliation == none and i > 1 and version == none [ |
| 70 | + ] else { |
| 71 | + linebreak() |
| 72 | + affiliation |
| 73 | + if i == 0 and version != none { |
| 74 | + h(1fr) |
| 75 | + [Version #version] |
| 76 | + } |
| 77 | + } |
| 78 | + parbreak() |
| 79 | + } |
| 80 | + |
| 81 | + // FORMAT HEADINGS |
| 82 | + set heading(numbering: "1.1 ") |
| 83 | + let heading-size = 12pt |
| 84 | + show heading.where(level: 1): it => { |
| 85 | + v(2em, weak: true) |
| 86 | + |
| 87 | + block(below: 1em)[ // block ensures that title and yellow box stay together on pagebreaks |
| 88 | + #place(dx:-3mm-2em, dy:-3.5pt)[ |
| 89 | + #box(width: 2em)[ |
| 90 | + #context { |
| 91 | + align(right)[ |
| 92 | + #box(fill: banana-color, width: 1em, height: 1em)[ |
| 93 | + #if it.numbering != none { |
| 94 | + align(center+horizon, |
| 95 | + text(font: sans, weight: sans-weight, size: heading-size, [#counter(heading).get().first()]) |
| 96 | + ) |
| 97 | + } |
| 98 | + ] |
| 99 | + ] |
| 100 | + } |
| 101 | + ] |
| 102 | + ] |
| 103 | + |
| 104 | + #text(font: sans, weight: sans-weight, size: heading-size, it.body) |
| 105 | + ] |
| 106 | + // v(-0.2em) |
| 107 | + } |
| 108 | + |
| 109 | + show heading.where(level: 2): set text(font: sans, weight: sans-weight, size: heading-size) |
| 110 | + show heading.where(level: 2): set block(below: 1em, above: 2em) |
| 111 | + show heading.where(level: 3): set text(font: sans, weight: sans-weight) |
| 112 | + show heading.where(level: 4): it => text(font: sans, weight: sans-weight, size: text-size)[*#it.body.*] |
| 113 | + |
| 114 | + |
| 115 | + // PERGAMON |
| 116 | + let maybe-highlight(reference) = { |
| 117 | + if type(highlight-by) == array { |
| 118 | + highlight-by.any(name => name in family-names(reference.fields.labelname)) |
| 119 | + } else { |
| 120 | + highlight-by in family-names(reference.fields.labelname) |
| 121 | + } |
| 122 | + } |
| 123 | + |
| 124 | + show link: set text(darkblue) // for non-citations |
| 125 | + show ref: set text(darkblue) |
| 126 | + show link: it => if-citation(it, value => { |
| 127 | + let color = if maybe-highlight(value.reference) { darkgreen } else { darkblue } |
| 128 | + set text(fill: color) |
| 129 | + it |
| 130 | + }) |
| 131 | + |
| 132 | + |
| 133 | + refsection(format-citation: fcite.format-citation, doc) |
| 134 | +} |
| 135 | + |
| 136 | +#let abstract(abstr) = { |
| 137 | + v(2em) |
| 138 | + block[ |
| 139 | + #line(length: 100%) |
| 140 | + #place(dx: 2em, dy: -1em, box( |
| 141 | + fill: white, |
| 142 | + inset: 6pt, |
| 143 | + text(font: sans, weight: sans-weight)[Abstract] |
| 144 | + )) |
| 145 | + ] |
| 146 | + v(-0.2em) |
| 147 | + |
| 148 | + abstr |
| 149 | + |
| 150 | + v(-0.1em) |
| 151 | + line(length: 100%) |
| 152 | + v(0.5em) |
| 153 | +} |
0 commit comments