Blog on GitHub Pages

Typesetting Math in Texts

Basic math

Whenever you typeset mathematical notation, it needs to have “Math” style. For example: If is an integer, then is odd.

Superscripts and subscripts are created using the characters ^ and _, respectively: and . It is fine to have both on a single letter: .

If the superscript [or subscript] is more than a single character, enclose the superscript in curly braces: .

Greek letters are typed using commands such as \gamma ( and \Gamma ().

Named mathematics operators are usually typeset in roman. Most of the standards are already available. Some examples: , , and .

Displayed equations

When an equation becomes too large to run in-line, you display it in a “Math” paragraph by itself.

The \begin{aligned}...\end{aligned} environment is superb for lining up equations.

To insert ordinary text inside of mathematics mode, use \text:

This is the time I’ve asked for my money back.

The \begin{cases}...\end{cases} environment is perfect for defining functions piecewise:

Relations and operations

  • Equality-like: , , , , , , , .

  • Order: , , , , , , .

  • Arrows: , , , , , .

  • Set stuff: , , . Use \notin rather than \not\in. , , .

  • Arithmetic: , , , , , , .

  • Mod: As a binary operation, use \bmod: . As a relation use \mod, \pmod, or \pod:

  • Calculus: , .

Use the right dots

Do not type three periods; instead use \cdots between operations and \ldots in lists: and .

Built up structures

  • Fractions: , .

  • Binomial coefficients: .

  • Sums and products. Do not use \Sigma and \Pi.

  • Integrals:

    The extra bit of space before the term is created with the \, command.

  • Limits:

    Also .

  • Radicals: , , .

  • Matrices:

    A big matrix:

Delimiters

  • Parentheses and square brackets are easy: , .

  • For curly braces use \{ and \}: .

  • Absolute value: , .

  • Floor and ceiling: .

  • To make delimiters grow so they are properly sized to contain their arguments, use \left and \right:

    Occasionally, it is useful to coerce a larger sized delimiters than \left/\right produce. Look at the two sides of this equation:

    I think the right is better. Use \bigl, \Bigl, \biggl, and the matching \bigr, etc.

  • Underbraces:

Styled and decorated letters

  • Primes: , .

  • Hats: , , , .

  • Vectors are often set in bold: .

  • Calligraphic letters (for sets of sets): .

  • Blackboard bold for number systems: .

The text above is based on a paper by Edward R. Scheinerman1.

A few more examples from mathTeX tutorial2.

Solution for quadratic:

Definition of derivative:

Continued fraction:

Demonstrating \left\{…\right. and accents.

Overbrace and underbrace:

Illustrating array:

See Wikibook on LaTeX for more examples.