From 2426617cf9c2cdfe67fe665a76ddccca3997c76f Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Wed, 9 Sep 2026 12:04:49 -0700 Subject: [PATCH] fix: drop `\def\v0` / `\def\v1`, which broke `\v` for every other argument TeX has no multi-token control sequences, so `\def\v0{\vec{0}}` and `\def\v1{\vec{1}}` never defined macros named `\v0` and `\v1`. Each defined `\v` with a *delimited* parameter whose delimiter is the literal digit, and `\def\v1` came last, so the surviving definition of `\v` matched only a following literal `1`. That silently overrode `\renewcommand{\v}[1]{\vecf{#1}}`, so `\v1` worked by accident of ordering while `\v0` and the documented one-argument form `\v{x}` both failed with Use of \v doesn't match its definition. It took down d-morrison/rme's book build: https://github.com/d-morrison/rme/actions/runs/34375808884/job/102548187534 Removing both pseudo-definitions leaves `\renewcommand{\v}[1]` as the only definition of `\v`, so `\v0`, `\v1` and `\v{x}` all expand as one-argument invocations. `\vone` joins the existing `\vzero` for consumers that prefer a named form. Verified with pandoc 3.8.3, whose `latex_macros` extension expands macros defined in the same document. Appending `$\v0$ $\v1$ $\v{x}$` to each version of `macros.qmd` and running `quarto pandoc -t latex` gives: no definitions present \v0 \v1 (\v{x} absent) macros.qmd before \v0 \tilde{1} \v{x} macros.qmd after \tilde{0} \tilde{1} \tilde{x} The middle row is the bug: only `\v1` expands, because the delimited `\def\v1` is the surviving definition of `\v`. The top row shows what an unexpanded macro looks like, which is what the middle row's `\v0` and `\v{x}` are -- and those are exactly the tokens LuaLaTeX then chokes on. The bottom row is the fix. Existing consumer usages `\tp{\v1}\vx` and `\pi^{\v1 \cdot \vy}` expand identically before and after. Closes #86 Co-Authored-By: Claude Opus 5 --- interpretations.tsv | 5 ++--- macros.qmd | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/interpretations.tsv b/interpretations.tsv index 1d9a035..19f6339 100644 --- a/interpretations.tsv +++ b/interpretations.tsv @@ -66,8 +66,8 @@ name interpretation \NegBin Negative Binomial label (long form) \vbeta beta coefficient vector \vb beta vector (alias for \vbeta) -\v0 zero vector -\vzero zero vector (alias for \v0) +\vzero zero vector +\vone vector of ones \gb Greek letter beta (alias for \b) \gg Greek letter gamma (alias for \g) \gd Greek letter delta (δ) @@ -365,7 +365,6 @@ name interpretation \vd exposure vector d lowercase (d̃) \vT time vector T (T̃) \vt time vector t lowercase (t̃) -\v1 vector of ones (1̃) \vpi vector of probabilities π (π̃) \mat matrix notation (alias for \matr) \dsn sequence x₁, …, xₙ diff --git a/macros.qmd b/macros.qmd index f84bfc6..b90a290 100644 --- a/macros.qmd +++ b/macros.qmd @@ -65,8 +65,8 @@ \def\NegBin{\operatorname{NegBin}} \def\vbeta{\vec \beta} \def\vb{\vec \b} -\def\v0{\vec{0}} \def\vzero{\vec{0}} +\def\vone{\vec{1}} \def\gb{\beta} \def\gg{\gamma} \def\gd{\delta} @@ -372,7 +372,6 @@ \def\vd{\vecf{d}} \def\vT{\vecf{T}} \def\vt{\vecf{t}} -\def\v1{\vec{1}} \def\vpi{\vecf{\pi}} \providecommand{\mat}[1]{\mathbf{#1}} \providecommand{\dsn}[1]{#1_1, \ldots, #1_n}