SaTeX v0.2.7

Command line

This page is for what every satex command shares: input, configuration, output and exit codes. It also covers shell completion and the local playground. satex --help and satex COMMAND --help list the flags. Lint rules and queries describe what the commands print. The configuration page describes satex.yaml.

Rules every command shares

Every satex command follows the same rules for its input, its configuration and its output. A command differs only where its job does: lint shows early findings, satex cache reads no document.

Input

Configuration

Every command reads the same layers: built-in defaults, the global config, each satex.yaml from the filesystem root down to the document's directory (the current one without -f), --config FILE, then --set PATH=VALUE. --no-config drops every file. --profile picks the defaults (profiles). satex --version lists the files in effect. A file that does not read is named once, by its full path. satex gui hands its config flags to every run it starts. satex completions reads no config, since nothing it prints depends on one.

Output

Exit codes

Shell completion

satex completions install sets completion up for the current shell (bash, zsh or fish). It adds one line to the shell's startup file, and running it again changes nothing.

satex completions <shell> prints a completion script to stdout. The shell can be bash, zsh, fish, elvish or powershell.

The script asks satex for completions each time you press Tab. So the lists are always those of the installed version:

bash

Add this line to ~/.bashrc:

source <(satex completions bash)

zsh

Add this line to ~/.zshrc, after compinit:

source <(satex completions zsh)

fish

satex completions fish > ~/.config/fish/completions/satex.fish

The playground on your machine

satex gui [DIR] opens the browser playground on the project in DIR, the current directory by default. A file names the root document, its folder the project. Without a file the root is the document satex itself would start from in DIR. Only the file shown and the files it reads are analyzed, the file shown first. Another document of the folder runs once you open it. It differs from the web playground in four ways:

satex gui prints the address and opens it in the default browser. --no-open only prints it. --port N picks the port, 8800 by default, or the next free one above it. The terminal names the document each run analyzes. The language server's messages go to satex-gui.log in the cache directory. -v prints them in the terminal instead. The server listens on 127.0.0.1 only. The address carries a random token, and the server answers only a browser that has it. Other users and other web sites cannot reach the project. A file that is not UTF-8 is never overwritten, and a file with \r\n line ends keeps them.

The pages come from a built site: share/satex/site beside the binary, or --site DIR. In a checkout of satex, cargo playground builds one in target/site, which satex gui finds by itself.

Package updates

satex updates main.tex lists each package and class the document loads with its status. outdated means the index knows a newer release. current means the installed one is the newest. unknown means satex cannot tell.

The installed version is what the file's \ProvidesPackage set when it ran. The newest comes from updates.index, by default CTAN's JSON API. Network access is off by default (updates.fetch: false). Without a fresh record a package is unknown, never current. Records are cached in the cache directory under updates for updates.refresh_days.

With updates.changes: true satex also gets the newest release of each outdated package from updates.archives and unpacks it under the cache. It then runs a document that loads the package once with each release. The columns added, removed and changed name the commands (\x), environments ({x}) and options ([x]) whose meaning differs. A command changed when its arity, prefixes or body differ. Internal names are only counted. A release that ships only .dtx sources is reported in note.

satex updates main.tex --set updates.fetch=true --set updates.changes=true

Command tree as JSON

satex completions json prints the subcommands, flags, value names, possible values, query names and config keys as JSON. It is hidden from --help. Tools such as the web playground use it.

Benchmarks

python3 scripts/bench.py --build builds the release binary, runs the documents of benches/docs.txt under every kernel and writes the entry for the current version to doc/site/bench/data.json. Entries of other versions stay. cargo playground then serves the Benchmarks page from that file, and shows a hint while it is missing. cargo bench --bench analysis runs the Criterion micro-benchmarks. CI appends an entry on each release.

python3 scripts/bench_compile.py compares satex compile --system satex with latexmk and the plain engine on the documents of benches/compile.txt and, with --big article-200,book-1000, on generated ones. It measures a cold build, a rebuild with nothing changed and a rebuild after one changed word. For each it records the median wall time of N runs and its spread, CPU time, peak memory and engine passes. It also checks that each PDF has latexmk's page count and text. The clock is pinned for every tool. The entry goes to doc/site/bench/compile.json; the module docstring says which caches each scenario has.