Home   tech

# Katex syntax to write mathematical expressions in html

Here are 10 examples of KaTeX expressions along with their corresponding KaTeX syntax:

1. Square Root:

• Expression: √x
• KaTeX Syntax: <InlineMath math="\sqrt{x}" />
2. Fraction:

• Expression: ½
• KaTeX Syntax: <InlineMath math="\frac{1}{2}" />
3. Exponents:

• Expression: x²
• KaTeX Syntax: <InlineMath math="x^2" />
4. Summation:

• Expression: Σ (from 1 to n)
• KaTeX Syntax: <InlineMath math="\sum_{i=1}^{n}" />
5. Integral:

• Expression: ∫ (from a to b)
• KaTeX Syntax: <InlineMath math="\int_{a}^{b}" />
6. Matrix:

• Expression: [1, 2; 3, 4]
• KaTeX Syntax: <BlockMath math="\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}" />

• Expression: ∛(x + 1)
• KaTeX Syntax: <InlineMath math="\sqrt{x + 1}" />
8. Derivative:

• Expression: f'(x)
• KaTeX Syntax: <InlineMath math="f'(x)" />
9. Infinity:

• Expression: ∞
• KaTeX Syntax: <InlineMath math="\infty" />
10. Greek Letters:

• Expression: α, β, γ
• KaTeX Syntax: <InlineMath math="\alpha, \beta, \gamma" />

You can use these examples as templates for rendering various mathematical expressions and notations in your React application using KaTeX. Simply replace the content within the math attribute with the specific expression you want to display.

Published on: Sep 11, 2023, 10:11 PM
Updated on: Sep 11, 2023, 10:12 PM