docs/md2tex.py converts docs/basic-manual.md (still the only source) to LaTeX via python-markdown's HTML; build-manual.sh typesets it with XeLaTeX instead of printing HTML from Chrome. A title page, contents with page numbers, section openers, running heads, Carbon-style tables and code panels. Code blocks inside numbered lists now render as code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.1 KiB
Bash
Executable File
25 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Turn docs/basic-manual.md into docs/basic-manual.pdf.
|
|
# The Markdown is the only source: md2tex.py converts it to LaTeX, and XeLaTeX
|
|
# typesets it in IBM Plex. Needs python3-markdown, XeLaTeX (texlive-xetex,
|
|
# -latex-extra for KOMA-Script, tcolorbox, xltabular) and the IBM Plex fonts
|
|
# in /usr/share/fonts/truetype/ibm-plex (fonts-ibm-plex).
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
work=$(mktemp -d)
|
|
trap 'rm -rf "$work"' EXIT
|
|
python3 md2tex.py basic-manual.md "$work/basic-manual.tex"
|
|
# three passes: contents, then page numbers in the contents, then settled
|
|
for pass in 1 2 3; do
|
|
if ! (cd "$work" && xelatex -interaction=nonstopmode -halt-on-error basic-manual.tex >/dev/null); then
|
|
grep -A8 '^!' "$work/basic-manual.log" >&2 || tail -40 "$work/basic-manual.log" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
if grep -q 'Missing character' "$work/basic-manual.log"; then
|
|
echo "warning: characters missing from the fonts:" >&2
|
|
grep 'Missing character' "$work/basic-manual.log" | sort -u >&2
|
|
fi
|
|
cp "$work/basic-manual.pdf" basic-manual.pdf
|
|
echo "wrote docs/basic-manual.pdf"
|