From 84e7eb67ef38ee7a9d027575a6539e5b943e9414 Mon Sep 17 00:00:00 2001 From: Bartal Laearsson Date: Mon, 12 Oct 2026 12:32:28 +0100 Subject: [PATCH] add typst working docs --- tools/TYPST.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/TYPST.md diff --git a/tools/TYPST.md b/tools/TYPST.md new file mode 100644 index 0000000..44b9123 --- /dev/null +++ b/tools/TYPST.md @@ -0,0 +1,43 @@ +So for like live updating or recompiling the pdf document with a justfile that looks like this in one terminal window + +```justfile +watch-typst doc lang="da": + typst watch --input lang={{ lang }} {{ doc }}.typ ./output/{{ doc }}-{{ lang }}.pdf + +watch-pdf doc lang="da": + watch-pdf ./output/{{ doc }}-{{ lang }}.pdf + +build doc: + typst compile --input lang=en {{ doc }}.typ ./output/{{ doc }}-en.pdf + typst compile --input lang=da {{ doc }}.typ ./output/{{ doc }}-da.pdf + typst compile --input lang=fo {{ doc }}.typ ./output/{{ doc }}-fo.pdf + +``` + +While the machine having the watch-pdf script available in PATH + +```bash +#!/usr/bin/env bash +set -euo pipefail + +[[ -z "$1" ]] && { echo "ERROR: No PDF filename provided"; exit 1; } +PDF_PATH="$1" + +if [[ ! -f "${PDF_PATH}" ]]; then + echo "ERROR: ${PDF_PATH} is not a regular file" + exit 1 +fi + +command -v evince &> /dev/null || { echo "❌ evince not found. Install: sudo apt-get install evince"; exit 1; } + +echo "=== Reload Watcher Started ===" +echo "Monitoring ${PDF_PATH} for writes…" + +while IFS= read -r change_file; do + [[ "${change_file}" == "${PDF_PATH}" ]] || continue + echo "[$(date '+%Y-%m-%d %H:%M:%S')] ${PDF_PATH} modified → opening evince" + evince "${PDF_PATH}" & +done < <(inotifywait -mr --format '%w%f' -e close_write "${PDF_PATH}") + +echo "Watcher stopped." +```