Docs assistant

Searches these docs locally; a configured answer service can generate responses.

Ask about this page or the wider Carina docs. Try: “How do I roll back a patch?”

llms.txt

Skip to content

Markdown

Math notation

KaTeX-powered LaTeX in Carina docs — inline, display, matrices, and complex AMS layouts.

Carina docs render LaTeX with KaTeX at build time.

  • Inline: wrap with single dollars — $E = mc^2$E=mc2E = mc^2
  • Display: double dollars on their own lines
  • Escape hatch: <Math formula="..." /> for programmatic / very dense expressions

The Gaussian integral is ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}.

A policy score might be risk(c){0,1,2,3,4,5}\mathrm{risk}(c) \in \{0,1,2,3,4,5\} for command class cc.

E=ρε0,B=0,×E=Bt,×B=μ0J+μ0ε0Et\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0},\quad \nabla \cdot \mathbf{B} = 0,\quad \nabla \times \mathbf{E} = -\frac{\partial\mathbf{B}}{\partial t},\quad \nabla \times \mathbf{B} = \mu_0\mathbf{J} + \mu_0\varepsilon_0\frac{\partial\mathbf{E}}{\partial t} H(X)=xp(x)logp(x)=Exp[logp(x)]\begin{aligned} H(X) &= -\sum_{x} p(x)\log p(x) \\ &= \mathbb{E}_{x\sim p}\bigl[-\log p(x)\bigr] \end{aligned} (a11a12a1na21a22a2nam1am2amn)(x1x2xn)=(b1b2bm)\begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix} = \begin{pmatrix} b_1 \\ b_2 \\ \vdots \\ b_m \end{pmatrix} decision(a)={allowif risk(a)1approveif 2risk(a)3denyif risk(a)4\mathrm{decision}(a) = \begin{cases} \texttt{allow} & \text{if } \mathrm{risk}(a) \le 1 \\ \texttt{approve}& \text{if } 2 \le \mathrm{risk}(a) \le 3 \\ \texttt{deny} & \text{if } \mathrm{risk}(a) \ge 4 \end{cases}

Useful when the formula is built in JS or you want display isolation:

L(θ)=E(x,y)D[(fθ(x),y)]+λθ22θL=E[θ(fθ(x),y)]+2λθ \begin{aligned} \mathcal{L}(\theta) &= \mathbb{E}_{(x,y)\sim\mathcal{D}} \bigl[\ell(f_\theta(x), y)\bigr] + \lambda\,\|\theta\|_2^2 \\ \nabla_\theta \mathcal{L} &= \mathbb{E}\bigl[ \nabla_\theta \ell(f_\theta(x), y) \bigr] + 2\lambda\,\theta \end{aligned}
When KaTeX is not enough

KaTeX covers the vast majority of AMS math used in engineering docs. It does not run a full TeX engine (no arbitrary packages, limited TikZ). If you hit an unsupported construct:

  1. Simplify the expression, or
  2. Use a diagram (Mermaid) / figure for structure, or
  3. Pre-render to SVG offline and embed with <Frame>.

We intentionally did not ship full MathJax by default — it is heavier and rarely needed here.

NeedSyntax
Inline$a_i$
Display$$ … $$ on its own lines
Align\begin{aligned} … \end{aligned} inside $$
Matrix\begin{pmatrix} … \end{pmatrix}
Cases\begin{cases} … \end{cases}
Component<Math formula={String.raw} />

Dollar signs inside code fences are not math — they stay literal.

  • Rendering: KaTeX pipeline in apps/docs (Starlight + rehype)
  • Authoring: apps/docs/AUTHORING.md · component <Math>
  • Not a product feature of the runtime — docs-only

Was this page helpful?

One vote per page is recorded during this session.