aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-01-20 17:46:35 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2026-01-20 17:47:33 +0100
commitd8522a98c6a1db7a4b240c4d36cfadb59e22304e (patch)
treea3e8b83534d94cdcee6d6ec7e79eb8bfdcadd4b9
parent24179eaf99387417dd618b42a7b3b55414ef7da6 (diff)
feat(typst): callouts
also fix package hierarchy
-rw-r--r--typst/README.md33
-rw-r--r--typst/callout/1.0.0/lib.typ70
-rw-r--r--typst/callout/1.0.0/typst.toml7
-rw-r--r--typst/template/1.0.0/lib.typ (renamed from typst/template.typ)9
-rw-r--r--typst/template/1.0.0/typst.toml7
5 files changed, 119 insertions, 7 deletions
diff --git a/typst/README.md b/typst/README.md
index 2f8dd4c..531a3e9 100644
--- a/typst/README.md
+++ b/typst/README.md
@@ -3,16 +3,18 @@
The version of these scripts will always be `1.0.0`, because using anything else looks like to be too complicated for
anything.
-## `template.typ`
+## `template`
-This template requires:
+This package requires:
- `Inter` as the sans-serif font;
- `PT Astra Serif` as the serif font;
- `FiraCode Nerd Font Mono` as the monospace font.
-These can be freely used.
I may add an option to modify this.
+It is the template that I use everywhere.
+It can be freely used.
+
Import it and load it with:
```typ
// import the script from the local repo
@@ -27,3 +29,28 @@ Import it and load it with:
page_title: "Page title :D",
)
```
+
+## `callout`
+
+This package contains my callouts.
+
+List of callouts:
+- `warning`
+- `defn` (definition)
+- `props` (proposition)
+- `thm` (théorème, which is theorem in French)
+
+Import it and load it with:
+```typ
+// import the script from the local repo
+// if you have modified the repo name, replace `@local` with their name
+#import "@local/callout:1.0.0": *
+```
+
+You can use any callouts with
+```typ
+#defn[
+ Let $f$ a function where:
+ $ forall x in RR, f(x) = x^2 $
+]
+```
diff --git a/typst/callout/1.0.0/lib.typ b/typst/callout/1.0.0/lib.typ
new file mode 100644
index 0000000..5add04a
--- /dev/null
+++ b/typst/callout/1.0.0/lib.typ
@@ -0,0 +1,70 @@
+#let emptyblock((fontcolor, bgcolor), content) = {
+ set par(
+ leading: 0.75em,
+ first-line-indent: 0em,
+ spacing: 1.3em,
+ )
+ set text(fill: fontcolor)
+ block(
+ width: 100%,
+ inset: 1.5em,
+ radius: 0.5em,
+ breakable: false,
+ fill: bgcolor,
+ content
+ )
+}
+
+#let callout(icon, title, title_content, colors, content) = {
+ emptyblock(colors)[
+ #text(size: 1.25em)[#icon~ #strong(title)]
+
+ #content
+ ]
+}
+
+#let warning(body) = {
+ callout(
+ emoji.warning,
+ "Attention",
+ title,
+ (oklch(25%, 35%, 52.55deg), oklch(68.9%, 44%, 52.55deg, 15%)),
+ body,
+ )
+}
+
+#let solution(body) = {
+ callout(emoji.checkmark.box, "Solution",
+ (rgb("#2AA63D"), rgb("#DBFCE7"), rgb("#7AF0A8")),
+ body)
+}
+
+#let defn(body) = {
+ callout(
+ $Delta$,
+ "Définition",
+ title,
+ (oklch(20%, 20%, 247deg), oklch(75%, 25%, 247deg, 40%)),
+ body,
+ )
+}
+
+#let props(body) = {
+ callout(
+ $Pi$,
+ "Proposition",
+ title,
+ (oklch(20%, 20%, 247deg), oklch(85%, 10%, 247deg, 50%)),
+ body,
+ )
+}
+
+#let thm(body) = {
+ callout(
+ $Tau$,
+ "Théorème",
+ title,
+ (oklch(20%, 20%, 220deg), oklch(80%, 25%, 220deg, 40%)),
+ body,
+ )
+}
diff --git a/typst/callout/1.0.0/typst.toml b/typst/callout/1.0.0/typst.toml
new file mode 100644
index 0000000..be0b876
--- /dev/null
+++ b/typst/callout/1.0.0/typst.toml
@@ -0,0 +1,7 @@
+[package]
+name = "callout"
+version = "1.0.0"
+entrypoint = "lib.typ"
+authors = ["Anhgelus Morhtuuzh"]
+license = "MIT"
+description = "My callouts"
diff --git a/typst/template.typ b/typst/template/1.0.0/lib.typ
index 5de1617..be0d931 100644
--- a/typst/template.typ
+++ b/typst/template/1.0.0/lib.typ
@@ -1,11 +1,12 @@
#let doc(authors: (), page_title: [], doc) = {
+ // style
set text(
font: "Inter",
size: 11pt,
)
set par(
leading: 1em,
- first-line-indent: 1em,
+ //first-line-indent: (amount: 1em, all: true),
spacing: 2em,
)
set heading(numbering: "1.")
@@ -16,13 +17,13 @@
// Retrieve the document
// element's title property.
context {
- emph([
+ emph[
#document.title - #authors.first().name
- ])
+ ]
}
),
numbering: "1",
- margin: (x: 2.85cm),
+ margin: (x: 3.5cm),
)
show heading: set par(leading: 0.75em)
diff --git a/typst/template/1.0.0/typst.toml b/typst/template/1.0.0/typst.toml
new file mode 100644
index 0000000..11b0f63
--- /dev/null
+++ b/typst/template/1.0.0/typst.toml
@@ -0,0 +1,7 @@
+[package]
+name = "template"
+version = "1.0.0"
+entrypoint = "lib.typ"
+authors = ["Anhgelus Morhtuuzh"]
+license = "MIT"
+description = "My custom template"