Math & Chemistry
The [latex]...[/latex] shortcode typesets mathematics, chemical formulas, and physical quantities. Equations render as real, selectable text in PDF and as native, editable equations in Word — never as images.
{ "p": "The roots are [latex]x = frac{-b pm sqrt{b^2 - 4ac}}{2a}[/latex] for a != 0." }
The body is captured verbatim: nothing inside [latex]...[/latex] is scanned for other shortcodes, so ^, _, { }, and [ ] belong to the math grammar, not to the tag parser.
Backslash-free LaTeX
Commands are written without backslashes: frac{a}{b}, sqrt{x}, alpha, sum_{i=1}^n. The parser recognizes command names by longest match inside letter runs, so alphax reads as alpha followed by the variable x, while unrecognized letters stay ordinary italic variables (dx is just d·x).
Pasted-in standard LaTeX also works: a leading backslash is tolerated and ignored, so \frac{a}{b} and frac{a}{b} are equivalent.
Whitespace in the source is insignificant — math spacing is automatic, with explicit spacing commands when you want more.
Inline vs. display
An equation that is the entire paragraph (nothing but whitespace around the shortcode) renders in display (block) style — centered sizing, with sum/product limits above and below:
{ "p": "[latex]sum_{n=1}^{infty} frac{1}{n^2} = frac{pi^2}{6}[/latex]" }
An equation embedded in surrounding text renders inline, sized to flow with the line:
{ "p": "Euler's identity [latex]e^{i pi} + 1 = 0[/latex] links five constants." }
Scripts, fractions, roots
| Syntax | Renders | Notes |
|---|---|---|
x^2, x^{n+1} | superscript | braces group multi-token arguments |
x_i, x_{i,t} | subscript | combine freely: x_i^2 |
frac{a}{b} | stacked fraction | dfrac, tfrac, cfrac are accepted synonyms |
binom{n}{k} | binomial coefficient | dbinom, tbinom accepted |
sqrt{x} | square root | |
sqrt[3]{x} | cube root | optional bracketed degree, LaTeX-style |
root{n}{x} | n-th root | degree first, then radicand |
a / b | slash fraction | / stays on the line; use frac for stacked |
Fences and matrices
Parentheses ( ) and brackets [ ] render as grown fences around their content. Double brackets build a matrix — comma-separated cells in comma-separated rows:
{ "p": "[latex]A = [[a, b], [c, d]][/latex]" }
Commas inside a cell's own braces or scripts (for example p_{i,t}) never split the cell.
Pasted LaTeX environments are accepted and normalize to the same matrix rendering — begin{pmatrix} a & b \\ c & d end{pmatrix} and [[a, b], [c, d]] with parentheses produce identical output. Recognized environments: matrix, smallmatrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix, cases (left brace only), and the aligned/align/gathered/gather/split family (fenceless rows). & separates cells and \\ separates rows. The double-bracket form is the native way to write it.
Greek letters
Written by name. Lowercase renders italic like variables; uppercase renders upright, per TeX convention.
| Lowercase | Uppercase | ||
|---|---|---|---|
alpha beta gamma delta | α β γ δ | Gamma Delta | Γ Δ |
epsilon varepsilon zeta eta | ε ε ζ η | Theta Lambda | Θ Λ |
theta vartheta iota kappa | θ ϑ ι κ | Xi Pi | Ξ Π |
lambda mu nu xi | λ μ ν ξ | Sigma Upsilon | Σ Υ |
pi varpi rho varrho | π ϖ ρ ϱ | Phi Psi | Φ Ψ |
sigma varsigma tau upsilon | σ ς τ υ | Omega | Ω |
phi varphi chi psi omega | ϕ φ χ ψ ω |
Symbols and constants
| Name | Glyph | Name | Glyph |
|---|---|---|---|
infty | ∞ | forall | ∀ |
partial | ∂ | exists | ∃ |
nabla | ∇ | neg | ¬ |
emptyset | ∅ | degree | ° |
aleph | ℵ | prime | ′ |
ell | ℓ | cdots | ⋯ |
hbar | ℏ | ldots | … |
Re | ℜ | vdots | ⋮ |
Im | ℑ | ddots | ⋱ |
Number sets have double-letter shorthands rendering in blackboard bold: RR → ℝ, NN → ℕ, ZZ → ℤ, QQ → ℚ, CC → ℂ.
Operators and relations
Common operators are typed directly: +, -, *, /, =, <, >, and the two-character forms != (≠), <= (≤), >= (≥), -> (→). The rest are written by name:
| Binary operators | Relations | ||
|---|---|---|---|
pm mp | ± ∓ | ne / neq | ≠ |
times div cdot | × ÷ ⋅ | le / leq, ge / geq | ≤ ≥ |
ast star circ bullet | ∗ ⋆ ∘ ∙ | ll gg | ≪ ≫ |
cap cup | ∩ ∪ | approx cong equiv | ≈ ≅ ≡ |
wedge vee | ∧ ∨ | sim simeq propto | ∼ ≃ ∝ |
oplus otimes odot | ⊕ ⊗ ⊙ | in notin ni | ∈ ∉ ∋ |
setminus | ∖ | subset supset subseteq supseteq | ⊂ ⊃ ⊆ ⊇ |
langle rangle | ⟨ ⟩ |
Arrows: to / rightarrow (→), leftarrow (←), leftrightarrow (↔), mapsto (↦), Rightarrow (⇒), Leftarrow (⇐), iff (⇔).
Functions
Function names render upright, distinguishing them from italic variable runs: sin, cos, tan, cot, sec, csc, sinh, cosh, tanh, coth, arcsin, arccos, arctan, exp, log, ln, lg, lim, limsup, liminf, max, min, sup, inf, det, dim, ker, deg, gcd, arg, hom, mod.
{ "p": "[latex]lim_{x -> 0} frac{sin x}{x} = 1[/latex]" }
Large operators
sum, prod, coprod, bigcup, bigcap, bigvee, bigwedge, bigoplus, bigotimes, bigodot place their _ and ^ limits above and below in display style. Integrals — int, iint, iiint, oint — place their bounds to the side:
{ "p": "[latex]int_0^infty e^{-x^2} dx = frac{sqrt{pi}}{2}[/latex]" }
Accents
One-argument commands placing a diacritic over the argument: hat{x}, widehat{x}, bar{x}, overline{x}, vec{F}, dot{x}, ddot{x}, dddot{x}, tilde{x}, widetilde{x}, check{x}, acute{x}, grave{x}, breve{x}.
Letter styles
Variant commands restyle every letter of their argument:
| Command | Style | Example |
|---|---|---|
mathbf{...} | bold upright | mathbf{v} |
boldsymbol{...} | bold italic | boldsymbol{beta} |
mathbb{...} | blackboard bold | mathbb{R} |
mathcal{...} | calligraphic script | mathcal{L} |
mathfrak{...} | Fraktur | mathfrak{g} |
mathsf{...} | sans-serif | mathsf{T} |
mathtt{...} | monospace | mathtt{x} |
mathrm{...} | upright roman | mathrm{d}x |
Spacing
Explicit horizontal gaps, in em: quad (1), qquad (2), enspace (0.5), thickspace, medspace, thinspace, negthinspace (negative).
Plain words in math
text{...} (and textrm, textbf, textit) unwraps to plain upright, bold, or italic words with real word spacing — nothing inside is scanned as commands. It exists for LaTeX paste-in compatibility; you rarely need it, because shortcode math already lives inside a normal paragraph, so ordinary words belong outside the [latex] span:
{ "p": "The solution [latex]x = 2[/latex] holds if the matrix is singular." }
Paste-in synonyms
A few AsciiMath habits are accepted as aliases: oo and infinity (∞), xx (×), -: (÷), +- (±), -+ (∓), ** (∗), @ (∘), EE (∃), AA (∀), O/ (∅).
Chemistry — ce{...}
Inside a [latex] span, ce{...} switches to chemical-formula rules (an mhchem-style subset, also backslash-free):
{ "p": "[latex]ce{2H2 + O2 -> 2H2O}[/latex]" }
- Element symbols are upright; a trailing digit run is an automatic subscript:
H2O→ H₂O. - A leading or standalone digit is a coefficient:
2H2O. - Charges ride
^:SO4^2-→ SO₄²⁻,Ca^2+,Cl^-. - Reaction arrows:
->(→),<-(←),<=>(⇌ equilibrium). An arrow takes optional condition labels above and below:->[Delta]or->[cat][heat]. - Groups with
( )or[ ]take a trailing subscript:Ca(OH)2. - Hydrate dot:
CuSO4.5H2O→ CuSO₄·5H₂O. - Nuclide prescripts lead the element:
^{14}_{6}C→ ¹⁴₆C.
{ "p": "[latex]ce{N2 + 3H2 <=>[Fe] 2NH3}[/latex]" }
Physical quantities — pu{...}
pu{...} typesets a value-with-units: a number, a thin space, then upright units.
{ "p": "[latex]pu{9.81 m/s^2}[/latex] and [latex]pu{6.022e23 mol^-1}[/latex]" }
- Scientific notation:
6.022e23renders as 6.022 × 10²³ (anenot followed by digits is read as a unit letter). - Unit exponents with
^, including negatives:m/s^2,mol^-1,kg.m^{2}. /is a per-slash;.or*is a product dot:kg.m→ kg·m.%and°pass through:pu{25 °C},pu{99.9 %}.
Errors are visible
An unrecognized command never disappears silently — it renders as a visible inline marker (for example ⟨foo?⟩) so a typo is caught on the proof, not discovered as a blank spot.
Where it works
Like every shortcode, [latex] renders inside any text element: paragraphs, headings, th/td cells, list items, and columns cells — so equations can sit in tables of constants, formulary grids, or exam layouts.
See it in action
- Math & chemistry showcase — one-page specimen of the full surface
- Quantum mechanics formulary and reaction kinetics formulary
- Category theory & homological algebra — heavy display-math layout
- Certificate of analysis and control system qualification —
ce{}andpu{}in lab documents