commit 4e058e1ac46682c771d9e15be5f0391638b46d3c Author: Agatha V. Lovelace Date: Wed Dec 13 12:55:12 2023 +0100 Initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac5cc5d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.direnv +/*.typ +templates/self.typ +*.pdf diff --git a/.helix/languages.toml b/.helix/languages.toml new file mode 100644 index 0000000..999243d --- /dev/null +++ b/.helix/languages.toml @@ -0,0 +1,8 @@ +[language-server.typst-lsp] +command = "typst-lsp" +config = { exportPdf = "never" } + +[[language]] +name = "typst" +auto-format = true +formatter = { command = "typstfmt" } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c3993d2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1702151865, + "narHash": "sha256-9VAt19t6yQa7pHZLDbil/QctAgVsA66DLnzdRGqDisg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "666fc80e7b2afb570462423cb0e1cf1a3a34fedd", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1752671 --- /dev/null +++ b/flake.nix @@ -0,0 +1,13 @@ +{ + description = "Typst dev environment"; + + inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; }; + + outputs = { self, nixpkgs }: { + devShells."x86_64-linux".default = + let pkgs = import nixpkgs { system = "x86_64-linux"; }; + in pkgs.mkShell { + buildInputs = with pkgs; [ typst typst-lsp typst-fmt ]; + }; + }; +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..6690287 --- /dev/null +++ b/justfile @@ -0,0 +1,2 @@ +clean: + fd . --no-ignore -e pdf -x rm diff --git a/templates/letter.typ b/templates/letter.typ new file mode 100644 index 0000000..784a622 --- /dev/null +++ b/templates/letter.typ @@ -0,0 +1,80 @@ +#let din5008( + returnaddr: none, + recipient: none, + recipientnote: none, + information: none, + header: none, + footer: none, + footermargin: none, + body, +) = { + let combinedfooter = stack(dir: ttb, spacing: 1in / 6, align(right, locate(loc => [ + Seite #counter(page).display() von #counter(page).final(loc).at(0) + ])), footer) + + set page( + paper: "a4", + footer: combinedfooter, + footer-descent: 1in / 6, + header: header, + margin: ( + top: 27mm, + left: 25mm, + right: 20mm, + bottom: if footermargin != none { footermargin } else { 35mm }, + ), + ) + + for item in ( + (ref: top + left, dx: -25mm, dy: 60mm, len: 4mm), + (ref: top + right, dx: 20mm, dy: 60mm, len: 4mm), + (ref: bottom + left, dx: -25mm, dy: -80mm, len: 4mm), + (ref: bottom + right, dx: 20mm, dy: -80mm, len: 4mm), + (ref: top + left, dx: -25mm, dy: 121.5mm, len: 10mm), + ) { + place(item.ref, dx: item.dx, dy: item.dy, line(length: item.len)) + } + + grid( + columns: 1, + rows: (60mm, auto), + gutter: 1in / 3, + rect(width: 100%, height: 100%, stroke: none, { + place( + top + left, + dx: 0mm, + dy: 0mm, + rect(height: 45mm, width: 80mm, stroke: none, grid( + columns: 1, + rows: (5mm, 12.7mm, 27.3mm), + text(8pt)[#returnaddr], + recipientnote, + recipient, + )), + ) + place( + top + left, + dx: 100mm, + dy: 5mm, + rect(width: 75mm, stroke: none, information), + ) + }), + body, + ) +} + +#let signature(image: none, width: 30%, name) = { + block( + width: width, + stack( + dir: ttb, + spacing: 5pt, + if image == none { + rect(stroke: (bottom: 1pt + black, rest: none), height: 20pt, width: 100%) + } else { + image + }, + name, + ), + ) +} diff --git a/templates/slides.typ b/templates/slides.typ new file mode 100644 index 0000000..32c68a4 --- /dev/null +++ b/templates/slides.typ @@ -0,0 +1,19 @@ +#import "@preview/polylux:0.3.1": * +#import "self.typ" + +#let presentation(title: none, subtitle: none, authors: self.name, doc) = { + set page(paper: "presentation-16-9") + set text(size: 25pt, font: "Comic Sans MS") + + if title != none [ + #polylux-slide[ + #set align(horizon + center) + = #title + === #subtitle + + #align(bottom)[#authors] + ] + ] + + doc +}