Skip to content

Supported LaTeX Commands ​

This document provides a reference of all LaTeX commands supported by the texpr library.

Quick Reference ​

CategoryCommands
Arithmetic+, -, *, /, ^, \times, \cdot, \div
Calculus\frac, \int, \iint, \iiint, \sum, \prod, \lim, \partial, \nabla
Functions\sin, \cos, \tan, \log, \ln, \sqrt, \exp, \abs
Greek\alpha–\omega, \Alpha–\Psi, \varepsilon, \varphi
Matrices\begin{matrix}, \begin{pmatrix}, \begin{bmatrix}
Special\binom, \infty, \pi, \text{}, \mathbf{}
Logic\forall, \exists, \Rightarrow, \Leftarrow, \Leftrightarrow
Sets\subset, \subseteq, \cup, \cap, \setminus
Decoration\dot, \ddot, \bar, \overline
Variableslet, f(x) = ...

Arithmetic Operators ​

LaTeXDescriptionExample
+Addition3 + 4 to 7
-Subtraction5 - 2 to 3
* or \timesMultiplication3 \times 4 to 12
/ or \divDivision8 \div 2 to 4
^Exponentiation2^{10} to 1024
\cdotDot product / Multiplication\vec{a} \cdot \vec{b}

Implicit Multiplication: The parser supports implicit multiplication:

latex
2x         to 2 * x
xy         to x * y
2\pi r     to 2 * π * r
\sin x \cos x to sin(x) * cos(x)

Mathematical Functions ​

Trigonometric Functions ​

For more details, see Function Reference.

LaTeXDescriptionComplex Support
\sin{x}Sine✅
\cos{x}Cosine✅
\tan{x}Tangent✅
\cot{x}Cotangent✅
\sec{x}Secant✅
\csc{x}Cosecant✅

Inverse Trigonometric Functions ​

LaTeXAliasDescription
\arcsin{x}\asin{x}Inverse sine
\arccos{x}\acos{x}Inverse cosine
\arctan{x}\atan{x}Inverse tangent
\arccot{x}\acot{x}Inverse cotangent
\arcsec{x}\asec{x}Inverse secant
\arccsc{x}\acsc{x}Inverse cosecant

Hyperbolic Functions ​

LaTeXDescriptionComplex Support
\sinh{x}Hyperbolic sine✅
\cosh{x}Hyperbolic cosine✅
\tanh{x}Hyperbolic tangent✅
\coth{x}Hyperbolic cotangent✅
\sech{x}Hyperbolic secant✅
\csch{x}Hyperbolic cosecant✅

Inverse Hyperbolic Functions ​

LaTeXDescription
\asinh{x}Inverse hyperbolic sine
\acosh{x}Inverse hyperbolic cosine
\atanh{x}Inverse hyperbolic tangent
\acoth{x}Inverse hyperbolic cotangent
\asech{x}Inverse hyperbolic secant
\acsch{x}Inverse hyperbolic cosecant

Logarithmic & Exponential Functions ​

For more details, see Function Reference.

LaTeXDescriptionExample
\ln{x}Natural logarithm\ln{e} to 1
\log{x}Logarithm base 10\log{100} to 2
\log_{b}{x}Logarithm base b\log_{2}{8} to 3
\exp{x}Exponential (e^x)\exp{1} to e

Power & Root Functions ​

LaTeXDescriptionExample
\sqrt{x}Square root\sqrt{16} to 4
\sqrt[n]{x}n-th root\sqrt[3]{27} to 3

Rounding Functions ​

LaTeXDescriptionExample
\floor{x}Floor (round down)\floor{3.7} to 3
\ceil{x}Ceiling (round up)\ceil{3.2} to 4
\round{x}Round to nearest\round{3.5} to 4

Other Functions ​

For more details, see Function Reference.

LaTeXDescriptionExample
\abs{x} or |x|Absolute value\abs{-5} to 5
\sgn{x} or \sign{x}Sign function\sgn{-3} to -1
\min{a, b}Minimum\min{3, 5} to 3
\max{a, b}Maximum\max{3, 5} to 5
\gcd{a, b}Greatest common divisor\gcd{12, 8} to 4
\lcm{a, b}Least common multiple\lcm{4, 6} to 12
\factorial{n} or n!Factorial\factorial{5} to 120
\fibonacci{n}Fibonacci number\fibonacci{10} to 55

