Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Math

    TeX math typeset with KaTeX. Formula sits inside a sentence; Equation stands on its own line, numbered and captioned when you want. Screen readers get real MathML, and chemistry is one \ce away.

    Install

    npx shadcn@latest add @nelumbo/math

    Usage

    import { Equation, Formula } from "@/components/ui/math"​// String.raw keeps backslashes as written<p>The rate is <Formula>{String.raw`v = \frac{V_{max}[S]}{K_m + [S]}`}</Formula>.</p>​<Equation number={1} caption="Michaelis–Menten">  {String.raw`v = \frac{V_{\max}[S]}{K_m + [S]}`}</Equation>

    Inline

    Formula takes the size of the text around it and sits on its baseline.

    At low substrate the rate is nearly linear, v≈Vmax⁡Km[S]v \approx \tfrac{V_{\max}}{K_m}[S], and it saturates at Vmax⁡V_{\max} when [S]≫Km[S] \gg K_m. A buffer works best within one unit of its pKa\mathrm{p}K_a, where [A−]≈[HA][\mathrm{A^-}] \approx [\mathrm{HA}].

    Numbered equations

    number puts a reference on the right; caption names the equation. Hover or focus to copy the TeX.

    v=Vmax⁡ [S]Km+[S]v = \frac{V_{\max}\,[S]}{K_m + [S]}
    (1)
    Michaelis–Menten kinetics
    θ=[L]nHKd+[L]nH\theta = \frac{[L]^{n_H}}{K_d + [L]^{n_H}}
    (2)
    Hill equation, cooperative binding
    pH=pKa+log⁡10[A−][HA]\mathrm{pH} = \mathrm{p}K_a + \log_{10} \frac{[\mathrm{A^-}]}{[\mathrm{HA}]}
    (3)
    Henderson–Hasselbalch

    Aligned derivations

    aligned lines several steps up on their equals signs. This is the steady-state derivation of Michaelis–Menten.

    k1[E][S]=(k−1+k2)[ES][E]=[E]0−[ES][ES]=[E]0[S]Km+[S],Km=k−1+k2k1v=k2[ES]=Vmax⁡[S]Km+[S]\begin{aligned} k_1[E][S] &= (k_{-1} + k_2)[ES] \\ [E] &= [E]_0 - [ES] \\ [ES] &= \frac{[E]_0 [S]}{K_m + [S]}, \qquad K_m = \frac{k_{-1} + k_2}{k_1} \\ v = k_2[ES] &= \frac{V_{\max}[S]}{K_m + [S]} \end{aligned}
    (4)

    Populations, light and membranes

    Fractions, sums, derivatives, cases and Greek letters.

    p2+2pq+q2=1p^2 + 2pq + q^2 = 1
    Hardy–Weinberg equilibrium
    dNdt=rN(1−NK)\frac{dN}{dt} = rN\left(1 - \frac{N}{K}\right)
    Logistic growth
    A=ε ℓ c=log⁡10I0IA = \varepsilon\, \ell\, c = \log_{10} \frac{I_0}{I}
    Beer–Lambert law
    EK=RTzFln⁡[K+]out[K+]inE_{\mathrm{K}} = \frac{RT}{zF} \ln \frac{[\mathrm{K^+}]_{\text{out}}}{[\mathrm{K^+}]_{\text{in}}}
    Nernst potential
    Ri=log⁡24−(−∑b∈{A,C,G,T}fb,ilog⁡2fb,i)R_i = \log_2 4 - \left(-\sum_{b \in \{A,C,G,T\}} f_{b,i} \log_2 f_{b,i}\right)
    Shannon information, per position of a sequence logo
    Kij∼NB(μij,αi),log⁡2qij=∑rxjrβirK_{ij} \sim \mathrm{NB}(\mu_{ij}, \alpha_i), \quad \log_2 q_{ij} = \sum_r x_{jr} \beta_{ir}
    DESeq2 count model

    Chemistry

    mhchem is built in: \ce writes reactions with proper arrows, charges and states, and \pu writes units.

    ATP+HX2O→ADP+PXiΔG∘′=−30.5 kJ mol−1\ce{ATP + H2O -> ADP + P_i} \qquad \Delta G^{\circ\prime} = \pu{-30.5 kJ mol-1}
    ATP hydrolysis
    COX2+HX2O⇌HX2COX3⇌HX++HCOX3X−\ce{CO2 + H2O <=> H2CO3 <=> H+ + HCO3-}
    Bicarbonate buffer
    CX6HX12OX6+6 OX2→6 COX2+6 HX2O\ce{C6H12O6 + 6 O2 -> 6 CO2 + 6 H2O}
    Glucose oxidation

    Matrices and cases

    Rotation about z, used to turn a structure, and a piecewise dose response.

    Rz(θ)=(cos⁡θ−sin⁡θ0sin⁡θcos⁡θ0001)R_z(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{pmatrix}
    E(c)={0c<cthEmax⁡ chEC50h+chc≥cthE(c) = \begin{cases} 0 & c < c_{\text{th}} \\ E_{\max}\,\dfrac{c^{h}}{EC_{50}^{h} + c^{h}} & c \ge c_{\text{th}} \end{cases}

    Try it

    Type TeX and it typesets as you go. An error shows the source and what went wrong, instead of breaking the page.

    ΔG=ΔG∘′+RTln⁡[ADP][Pi][ATP]\Delta G = \Delta G^{\circ\prime} + RT \ln \frac{[\mathrm{ADP}][\mathrm{P_i}]}{[\mathrm{ATP}]}

    Props

    PropTypeDefaultNotes
    children / texstring—The TeX source. String.raw saves escaping backslashes.
    macrosRecord<string, string>—Shortcuts, e.g. { "\\R": "\\mathbb{R}" }.
    Equation numberReactNode—Reference at the right, in parentheses.
    Equation captionReactNode—A short caption under the equation.
    Equation align"center" | "start""center"Where the equation sits.
    Equation copyablebooleantrueA button that copies the TeX source.