Compare commits
7 Commits
a1f2ab7982
...
main
Author | SHA1 | Date | |
---|---|---|---|
63acdd1397
|
|||
1961298f00
|
|||
9af1dcb98b
|
|||
be06465111
|
|||
5235b3a891
|
|||
dccd6c9d6d
|
|||
45a8a53404
|
BIN
exemple.pdf
BIN
exemple.pdf
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
#import "lettre.typ": *
|
#import "lettre.typ": *
|
||||||
#show link: strong
|
#show link: strong
|
||||||
|
|
||||||
#show: doc => lettre(
|
#show: lettre.with(
|
||||||
de: [
|
de: [
|
||||||
Ex Péditeur,\
|
Ex Péditeur,\
|
||||||
12 rue des Sept Nains\
|
12 rue des Sept Nains\
|
||||||
@ -21,10 +21,10 @@
|
|||||||
post: [
|
post: [
|
||||||
#emph("PS: Finalement, rien.")
|
#emph("PS: Finalement, rien.")
|
||||||
],
|
],
|
||||||
doc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
je soussigné, Ex Péditeur, atteste par la présente sur l’honneur que ce document
|
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].
|
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").
|
Les sources sont disponibles à l’adresse suivante:
|
||||||
|
#link("https://git.epheme.re/fmouhart/typst-lettre").
|
||||||
|
13
lettre.typ
13
lettre.typ
@ -17,13 +17,22 @@
|
|||||||
show raw: set text(font: "Inconsolata")
|
show raw: set text(font: "Inconsolata")
|
||||||
show heading: set block(above: 1.4em, below: 1em)
|
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(
|
grid(
|
||||||
columns: (2fr, 1fr, 2fr),
|
columns: (2fr, 1fr, 2fr),
|
||||||
par(de),
|
par(de),
|
||||||
text[],
|
text[],
|
||||||
text[
|
text[
|
||||||
#lieu
|
#formatLieuDate(lieu, date)
|
||||||
#if date.trim().len() != 0 [, le #date ]
|
|
||||||
] + v(2em),
|
] + v(2em),
|
||||||
text[],
|
text[],
|
||||||
text[],
|
text[],
|
||||||
|
39
readme.md
39
readme.md
@ -1 +1,40 @@
|
|||||||
A simple template for French letters for typst.
|
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