Decoration Functions (Pass-through) ​

These functions wrap an expression but return the evaluated value of the argument during numerical computation.

LaTeXDescriptionExample
\dot{x}Time derivative\dot{5} to 5
\ddot{x}Second derivative\ddot{5} to 5
\bar{x}Bar / Mean\bar{5} to 5
\overline{x}Overline\overline{5} to 5

Complex Number Functions ​

For more details, see Function Reference.

LaTeXDescriptionExample
\Re{z}Real part\Re{3 + 4i} to 3
\Im{z}Imaginary part\Im{3 + 4i} to 4
\conjugate{z} or \overline{z}Complex conjugate\conjugate{3 + 4i} to 3 - 4i

Calculus Notation ​

For more details, see Calculus.

Fractions ​

latex
\frac{numerator}{denominator}

Example: \frac{x^2 + 1}{x - 1}

Derivatives ​

SyntaxDescription
\frac{d}{dx}(f)First derivative
\frac{d^2}{dx^2}(f)Second derivative
\frac{d^n}{dx^n}(f)n-th derivative
\frac{\partial}{\partial x}(f)Partial derivative
\frac{\partial^2}{\partial x^2}(f)Second partial derivative

Integrals ​

LaTeXDescription
\int{f} dxIndefinite integral
\int_{a}^{b}{f} dxDefinite integral
\iint{f} dx dyDouble integral
\iiint{f} dx dy dzTriple integral

Example:

latex
\int_{0}^{\pi} \sin{x} dx
\iint{x^2 + y^2} dx dy

Summation & Products ​

LaTeXDescriptionExample
\sum_{i=a}^{b}{f}Summation\sum_{i=1}^{10}{i} to 55
\prod_{i=a}^{b}{f}Product\prod_{i=1}^{5}{i} to 120

Limits ​

latex
\lim_{x \to a} f(x)

Example: \lim_{x \to 0} \frac{\sin{x}}{x} to 1

Binomial Coefficient ​

latex
\binom{n}{k}

Example: \binom{10}{3} to 120

Special Symbols ​

LaTeXDescription
\partialPartial derivative symbol (∂)
\nablaGradient operator (∇)
\inftyInfinity (∞)
\to or \rightarrowArrow (to)
\mapstoMaps to (↦)
\RightarrowDouble right arrow (⇒)
\LeftarrowDouble left arrow (⇐)
\LeftrightarrowDouble left-right arrow (⇔)

Greek Letters ​

For more details, see standard Greek letter symbols below.

Lowercase Greek ​

LaTeXSymbolLaTeXSymbolLaTeXSymbol
\alphaα\iotaι\rhoρ
\betaβ\kappaκ\sigmaσ
\gammaγ\lambdaλ\tauτ
\deltaδ\muμ\upsilonυ
\epsilonε\nuν\phiφ
\zetaζ\xiξ\chiχ
\etaη\omicronο\psiψ
\thetaθ\piπ\omegaω

Uppercase Greek ​

LaTeXSymbolLaTeXSymbolLaTeXSymbol
\GammaΓ\LambdaΛ\PhiΦ
\DeltaΔ\XiΞ\PsiΨ
\ThetaΘ\PiΠ\OmegaΩ
\SigmaΣ\UpsilonΥ

Variant Greek Letters ​

LaTeXDescription
\varepsilonVariant epsilon (ε)
\varphiVariant phi (φ)
\varrhoVariant rho (ρ)
\varthetaVariant theta (θ)
\varpiVariant pi (ϖ)
\varsigmaFinal sigma (ς)

Variables & Functions ​

For more details, see Count Environments.

CommandDescriptionExample
let x = ...Variable assignmentlet x = 5
f(x) = ...Function definitionf(x) = x^2

Mathematical Constants ​

For more details, see Constants.

LaTeXValueDescription
\pi3.14159...Pi
\tau6.28318...Tau (2π)
\phi1.61803...Golden ratio
e2.71828...Euler's number
i√(-1)Imaginary unit
\hbar1.054... * 10⁻³⁴Reduced Planck constant
\infty∞Infinity

