A run of Unicode code points now needs one pair of carets, not one pair
each: ^9053 53EF 9053^ renders the characters adjacently, and a single
character inside such a run stands for itself. An invalid code point is
an error naming the position that wrote it, rather than an apology
rendered into the finished document; noncharacters are refused alongside
surrogates; and a code point that lands on a Klammertext special is safe
through the re-reads that assemble a document. The character tables now
produce the precomposed form, so a diacritic written as ^a" and one typed
directly are the same text to a search or a copy-paste.
"kdesc -u" describes how to write a Unicode character, with tables of
glyphs beside the codes that produce them. It is new and not yet
complete: it predates the sequence form and the typeface klammer below.
A typeface and a style are no longer both called "font". A typeface is a
family resolved by name; a style code is the one letter naming a type
style. So @document takes :serif_typeface and its siblings, a table takes
:style, captions take :caption_style and :caption_size, the uniform scale
is :text_scale, and the command is "kdesc --typeface". This renames
arguments a document may already use; an old name is a located error
rather than a silent omission.
@typeface sets a passage in another typeface for the length of that
passage:
@typeface Noto Sans Egyptian Hieroglyphs | ^132AA 133CF^ :scale 1.5 @
Writing the klammer is the whole declaration -- the document resolves the
typeface, embeds it in what it produces, and carries its license along.
Two typefaces for scripts no text font covers now ship with Klammertext:
Noto Sans Egyptian Hieroglyphs and Noto Sans Cuneiform. Every typeface in
the distribution now carries its license file.
(from dev 61e598698891)
179 lines
6.6 KiB
Markdown
179 lines
6.6 KiB
Markdown
# Running Klammertext on a Mac (Apple Silicon)
|
|
|
|
This guide gets Klammertext running on your Mac in a few minutes. You do
|
|
**not** need to install TeX Live, Python, or any programming tools —
|
|
everything, including the TeX Live system that makes PDFs, is packaged inside
|
|
a single downloadable image. You install Apple's `container` runtime once, and
|
|
then Klammertext works like a normal command.
|
|
|
|
This guide is for **Apple Silicon Macs (M1/M2/M3/M4/M5) running macOS 26 or
|
|
later**, which is what Apple's `container` runtime requires. (Support for older
|
|
Intel Macs can be provided separately if needed.)
|
|
|
|
## Step 1 — Install Apple's `container` runtime
|
|
|
|
`container` is Apple's own tool for running Linux container images natively on
|
|
Apple Silicon. It's free.
|
|
|
|
1. Go to <https://github.com/apple/container/releases> and download the latest
|
|
installer package (the `.pkg` file). **Do not** use Homebrew — the Homebrew
|
|
`container` formula is a different, unrelated tool.
|
|
2. Double-click the downloaded `.pkg` and follow the installer.
|
|
3. Open the **Terminal** app (Applications → Utilities → Terminal) and start the
|
|
`container` background service (accept the recommended default if prompted):
|
|
|
|
```sh
|
|
container system start
|
|
```
|
|
|
|
You only do this once. You can check the service any time with
|
|
`container system status`.
|
|
|
|
## Step 2 — Download Klammertext
|
|
|
|
In Terminal, paste this and press Return:
|
|
|
|
```sh
|
|
container image pull akopra/klammertext:latest
|
|
```
|
|
|
|
This downloads Klammertext and its built-in TeX Live. It's a few hundred
|
|
megabytes, so it takes a minute the first time. Because the image is multi-arch,
|
|
`container` fetches the native Apple Silicon (arm64) build. You won't need to do
|
|
this again unless you're updating.
|
|
|
|
## Step 3 — Add the Klammertext commands
|
|
|
|
This step makes `ktext` (and its helpers) available as ordinary commands.
|
|
|
|
1. In Terminal, create the wrapper file by pasting this whole block and
|
|
pressing Return:
|
|
|
|
```sh
|
|
cat > ~/klammertext.zsh <<'EOF'
|
|
# Klammertext via Apple's `container` runtime (native arm64 image; no Rosetta).
|
|
KLAMMERTEXT_IMAGE="${KLAMMERTEXT_IMAGE:-akopra/klammertext:latest}"
|
|
_klammertext_run() {
|
|
local cmd="$1"; shift
|
|
container run --rm \
|
|
-v "$PWD:/work" -w /work \
|
|
"$KLAMMERTEXT_IMAGE" "$cmd" "$@"
|
|
}
|
|
ktext() { _klammertext_run ktext "$@"; }
|
|
kdesc() { _klammertext_run kdesc "$@"; }
|
|
kdiag() { _klammertext_run kdiag "$@"; }
|
|
klammertext-update() {
|
|
container image delete "$KLAMMERTEXT_IMAGE" 2>/dev/null
|
|
container image pull "$KLAMMERTEXT_IMAGE"
|
|
}
|
|
EOF
|
|
```
|
|
|
|
2. Tell your shell to load it, by pasting this and pressing Return:
|
|
|
|
```sh
|
|
echo 'source ~/klammertext.zsh' >> ~/.zshrc
|
|
```
|
|
|
|
3. **Close Terminal and open a new window** so the change takes effect.
|
|
|
|
You now have three commands — `ktext`, `kdesc`, `kdiag` — that run Klammertext
|
|
inside a container while reading and writing files in whatever folder you're
|
|
working in.
|
|
|
|
## Step 4 — Make your first document
|
|
|
|
In Terminal, go to a folder you want to work in (for example your Desktop) and
|
|
create a test file:
|
|
|
|
```sh
|
|
cd ~/Desktop
|
|
cat > hello.kt <<'EOF'
|
|
@document
|
|
:structure article
|
|
:title Hello
|
|
:text
|
|
@s1 Hello, Klammertext @
|
|
|
|
This document was produced on macOS with no TeX Live installed —
|
|
just Apple's `container` runtime and the Klammertext image.
|
|
@
|
|
EOF
|
|
```
|
|
|
|
Now produce a web page and a PDF from it:
|
|
|
|
```sh
|
|
ktext hello.kt -t html # makes hello/index.html
|
|
ktext hello.kt -t pdf # makes hello.pdf
|
|
```
|
|
|
|
Open the results:
|
|
|
|
```sh
|
|
open hello.pdf
|
|
open hello/index.html
|
|
```
|
|
|
|
That's it — you're running Klammertext.
|
|
|
|
## Good to know
|
|
|
|
- **Work inside one folder.** Klammertext can only see files in (or below) the
|
|
folder you run the command from. Keep a document and the files it uses
|
|
together, and run `ktext` from that folder.
|
|
- **Runs natively.** On Apple Silicon, `container` runs the native arm64 image
|
|
with no Rosetta translation.
|
|
- **Fonts.** The default fonts (Crimson Pro, Open Sans, Inconsolata, and
|
|
others) are built in, so PDFs work with no internet connection. Font
|
|
resolution is entirely offline: asking for a font that isn't installed
|
|
lists the available fonts, and additional fonts are installed from font
|
|
files you already have with `kdesc --typeface install <folder>` (`kdesc --typeface
|
|
help` explains).
|
|
- **Updating later.** When a new version is announced, run `klammertext-update`
|
|
in Terminal.
|
|
- **If you also build Klammertext from source on this Mac.** Most people don't —
|
|
the whole point of the container is that you don't need a source build. But if
|
|
this machine *also* has a native source build on its `PATH` (so `which ktext`
|
|
shows a path like `.../K/com/ktext`), the wrapper's `ktext` function would
|
|
shadow that native command. To keep both, give the container wrappers their
|
|
own names by using `ktextc` / `kdescc` / `kdiagc` (trailing `c` = container)
|
|
in place of `ktext` / `kdesc` / `kdiag` in the Step 3 file. Then plain `ktext`
|
|
still runs your source build and `ktextc` runs the container.
|
|
- **Quitting.** Klammertext only runs while you're using it; there's nothing
|
|
left running afterward. If you want to stop the `container` service entirely,
|
|
run `container system stop`; start it again with `container system start` next
|
|
time.
|
|
|
|
## Editor support (Emacs, Sublime Text)
|
|
|
|
Editing Klammertext is nicer with editor support: syntax highlighting,
|
|
delimiter matching, indentation, table alignment, and diagnostics for
|
|
Emacs, Sublime Text, Vim, and Visual Studio Code. It is not
|
|
inside the container image — it belongs on your Mac, next to your editor.
|
|
Download it from either place:
|
|
|
|
- <https://andykopra.com/Klammertext_editing.zip> — unpacks to `emacs/`,
|
|
`sublime/`, `vim/`, and `vscode/` folders, each self-contained
|
|
- the Klammertext source repository,
|
|
<https://git.andykopra.com/ack/klammertext>, directory `doc/edit/`
|
|
|
|
Each package's README explains its installation.
|
|
|
|
## If something goes wrong
|
|
|
|
- **`command not found: ktext`** — you didn't open a new Terminal window after
|
|
Step 3, or the `source` line didn't get added. Re-run the Step 3 commands and
|
|
open a fresh Terminal.
|
|
- **`container: command not found`** — the `container` runtime isn't installed
|
|
(Step 1), or the Terminal window predates the install (open a new one).
|
|
- **A command hangs or won't connect** — the `container` service isn't running.
|
|
Run `container system start` (check with `container system status`), then try
|
|
again.
|
|
- **A run aborted and now seems stuck** — `container run --rm` can leave the
|
|
container behind after an error. Clear leftovers with:
|
|
|
|
```sh
|
|
for id in $(container list -a -q); do container kill "$id"; container delete "$id"; done
|
|
```
|