Rendering test¶
Internal page. It exists so that a change to the KaTeX configuration, the macro table, or the syntax-highlighting setup shows up as a visible regression on one page rather than as a silent one across 44 exam solutions.
Not in the navigation, excluded from search. Reachable only by URL.
The authoritative check is make math-audit (scripts/js/audit_math.mjs),
which renders every expression in a content tree headlessly and exits non-zero
on failure.
This page is the visual counterpart.
Mathematics¶
Inline: the ring \(R\) acts on \(M\) so that \(\operatorname{ann}(x) = \{r \in R : rx = 0\}\), and \(\varphi\colon A \to B\) is a homomorphism.
Display:
Delimiters are $...$ and $$...$$ in the source. pymdownx.arithmatex
rewrites them to \(...\) and \[...\], which is what KaTeX matches on.
A bare dollar sign in prose must not trigger rendering: this costs $5, and
echo $PATH in code is untouched.
Custom macros¶
These come from the imported qualifying-exam solutions, whose LaTeX was written
against a personal macro package that never made it to the web. Each row fails
to render — visibly, in red — if katex-macros.js regresses.
| Macro | Renders as |
|---|---|
\C, \R, \N, \Z, \F |
\(\C\), \(\R\), \(\N\), \(\Z\), \(\F\) |
\UD, \UHP, \RHP |
\(\UD\), \(\UHP\), \(\RHP\) |
\borel, \sigM, \sigA |
\(\borel\), \(\sigM\), \(\sigA\) |
\sA, \sI, \sJ |
\(\sA\), \(\sI\), \(\sJ\) |
\Hom, \HomR, \End, \Tor |
\(\Hom\), \(\HomR\), \(\End\), \(\Tor\) |
\ann, \im, \Real, \Imag |
\(\ann\), \(\im\), \(\Real\), \(\Imag\) |
\meet, \join, \dotcup |
\(\meet\), \(\join\), \(\dotcup\) |
\limn |
\(\limn a_n\) |
\vphi, \bphi, \one |
\(\vphi\), \(\bphi\), \(\one\) |
In context, as they appear in the source:
Code¶
The Unicode question matters more here than the colours. Agda identifiers use characters far outside ASCII, and a highlighter that mangles them or forces a fallback font makes the library pages unreadable.
_∘_ : {A B C : Set} → (B → C) → (A → B) → (A → C)
(g ∘ f) x = g (f x)
record Algebra (𝓤 : Level) (𝑆 : Signature 𝓞 𝓥) : Set (𝓞 ⊔ 𝓥 ⊔ lsuc 𝓤) where
field Domain : Setoid 𝓤 𝓤
Interp : ⟨ 𝑆 ⟩ (Carrier Domain) → Carrier Domain
∀-elim : ∀ {A : Set} {B : A → Set} → (∀ (x : A) → B x) → (M : A) → B M
∀-elim f M = f M
theorem birkhoff {α : Type*} [Lattice α] (a b c : α) :
a ⊓ (b ⊔ c) = (a ⊓ b) ⊔ (a ⊓ c) ↔ IsDistribLattice α := by
constructor <;> intro h <;> simp_all
newtype Fix f = Fix { unFix :: f (Fix f) }
cata :: Functor f => (f a -> a) -> Fix f -> a
cata alg = alg . fmap (cata alg) . unFix
def polymorphisms(algebra: Algebra, arity: int) -> Iterator[Operation]:
"""Enumerate the arity-n polymorphisms of a finite algebra."""
yield from (op for op in candidates(arity) if preserves(op, algebra))
{
devShells.default = pkgs.mkShell {
packages = [ pkgs.python3 pkgs.cairo pkgs.pango ];
SITE_NIX_SHELL = 1;
};
}
Copy the Agda block and paste it somewhere: the round trip must preserve
𝓤, 𝑆, ⊔, →, and ⟨ ⟩ exactly.
Known limitations¶
docs/ renders zero KaTeX failures across 1204 expressions, and
nix flake check now holds it there — that is what checks.math-audit is. So
everything below is either about content still staged under import/, or about
a defect class the audit cannot see by construction.
\xymatrix does not render. Five commutative diagrams in the ring-theory
solutions use XY-pic, which KaTeX has no equivalent for. They need converting to
Mermaid, KaTeX's {CD} environment, or images. Content work rather than a
rendering bug — and confined to import/zola-converted/exams/rings/, so it
blocks the exam migration (#56) and nothing that ships today.
Over-escaped braces, and three defects like them. The imported content came
through a Markdown engine that escaped its way past this one, leaving four
patterns that build cleanly, raise nothing, and are wrong on the page — which is
exactly the class make math-audit cannot see, because it only reports what
KaTeX throws on:
| in the source | what a reader gets |
|---|---|
\\{, \\} |
KaTeX reads \\ as a line break, so the braces vanish and the expression grows two stray breaks |
\_ |
a literal underscore: A_1 where A₁ was meant |
$ x $ |
arithmatex's smart_dollar declines a padded delimiter, so the LaTeX is published as prose |
a $$ block that does not own its Markdown block |
the inline processor takes the inner $…$ and leaves a literal $ on each side |
make math-source reports all four and make math-fix rewrites the first
three; scripts/python/check_math_source.py imports arithmatex's own delimiter
patterns so it cannot disagree with the build. docs/ is clean of all four and
CI keeps it that way.
"Owns its block" is stricter than it sounds, and each clause was learned from a
page that broke: arithmatex's BlockProcessor.test() calls .match(), so the
delimiter needs a blank line before it, a blank line after it, an indent
that is a multiple of four (python-markdown wants four inside a list item, not
two or three), and nothing else on either line. Miss any one and the whole
block falls through to the inline processor.
A fifth, closely related, that neither checker can see: the conversion also
doubled the row separator inside matrices, writing \\\\ where the source
.tex writes \\. KaTeX reads that as two line breaks and renders a matrix
with blank rows between its entries — a four-entry vector came out seven rows
tall. It raises nothing and it is legal LaTeX, so it can only be found by
counting rows. Forty were repaired across the Sage labs; the source .tex
files under import/zola-content/python/ are the authority if more turn up.
And a sixth, which is not about mathematics at all but is what stranded a third
of those blocks: python-markdown needs four spaces to keep a block inside a
list item, where the engine these pages were written for accepted two or three.
Every continuation — prose, code fence, image, nested list — fell out of its
item, so the archived Sage labs were rendering each numbered step as its own
one-item list restarting at 1. Repairing the display blocks inside those items
was impossible without repairing the items, so both were done together;
docs/python/lab1 went from eight <ol> elements to one per section.
Left alone deliberately: docs/python/lab3, whose sub-four-space lines are
sage: console output rather than list continuations. Same indentation, a
different construct, and no stranded blocks — so re-indenting it would be a
guess at intent rather than a repair.
Point make math-fix MATH_ROOT=import/zola-converted at the exam corpus before
migrating it and the mechanical half never reaches docs/ at all.
Redundant macro preambles. Four imported pages open with a math block containing nothing but definitions:
$\newcommand\FGrp{\mathbf{F}_{\mathbf{Grp}}} \newcommand\inj{\mathrm{in}}$
$\def\bA{\bf A} \def\bB{\bf B}$
Those definitions now live in katex-macros.js, which makes the preambles
redundant — and, for the \newcommand ones, harmful: KaTeX raises
"attempting to redefine \FGrp; use \renewcommand" rather than ignoring them.
The \def ones do not raise; they render as an empty span, which is a stray
blank in the middle of a sentence rather than an error.
Both blocks that had reached docs/ are now deleted — agda-ualib/f-algebras
and the Pálfy–Saxl post — and \FGrp, \inj, \bA and \bB resolve from the
macro table exactly as before. What remains is in import/zola-converted/, and
deleting each one is part of migrating the page that carries it.