Matrix & Vector Notation ​

For more details, see matrix and vector sections below.

Matrix Environments ​

EnvironmentDescriptionDelimiters
\begin{matrix}...\end{matrix}Plain matrixNone
\begin{pmatrix}...\end{pmatrix}Parenthesized( )
\begin{bmatrix}...\end{bmatrix}Bracketed[ ]
\begin{vmatrix}...\end{vmatrix}Determinant| |
\begin{align}...\end{align}Aligned equationsNone

Matrix Syntax ​

latex
\begin{pmatrix}
  a & b \\
  c & d
\end{pmatrix}
  • Use & to separate columns
  • Use \\ to separate rows

Matrix Functions ​

LaTeXDescription
\det{A}Determinant
\trace{A} or \tr{A}Trace
A^TTranspose
A^{-1}Inverse

Vector Notation ​

LaTeXDescription
\vec{v}Vector (arrow notation)
\hat{v}Unit vector

Comparison Operators ​

LaTeXSymbolDescription
==Equal
\neq≠Not equal
<<Less than
>>Greater than
\leq≤Less than or equal
\geq≥Greater than or equal
\approx≈Approximately equal
\propto∝Proportional to

Set Notation & Logic ​

LaTeXSymbolDescription
\in∈Element of
\subset⊂Proper subset
\subseteq⊆Subset or equal
\supset⊃Proper superset
\supseteq⊇Superset or equal
\cup∪Union
\cap∩Intersection
\setminus\Set difference
\forall∀For all
\exists∃There exists

Spacing Commands ​

These commands are recognized but ignored during evaluation (they're for display only):

LaTeXDescription
\,Thin space
\;Medium space
\:Thick space
\!Negative thin space
\quadQuad space
\qquadDouble quad space
\thinspaceThin space (alias)

Delimiter Sizing ​

These commands are recognized but ignored during parsing:

LaTeXDescription
\left( ... \right)Auto-sizing parentheses
\big( ... \big)Big parentheses
\Big( ... \Big)Bigger parentheses
\bigg( ... \bigg)Even bigger
\Bigg( ... \Bigg)Largest

Font Commands ​

Font styling commands wrap content and preserve it for LaTeX round-trip:

LaTeXDescriptionOutput Variable
\mathbf{E}Boldmathbf:E
\mathcal{L}Calligraphicmathcal:L
\mathrm{d}Roman (upright)mathrm:d
\mathit{x}Italicmathit:x
\mathsf{A}Sans-serifmathsf:A
\mathtt{x}Typewritermathtt:x
\textbf{text}Bold texttextbf:text
\boldsymbol{x}Bold symbolboldsymbol:x

Text Mode ​

latex
\text{some text}

Text within \text{} is treated as a single variable/token.


Escaped Characters ​

LaTeXResult
\{Literal {
\}Literal }
\\Line break (in align)

Usage Notes ​

Function Arguments ​

Functions can take arguments in several ways:

latex
\sin{x}       % Recommended: braces
\sin(x)       % Also works: parentheses
\sin x        % Works with implicit multiplication enabled

Order of Operations ​

Standard mathematical precedence applies:

  1. Parentheses and braces
  2. Exponentiation (right-to-left)
  3. Unary minus
  4. Multiplication and division (left-to-right)
  5. Addition and subtraction (left-to-right)
  6. Comparisons

Complex Number Support ​

Use i for the imaginary unit:

latex
3 + 4i
e^{i\pi}
\sqrt{-1}     % Returns i
\sin{1 + 2i} % Complex trigonometry

Textbook Notation Compatibility ​

The parser supports common textbook notation for copy-paste compatibility:

Function Power Notation:

latex
\sin^2{x} + \cos^2{x}    % Pythagorean identity
\tan^3{\theta}           % Third power of tangent
\sin^{-1}{x}             % Power of -1 on sin

Multi-argument Function Calls:

latex
f(x,y)                   % Function with multiple arguments
g(a,b,c)                 % Function with 3 arguments
\iint_{D} f(x,y) dx dy   % Double integral with function notation

Made with ❤️ by TeXpr, Docs Inspired by ElysiaJS