Math Syntax Error
& outside an environment, a stray \begin/\end, or another malformed piece of syntax.
Q-22-13 — Math Syntax Error
The math expression contains a construct the parser could not interpret: an alignment
&outside an environment, a stray\begin/\end, or another malformed piece of syntax.
What this means
This is the catch-all for malformed math that does not fit a more specific code. The offending piece is underlined; the expression is emitted verbatim in formats that need a conversion.
Why this happens
Common causes: an & used as an ordinary character (write \&), \\ or & outside an aligned/matrix environment, or the remains of an incomplete edit.
How to fix it
Check the underlined text against the LaTeX math syntax you intended.
Where it is reported
Math diagnostics point into the .qmd at the exact characters inside the
$…$ or $$…$$ block, including math that spans several lines or sits
inside a block quote or list item. When a \newcommand macro is involved,
a problem inside the macro body points at the definition and a problem in
a macro argument points at the use.