LaTeX is a powerful typesetting system that excels at creating beautiful mathematical expressions. This tutorial will guide you from basic math notation to advanced mathematical typesetting.
If you are looking for instructions on how to write math and scientific expressions using the simpler AsciiMath format, use this tutorials.
1. Getting Started with Math Mode
In LaTeX, mathematical expressions are written in special "math mode." There are two types:
Inline Math
For math within a sentence, use single dollar signs:
Display Math
For standalone equations, use double dollar signs:
2. Escaping the Dollar Sign ($)
Since the dollar sign ($) is used to enter and exit math mode in LaTeX, you need special techniques to display an actual dollar sign in your text.
In Regular Text
To display a dollar sign in regular text (outside of math mode), use a backslash before the dollar sign:
In Math Mode
If you need to display a dollar sign within a mathematical expression, you have several options:
Method 1: Using \text{} command
Method 2: Using \$ within \text{}
Mixed Text and Math
3. Basic Mathematical Operations
Simple Operations
Operation | LaTeX Code | Result |
---|---|---|
Addition | \$a + b\$ | \$a + b\$ |
Subtraction | \$a - b\$ | $a - b$ |
Multiplication | \$a \times b\$ or \$a \cdot b\$ | $a \times b$ or $a \cdot b$ |
Division | \$a \div b\$ | $a \div b$ |
Equals | \$a = b\$ | $a = b$ |
Superscripts and Subscripts
4. Fractions and Roots
Fractions
Square Roots and Radicals
5. Greek Letters and Special Symbols
Common Greek Letters
Letter | Lowercase | Uppercase |
---|---|---|
Alpha | \$\\alpha\$ -- $\alpha$ | \$A\$ -- $A$ |
Beta | \$\\beta\$ -- $\beta$ | \$B\$ -- $B$ |
Gamma | \$\\gamma\$ -- $\gamma$ | \$\\Gamma\$ -- $\Gamma$ |
Delta | \$\\delta\$ -- $\delta$ | \$\\Delta\$ -- $\Delta$ |
Pi | \$\\pi\$ -- $\pi$ | \$\\Pi\$ -- $\Pi$ |
Sigma | \$\\sigma\$ -- $\sigma$ | \$\\Sigma\$ -- $\Sigma$ |
Theta | \$\\theta\$ -- $\theta$ | \$\\Theta\$ -- $\Theta$ |
Lambda | \$\\lambda\$ -- $\lambda$ | \$\\Lambda\$ -- $\Lambda$ |
Special Symbols
Symbol | LaTeX Code | Result |
---|---|---|
Infinity | \infty | $\infty$ |
Plus/minus | \pm | $\pm$ |
Not equal | \neq | $\neq$ |
Less than or equal | \leq | $\leq$ |
Greater than or equal | \geq | $\geq$ |
Approximately | \approx | $\approx$ |
6. Functions and Operators
Trigonometric Functions
Logarithms
Limits
7. Sums, Products, and Integrals
Summation
Product
Integrals
8. Matrices and Arrays
Basic Matrix
Matrix with Brackets
Determinant
9. Advanced Features
Multi-line Equations
Cases (Piecewise Functions)
Binomial Coefficients
Derivatives
10. Formatting Tips
Spacing
LaTeX automatically handles most spacing, but you can add manual spacing:
Command | Description | Example |
---|---|---|
\\, | Small space | \$a\\,b\$ vs \$ab\$ |
\\; | Medium space | \$a\\;b\$ |
\\quad | Large space | \$a\\quad b\$ |
\\qquad | Very large space | \$a\\qquad b\$ |
Text in Math Mode
Font Styles in Math
Style | Command | Example |
---|---|---|
Bold | \\mathbf{} | \$\\mathbf{x}\$ |
Italic | \\mathit{} | \$\\mathit{text}\$ |
Roman | \\mathrm{} | \$\\mathrm{d}x\$ |
Calligraphic | \\mathcal{} | \$\\mathcal{L}\$ |
Blackboard bold | \\mathbb{} | \$\\mathbb{R}\$ |
11. Common Mistakes to Avoid
Problem: This treats "sin" as three separate variables
Solution: Always use backslash before function names: \$\\sin x\$
Problem: Only the "2" is superscripted: \$x^2y\$
Solution: Use braces for multi-character exponents: \$x^{2y}\$
Problem: Inline fractions like \$\\frac{a+b}{c+d}\$ look cramped
Solution: Use display math: \$\$\\frac{a+b}{c+d}\$\$
Practice Exercises
Try writing these mathematical expressions:
- The quadratic formula: $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
- Euler's identity: $e^{i\pi} + 1 = 0$
- The binomial theorem: $(x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k$
- A 3×3 identity matrix
- The definition of a derivative using limits
Conclusion
This tutorial covers the fundamentals of LaTeX mathematical notation. With practice, you'll be able to create professional-looking mathematical documents. Remember to:
- Use curly braces {} for grouping
- Choose appropriate math mode (inline vs display)
- Use proper function names with backslashes
- Pay attention to spacing and alignment
For more advanced features and complete documentation, consult the LaTeX documentation and math symbol references available online.