Compare commits
9 Commits
81556b418b
...
main
Author | SHA1 | Date | |
---|---|---|---|
63acdd1397
|
|||
1961298f00
|
|||
9af1dcb98b
|
|||
be06465111
|
|||
5235b3a891
|
|||
dccd6c9d6d
|
|||
45a8a53404
|
|||
a1f2ab7982
|
|||
77805c2826
|
BIN
exemple.pdf
Normal file
BIN
exemple.pdf
Normal file
Binary file not shown.
30
exemple.typ
Normal file
30
exemple.typ
Normal file
@ -0,0 +1,30 @@
|
||||
#import "lettre.typ": *
|
||||
#show link: strong
|
||||
|
||||
#show: lettre.with(
|
||||
de: [
|
||||
Ex Péditeur,\
|
||||
12 rue des Sept Nains\
|
||||
12340, Bozouls, France
|
||||
],
|
||||
pour: [
|
||||
Dest I’nataire,\
|
||||
77 avenue du Moulin,\
|
||||
56780, Île aux Moines, Bretagne
|
||||
],
|
||||
objet: "Attestation sur l’honneur",
|
||||
date: "10 septembre 2024",
|
||||
lieu: "Bozouls",
|
||||
introduction: "Monsieur",
|
||||
cloture: "Cordialement,",
|
||||
signature: "Ex P.",
|
||||
post: [
|
||||
#emph("PS: Finalement, rien.")
|
||||
],
|
||||
)
|
||||
|
||||
je soussigné, Ex Péditeur, atteste par la présente sur l’honneur que ce document
|
||||
a été réalisé avec #link("https://typst.app/")[Typst].
|
||||
|
||||
Les sources sont disponibles à l’adresse suivante:
|
||||
#link("https://git.epheme.re/fmouhart/typst-lettre").
|
63
lettre.typ
Normal file
63
lettre.typ
Normal file
@ -0,0 +1,63 @@
|
||||
#let lettre(
|
||||
de: "",
|
||||
pour: "",
|
||||
objet: "",
|
||||
date: "",
|
||||
lieu: "",
|
||||
introduction: "",
|
||||
cloture: "",
|
||||
signature: "",
|
||||
post: "",
|
||||
doc
|
||||
) = {
|
||||
set page(margin: 1.5in)
|
||||
set par(leading: 0.55em, first-line-indent: 2em, justify: true, spacing: 0.55em)
|
||||
set text(font: "Libertinus Serif", size: 12pt)
|
||||
set document(title: objet, author: signature)
|
||||
show raw: set text(font: "Inconsolata")
|
||||
show heading: set block(above: 1.4em, below: 1em)
|
||||
|
||||
let formatLieuDate(lieu, date) = {
|
||||
let isDate = date.trim().len() > 0;
|
||||
let isLieu = lieu.trim().len() > 0;
|
||||
if isLieu [#lieu]
|
||||
if isDate {
|
||||
if isLieu [, ]
|
||||
[le #date]
|
||||
}
|
||||
}
|
||||
|
||||
grid(
|
||||
columns: (2fr, 1fr, 2fr),
|
||||
par(de),
|
||||
text[],
|
||||
text[
|
||||
#formatLieuDate(lieu, date)
|
||||
] + v(2em),
|
||||
text[],
|
||||
text[],
|
||||
par(pour)
|
||||
)
|
||||
v(1em)
|
||||
if objet.trim().len() > 0 {
|
||||
heading(level: 3, text("Objet: " + objet))
|
||||
v(1em)
|
||||
}
|
||||
par(first-line-indent: 0pt, text(introduction + ","))
|
||||
v(1em)
|
||||
doc
|
||||
v(1em)
|
||||
par(first-line-indent: 0pt, text(cloture))
|
||||
v(.7em)
|
||||
grid(
|
||||
columns: (2fr, 1fr),
|
||||
text[],
|
||||
text(signature)
|
||||
)
|
||||
v(1em)
|
||||
post
|
||||
}
|
||||
|
||||
#let er = [#super[er]]
|
||||
#let ème = [#super[ème]]
|
||||
#let no(num) = { text([n°~] + num) }
|
39
readme.md
39
readme.md
@ -1 +1,40 @@
|
||||
A simple template for French letters for typst.
|
||||
|
||||
## Usage
|
||||
|
||||
To create a letter, write a typst document while defining the following
|
||||
parameters, with the [`lettre.typ`](./lettre.typ) file in the same folder:
|
||||
|
||||
```typst
|
||||
#import "lettre.typ": *
|
||||
|
||||
#show: lettre.with(
|
||||
de: [
|
||||
Sender\
|
||||
Address
|
||||
],
|
||||
pour: [
|
||||
Recipient\
|
||||
Address
|
||||
],
|
||||
objet: "subject of the letter", // optional
|
||||
date: "date of sending", // optional
|
||||
lieu: "location", // optional
|
||||
introduction: "opening",
|
||||
cloture: "closing",
|
||||
signature: "signature",
|
||||
post: [
|
||||
post-letter (e.g., post-scriptum)
|
||||
],
|
||||
)
|
||||
```
|
||||
|
||||
Now you can fill the letter afterward, and compile your document with:
|
||||
|
||||
```bash
|
||||
typst compile <filename.typ>
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
An example file is given in the [`exemple.typ`](./exemple.typ) file in the repository.
|
||||
|
Reference in New Issue
Block a user