7 Maths Equations
Quarto uses MathJax for mathematics in HTML outputs.
7.1 Inline Mathematics
The force is given by $F = ma$.Produces:
The force is given by \(F = ma\).
7.2 Display Mathematics
$$
F = ma
$$7.3 Numbered Equations
Numbered equations can be labelled.
$$
F = ma
$$ {#eq-newton}\[ F = ma \tag{7.1}\]
7.4 Aligned equations
You can use the \begin{align} or \begin{aligned}to align equations (note \begin{eqnarray} also works, but is generally deprecated and not recommended for TeX nowadays)
$$
\begin{align}
a &= b + c \\
&= d + e
\end{align}
$$\[ \begin{align} a &= b + c \\ &= d + e \end{align} \]
Mathjax can’t have multiple labels for a multi-line equation (as of Oct 2026) - you can only label the whole align environment block. There are various workarounds: the simplest and least technical is to have separate equations (but loose the align control). It is still possible to label the whole block but this doesn’t present nicely (again more workarouds are possible, but this is MathJax rather than Quarto limitation.)
$$
\begin{aligned}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0\mathbf{J}
+ \mu_0\varepsilon_0\frac{\partial \mathbf{E}}{\partial t}
\end{aligned}
$$ {#eq-maxwell}\[ \begin{aligned} \nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\ \nabla \cdot \mathbf{B} &= 0 \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\ \nabla \times \mathbf{B} &= \mu_0\mathbf{J} + \mu_0\varepsilon_0\frac{\partial \mathbf{E}}{\partial t} \end{aligned} \tag{7.2}\]
7.5 Referencing Equations
Once labelled, equations can be referenced using:
Equation @eq-newton describes the relationship between force, mass and acceleration.Equation Equation 7.1 describes the relationship between force, mass and acceleration.
7.6 Newcommands and macros
To do: include a simple way to create custom maths macros for HTML/PDF outputs.