hachem.wtf
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-18 12:16:44 +0200
committerhachem <im@hachem.wtf>2026-09-18 12:16:44 +0200
commitab2774b23c66521e13541ab3e361bba95c394a8a (patch)
tree8b06b5f2d15a2225f558202c9aaefd20dff8e6b4
feat: add paper template
-rw-r--r--LICENSE21
-rw-r--r--Makefile20
-rw-r--r--README.md7
-rw-r--r--lib.typ1
-rw-r--r--templates/paper.typ82
-rw-r--r--typst.toml7
6 files changed, 138 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..135a148
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 hachem
+
+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.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4512b74
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+NAME := mktypst
+VERSION := 0.1.0
+
+ifeq ($(shell uname),Darwin)
+DATADIR := $(HOME)/Library/Application Support
+else
+DATADIR := $(if $(XDG_DATA_HOME),$(XDG_DATA_HOME),$(HOME)/.local/share)
+endif
+
+PKGDIR := $(DATADIR)/typst/packages/local/$(NAME)/$(VERSION)
+
+install:
+ mkdir -p "$(PKGDIR)"
+ cp typst.toml lib.typ README.md LICENSE "$(PKGDIR)"/
+ cp -r templates "$(PKGDIR)"/
+
+uninstall:
+ rm -rf "$(DATADIR)/typst/packages/local/$(NAME)/$(VERSION)"
+
+.PHONY: install uninstall
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cca2628
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# mktypst
+
+Just a couple of dumb Typst templates so I stop rewriting the same document setup every fucking time.
+
+## License
+
+`mktypst` is licensed under the MIT License. See [LICENSE](LICENSE) for more.
diff --git a/lib.typ b/lib.typ
new file mode 100644
index 0000000..7b3212c
--- /dev/null
+++ b/lib.typ
@@ -0,0 +1 @@
+#import "templates/paper.typ": paper
diff --git a/templates/paper.typ b/templates/paper.typ
new file mode 100644
index 0000000..c7658ec
--- /dev/null
+++ b/templates/paper.typ
@@ -0,0 +1,82 @@
+#let paper-title(title, date) = [
+ #place(top + center, float: true)[
+ #block(width: 100%)[
+ #align(center)[
+ #text(size: 18pt)[#smallcaps[#title]] \
+ #v(0em)
+ #text(size: 12pt)[--- #smallcaps(date) ---]
+ ]
+ ]
+ ]
+]
+
+#let author-block(authors) = [
+ #align(center)[
+ #for author in authors [
+ #author.name \
+ #text(style: "italic")[#author.location]
+ ]
+ ]
+ #v(1.2em)
+]
+
+#let abstract-block(body) = [
+ #block(width: 100%)[
+ #text(weight: "bold")[Abstract---]
+ #body
+ ]
+ #v(0.8em)
+]
+
+#let paper(
+ title: none,
+ date: none,
+ authors: (),
+ abstract: none,
+ font: "EB Garamond",
+ size: 10pt,
+ doc,
+) = {
+ set document(title: title, author: authors.map(author => author.name))
+
+ set page(
+ paper: "a4",
+ margin: (top: 19mm, bottom: 25mm, left: 16mm, right: 16mm),
+ columns: 2,
+ numbering: "- 1/1 -",
+ )
+
+ set par(justify: true, leading: 0.55em)
+ set text(font: font, size: size)
+ set figure(gap: 0.65em)
+
+ show heading.where(level: 1): it => [
+ #v(0.8em)
+ #text(size: 12pt, weight: "medium")[#align(center)[#smallcaps[#it.body]]]
+ #v(0.35em)
+ ]
+
+ show heading.where(level: 2): it => [
+ #v(0.6em)
+ #align(right)[#text(size: 10pt, style: "italic")[#it.body]]
+ #v(0.25em)
+ ]
+
+ show heading.where(level: 3): it => [
+ #v(0.5em)
+ #text(size: 10pt, weight: "bold", style: "italic")[#it.body]
+ #v(0.15em)
+ ]
+
+ show figure.where(kind: table): set text(size: 8.5pt)
+ show bibliography: set text(size: 8.5pt)
+
+ paper-title(title, date)
+ author-block(authors)
+
+ if abstract != none {
+ abstract-block(abstract)
+ }
+
+ doc
+}
diff --git a/typst.toml b/typst.toml
new file mode 100644
index 0000000..50bf16c
--- /dev/null
+++ b/typst.toml
@@ -0,0 +1,7 @@
+[package]
+name = "mktypst"
+version = "0.1.0"
+entrypoint = "lib.typ"
+authors = ["hachem <im@hachem.wtf>"]
+license = "MIT"
+description = "a couple of dumb typst templates"