Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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/tud-letter/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Hugo Ledoux

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.
49 changes: 49 additions & 0 deletions packages/preview/tud-letter/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# tud-letter

A Typst template that (more or less) replicates the [TUDelft letter](https://www.tudelft.nl/huisstijl/) (only available in Word).
It also makes it more beautiful IMO, but hey I guess it's subjective...

By default it's in English and the faculty name is my faculty... but you can modify it, see the example.
You can also put `lang: "nl"` so that the fields top-left are in Dutch.

## How to use it?

You can compile the example letter with this command:

`typst compile --root . template/letter.typ`

Notice that you can also install the package manually to your local Typst, see instruction there:
<https://github.com/typst/packages?tab=readme-ov-file#local-packages>


## Example

```typst
#import "../src/lib.typ": *

#show: tud-letter.with(
from: (
name: "Jan Smit",
phone: "+31 (0)15 27 12345",
email: "j.smit@tudelft.nl",
),
to: [
Gerard Joling \
Singer of the year \
],
date: datetime.today().display(),
subject: "A very important letter",
)

Dear Gerard,

#lorem(60)

#lorem(100)

#v(1cm)
Best regards,
#v(3mm)
Dr Jan Smit \
Head of an important department
```
224 changes: 224 additions & 0 deletions packages/preview/tud-letter/0.1.0/assets/tudlogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions packages/preview/tud-letter/0.1.0/src/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#let tud-letter(
from: "",
to: "",
date: datetime.today().display(),
subject: "",
lang: "en",
faculty: (
name: "Faculty of Architecture and the Built Environment",
address: (
(
what: "address",
value: [Julianalaan 134 \ Delft 2628BL \ the Netherlands],
),
),
),
body,
) = {

let body-font = "Source Sans Pro"

let tags = (
thedate: "date",
thecontact: "contact",
theemail: "email",
thephone: "phone",
thesubject: "subject",
)
if lang == "nl" {
tags = (
thedate: "datum",
thecontact: "contact",
theemail: "email",
thephone: "telefoon",
thesubject: "onderwerp",
)
}

set text(
font: body-font,
size: 11pt,
)
set par(justify: true)

set page(
paper: "a4",
margin: (
top: 12mm,
bottom: 2cm,
left: 3cm,
right: 3cm
),
background: {
// folding mark 1
place(top + left, dx: 5mm, dy: 105mm, line(
length: 2.5mm,
stroke: 0.25pt + black
))
// folding mark 2
place(top + left, dx: 5mm, dy: 210mm, line(
length: 2.5mm,
stroke: 0.25pt + black
))
},
footer: context [
#set align(right)
#set text(luma(80), 9pt)
Page
#counter(page).display(
"1 of 1",
both: true,
)
],
number-align: center,
)


grid(
columns: (10cm, auto),
gutter: 8pt,
align: (top, bottom),
grid(
columns: (-3mm, 10cm),
gutter: 8pt,
align: (right, left),
text(size: 9pt, luma(80), raw(tags.thedate)), text(size: 9pt, date),
text(size: 9pt, luma(80), raw(tags.thecontact)), text(size: 9pt, from.name),
text(size: 9pt, luma(80), raw(tags.theemail)), text(size: 9pt, link(from.email)),
text(size: 9pt, luma(80), raw(tags.thephone)), text(size: 9pt, from.phone),
text(size: 9pt, luma(80), raw(tags.thesubject)), text(size: 9pt, subject),
),
image("../assets/tudlogo.svg", width: 144%)
)

v(2cm)

grid(
columns: (10cm, auto),
gutter: 10pt,
to,
[
*#faculty.name* \
\
#for a in faculty.address {
[
#text(size: 9pt, luma(80), a.what) \
#a.value
]
v(2mm)
}
]
)

v(2cm)

body
}
42 changes: 42 additions & 0 deletions packages/preview/tud-letter/0.1.0/template/letter.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#import "@preview/tud-letter:0.1.0": *
// #import "../src/lib.typ": *

#show: tud-letter.with(
// lang: "nl",
from: (
name: "Jan Smit",
phone: "+31 (0)15 27 12345",
email: "j.smit@tudelft.nl",
),
to: [
Gerard Joling \
Singer of the year \
],
date: datetime.today().display(),
subject: "A very important letter",
// faculty: (
// name: "Faculteit Bouwkunde",
// address: (
// (
// what: "bezoek",
// value: [Julianalaan 134 \ Delft 2628BL],
// ),
// (
// what: "correspondentie",
// value: [Postbus 5043 \ 2600 GA Delft],
// ),
// ),
// ),
)

Dear Gerard,

#lorem(60)

#lorem(100)

#v(1cm)
Best regards,
#v(3mm)
Dr Jan Smit \
Head of an important department
Binary file added packages/preview/tud-letter/0.1.0/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions packages/preview/tud-letter/0.1.0/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
entrypoint = "src/lib.typ"
name = "tud-letter"
version = "0.1.0"
compiler = "0.13.0"
authors = ["Hugo Ledoux <@hugoledoux>"]
repository = "https://github.com/hugoledoux/tudletter"
description = "A Typst template that (almost?) replicates the TUDelft letter"
keywords = ["TU Delft", "letter"]
license = "MIT"
categories = ["office"]

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