Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/bananote/0.1.1/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Alexander Koller

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions packages/preview/bananote/0.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Bananote

This is a template for research notes with Typst.
It is intended for quickly writing down a research idea,
with a clean visual look that other people will enjoy looking at.

The style has splashes of yellow, inspired by the [Dagstuhl LIPIcs style](https://submission.dagstuhl.de/documentation/authors).


## Usage

Import bananote and populate the header with the title and authors, as follows.

```
#import "@preview/bananote:0.1.1": *

#show: note.with(
title: [My Research Note],
authors: (
([My Name], [My Affiliation]),
),
)

#abstract[
Here's an abstract.
]

Here's the text of your note.
```

The `authors` field wants an array of authors. Each author can be an array of the form (author, affiliation), or just some content that will be typeset as the author name.

Bananote supports some optional arguments for the `note` function:

- `date`: By default, Bananote prints the compilation date in the top right of the header. You can change the date that should be printed here (as a Typst [datetime](https://typst.app/docs/reference/foundations/datetime/) object), or pass `none` to suppress the date.
- `version`: This will be printed below the date as "Version #version".
- `highlight-by`: Bananote will typeset citations of the authors' own papers in green, rather than blue. More specifically, pass either a string or an array of strings in this argument. Papers will be cited in green if the last name of one of the authors matches one of the strings given to `highlight-by`. By default, no authors will be highlighted.

Bananote comes with a nice configuration of [Pergamon](https://typst.app/universe/package/pergamon). If you import Pergamon, you can use Pergamon's usual citation commands. You can print the bibliography using `print-bananote-bibliography()`.


## Fonts

Bananote typesets headings and the title in [New Computer Modern Sans](https://www.tug.org/FontCatalogue/newcomputermodernsansserif/) if possible, as a callback to the [Koma-Script article classes](https://www.tug.org/FontCatalogue/newcomputermodernsansserif/) in LaTeX.

New Computer Modern Sans is automatically available in the Typst web app. If you want to use it offline, [download it from here](https://www.ctan.org/tex-archive/fonts/newcomputermodern) and [make it available to Typst](https://typst.app/docs/reference/text/text/#parameters-font).


## Example

<img src="https://github.com/coli-saar/bananote/blob/main/template/thumbnail.png" width=500px border=1px />
153 changes: 153 additions & 0 deletions packages/preview/bananote/0.1.1/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

// This style is for internal research notes.
// It is modeled roughly after the Dagstuhl LIPIcs style, https://submission.dagstuhl.de/documentation/authors

#import "@preview/pergamon:0.6.0": *

#let sans = ("New Computer Modern Sans", "Libertinus Serif")
#let sans-weight = 800
#let serif = "Libertinus Serif"

#let text-size = 11pt

#let darkgreen = green.darken(20%)
#let darkblue = blue.darken(20%)

#let fcite = format-citation-authoryear()
#let fref = format-reference(
name-format: "{given} {family}",
format-quotes: it => it,
print-date-after-authors: true,
reference-label: fcite.reference-label,
suppress-fields: (
"*": ("month", "day",),
"inproceedings": ("editor", "publisher", "pages", "location")
),
eval-scope: ("todo": x => text(fill: red, x)),
bibstring: ("in": "In"),
bibstring-style: "long",
)

#let print-bananote-bibliography() = {
print-bibliography(
format-reference: fref,
sorting: "nyt",
label-generator: fcite.label-generator,
)
}

#let note(
title: none,
authors: (),
date: datetime.today(),
version: none,
highlight-by: (),
banana-color: yellow,
doc
) = {
set text(font: serif, size: text-size)
set page(margin: (x: 2.5cm, y: 3cm), numbering: "1")
set par(first-line-indent: 0em, spacing: 1.4em, justify: true, leading: 0.7em)

// TITLE AND AUTHORS
if title != none {
text(font: sans, size: 17pt, weight: sans-weight, title)
parbreak()
}

for (i, author) in authors.enumerate() {
let name = if type(author) == array { author.at(0) } else { author }
let affiliation = if type(author) == array and author.len() > 1 { author.at(1) } else { "" }


text(size: text-size, weight: "bold", name)
if i == 0 and date != none {
h(1fr)
date.display("[day] [month repr:long] [year]")
}

if affiliation == none and i > 1 and version == none [
] else {
linebreak()
affiliation
if i == 0 and version != none {
h(1fr)
[Version #version]
}
}
parbreak()
}

// FORMAT HEADINGS
set heading(numbering: "1.1 ")
let heading-size = 12pt
show heading.where(level: 1): it => {
v(2em, weak: true)

block(below: 1em)[ // block ensures that title and yellow box stay together on pagebreaks
#place(dx:-3mm-2em, dy:-3.5pt)[
#box(width: 2em)[
#context {
align(right)[
#box(fill: banana-color, width: 1em, height: 1em)[
#if it.numbering != none {
align(center+horizon,
text(font: sans, weight: sans-weight, size: heading-size, [#counter(heading).get().first()])
)
}
]
]
}
]
]

#text(font: sans, weight: sans-weight, size: heading-size, it.body)
]
// v(-0.2em)
}

show heading.where(level: 2): set text(font: sans, weight: sans-weight, size: heading-size)
show heading.where(level: 2): set block(below: 1em, above: 2em)
show heading.where(level: 3): set text(font: sans, weight: sans-weight)
show heading.where(level: 4): it => text(font: sans, weight: sans-weight, size: text-size)[*#it.body.*]


// PERGAMON
let maybe-highlight(reference) = {
if type(highlight-by) == array {
highlight-by.any(name => name in family-names(reference.fields.labelname))
} else {
highlight-by in family-names(reference.fields.labelname)
}
}

show link: set text(darkblue) // for non-citations
show ref: set text(darkblue)
show link: it => if-citation(it, value => {
let color = if maybe-highlight(value.reference) { darkgreen } else { darkblue }
set text(fill: color)
it
})


refsection(format-citation: fcite.format-citation, doc)
}

#let abstract(abstr) = {
v(2em)
block[
#line(length: 100%)
#place(dx: 2em, dy: -1em, box(
fill: white,
inset: 6pt,
text(font: sans, weight: sans-weight)[Abstract]
))
]
v(-0.2em)

abstr

v(-0.1em)
line(length: 100%)
v(0.5em)
}
36 changes: 36 additions & 0 deletions packages/preview/bananote/0.1.1/template/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

#import "@preview/bananote:0.1.1": *
#import "@preview/pergamon:0.6.0": *


#show: note.with(
title: [My Research Note],
authors: (([My Name], [My Affiliation]),)
)

#abstract[
#lorem(50)
]



= Introduction

#lorem(50)

== Subsection

#lorem(50)


= Another Section

#lorem(50)


// Uncomment this to typeset the bibliography:
// #add-bib-resource(read("bibliography.bib"))
// #print-bananote-bibliography()



Binary file added packages/preview/bananote/0.1.1/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions packages/preview/bananote/0.1.1/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "bananote"
version = "0.1.1"
compiler = "0.12.0"
entrypoint = "lib.typ"
authors = ["Alexander Koller <https://www.coli.uni-saarland.de/~koller/>"]
license = "MIT"
description = "Nice template for research notes with splashes of yellow."
repository = "https://github.com/coli-saar/bananote"
categories = ["paper"]
disciplines = ["computer-science", "linguistics"]

[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "thumbnail.png"