From 9ad4d38746dfacdf4921949e1c8bd050a0817cc7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 00:04:08 -0300 Subject: The book and the HTML gain "Setting up your environment" after the guide chapters lists setup.typ second and #doc takes a setup id. Shell lines (#cmd) follow the density too: roomy in the book and the HTML, with a tint and space around them, tight on the A4 sheet; the book sets code blocks on the same tint. Co-Authored-By: Claude Opus 5.5 --- docs/typ/README | 4 ++-- docs/typ/book.typ | 3 +++ docs/typ/cheatsheet-a4.pdf | 6 +++--- docs/typ/cheatsheet-a4.typ | 4 ++-- docs/typ/style.typ | 19 ++++++++++++------- 5 files changed, 22 insertions(+), 14 deletions(-) (limited to 'docs/typ') diff --git a/docs/typ/README b/docs/typ/README index 509cec39..048e5d01 100644 --- a/docs/typ/README +++ b/docs/typ/README @@ -14,7 +14,7 @@ docs/typ: the Typst documentation corpus an anchor named by its id, then the tutor. Wrappers hold layout only, never facts. -Chapters: `chapters` in style.typ lists them in reading order (guide, +Chapters: `chapters` in style.typ lists them in reading order (guide, setup, cheatsheet, scripting, reference, themes, building), each with its content file, or none while it is not written (the outputs show a placeholder). To add a topic, write docs/typ/.typ and set its `file`. Wrappers include it @@ -61,7 +61,7 @@ new function instead. cmd(c) a shell line, as a block. #cmd("echo Save > $m/pane/$n/ctl") doc(id, section:) a pointer to a chapter, or a section of it by the label - on its heading. Ids: guide cheatsheet scripting + on its heading. Ids: guide setup cheatsheet scripting reference themes building (and the older tags fs config keys detached, mapped in `topics`). A link in the book and the HTML; on the A4 sheet, its name. diff --git a/docs/typ/book.typ b/docs/typ/book.typ index 803a65e2..a89b52cc 100644 --- a/docs/typ/book.typ +++ b/docs/typ/book.typ @@ -13,6 +13,9 @@ #show heading.where(level: 2): set block(above: 2em, below: 0.9em) #show heading.where(level: 3): set block(above: 1.5em, below: 0.7em) #show raw: set text(font: mono, size: 0.9em) +#show raw.where(block: true): it => block( + width: 100%, fill: palette.tag-bg.transparentize(50%), radius: 2pt, + inset: (x: 6pt, y: 5pt), above: 0.9em, below: 0.9em, it) #show heading: set text(fill: palette.tag-name) #show heading.where(level: 1): it => { pagebreak(weak: true) diff --git a/docs/typ/cheatsheet-a4.pdf b/docs/typ/cheatsheet-a4.pdf index 038c0077..52377d2f 100644 --- a/docs/typ/cheatsheet-a4.pdf +++ b/docs/typ/cheatsheet-a4.pdf @@ -1740,12 +1740,12 @@ x endstream endobj 477 0 obj -<> +<> endobj 478 0 obj <> stream -Typst 0.15.1en2026-09-30T23:53:20-03:002026-09-30T23:53:20-03:001application/pdfshOu/M01zbWZ6Ipooaw4nw==shOu/M01zbWZ6Ipooaw4nw==proof1.7 +Typst 0.15.1en2026-10-01T00:06:15-03:002026-10-01T00:06:15-03:001application/pdfKbxl1G2nYZIjHwolHmzkUQ==Kbxl1G2nYZIjHwolHmzkUQ==proof1.7 endstream endobj 479 0 obj @@ -2234,7 +2234,7 @@ xref 0000114755 00000 n 0000115828 00000 n trailer -<> +<> startxref 116015 %%EOF \ No newline at end of file diff --git a/docs/typ/cheatsheet-a4.typ b/docs/typ/cheatsheet-a4.typ index 5ae8b4be..6f22f723 100644 --- a/docs/typ/cheatsheet-a4.typ +++ b/docs/typ/cheatsheet-a4.typ @@ -2,7 +2,7 @@ // cheatsheet.typ and the elements' look in style.typ; this is page, // type and headings only. // typst compile --ignore-system-fonts docs/typ/cheatsheet-a4.typ -#import "style.typ": palette, mono, pairs-density +#import "style.typ": palette, mono, density #set page(paper: "a4", fill: palette.paper, margin: (x: 9mm, y: 8mm), columns: 3) #set columns(gutter: 4.5mm) @@ -36,5 +36,5 @@ #show heading.where(level: 3): it => block(above: 0.6em, below: 0.35em, sticky: true, text(size: 8.4pt, weight: "bold", fill: palette.grip, it.body)) -#pairs-density.update("tight") +#density.update("tight") #include "cheatsheet.typ" diff --git a/docs/typ/style.typ b/docs/typ/style.typ index e1bab27d..cf55ae86 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -27,6 +27,7 @@ /// keep working. #let topics = ( guide: ("guide", none), + setup: ("setup", none), cheatsheet: ("cheatsheet", none), scripting: ("scripting", none), reference: ("reference", none), @@ -50,6 +51,7 @@ /// `ch-`. #let chapters = ( (id: "guide", title: "Guide", file: "guide.typ"), + (id: "setup", title: "Setting up your environment", file: "setup.typ"), (id: "cheatsheet", title: "Cheatsheet", file: "cheatsheet.typ"), (id: "scripting", title: "Scripting", file: "scripting.typ"), (id: "reference", title: "Reference", file: "reference.typ"), @@ -60,6 +62,10 @@ /// The tutor, shown as it is in the editor (`Tutor`), from the repo root. #let tutor-path = "/src/tutor.txt" +/// How much room tables and shell lines get: "roomy" (the book, the HTML) +/// or "tight" (the A4 sheet sets it). +#let density = state("density", "roomy") + #let html-out() = target() == "html" #let span(class, body) = html.elem("span", attrs: (class: class), body) #let m(s, fill: palette.ink) = text(font: mono, size: 0.92em, fill: fill, s) @@ -159,9 +165,12 @@ /// A shell line. #let cmd(c) = context if html-out() { raw(c, block: true, lang: "sh") } else { + let tight = density.get() == "tight" block( - width: 100%, inset: (left: 3pt, y: 1.2pt), spacing: 0.4em, - stroke: (left: 1pt + palette.rule), + width: 100%, spacing: if tight { 0.4em } else { 0.9em }, + inset: if tight { (left: 3pt, y: 1.2pt) } else { (left: 6pt, y: 3pt) }, + stroke: (left: (if tight { 1pt } else { 1.5pt }) + palette.rule), + fill: if tight { none } else { palette.tag-bg.transparentize(50%) }, text(font: mono, size: 0.85em, fill: palette.ink, c), ) } @@ -187,17 +196,13 @@ } } -/// How roomy #pairs tables are: "roomy" (the book, the HTML) or "tight" -/// (the A4 sheet sets it). -#let pairs-density = state("pairs-density", "roomy") - /// Pairs: a thing and what it means, as a two-column table, key column /// first, rows on alternating tints. `split: 2` sets the rows as that many /// tables side by side (on paper; HTML gets one table). #let pairs(split: 1, ..cells) = { let rows = cells.pos().chunks(2) context { - let tight = pairs-density.get() == "tight" + let tight = density.get() == "tight" let one(rows) = table( columns: (auto, 1fr), stroke: none, inset: if tight { (x: 2pt, y: 1.6pt) } else { (x: 7pt, y: 4pt) }, -- cgit v1.3