Equations in Quarto (LaTeX Math)
quarto
latex
math
Inline math, display math, aligned equations, and a few practical tips.
This post is a quick reference for writing LaTeX math in Quarto.
Inline math
Use single dollar signs for inline equations: \(E = mc^2\).
Another example: the normalized score is \(\hat{s} = \frac{s - \min(s)}{\max(s) - \min(s)}\).
Display math
Use double dollar signs for centered display equations:
\[ \mathrm{score}(q, d) = \alpha \cdot \mathrm{BM25}(q,d) + (1-\alpha)\cdot \mathrm{sim}(q,d) \]
Multi-line and aligned equations
Use an aligned block inside display math:
\[ \begin{aligned} \mathrm{RRF}(d) &= \sum_{m \in M} \frac{1}{k + \mathrm{rank}_m(d)} \\ \hat{s}(d) &= \frac{s(d) - \min(s)}{\max(s) - \min(s)} \end{aligned} \]
Common symbols
- Greek letters: \(\alpha, \beta, \gamma, \lambda\)
- Vectors: \(\mathbf{v}\), norms: \(\lVert \mathbf{v} \rVert_2\)
- Sets: \(\{x \mid x > 0\}\)
Tips
- Inline:
$...$and display:$$...$$ - Use
\\for line breaks insidealigned - If math ever renders as raw text, confirm you are rendering HTML and that MathJax/KaTeX is enabled.