TeX Frequently Used

Math Mode ($ vs. $$)

Putting text between dollar signs will activate "math mode" where you can format equations and code in TeX.


A single pair of dollar signs (e.g. $y = mx + b$) produces in-line math mode (i.e. insert symbol $\lambda$). This is used to distinguish math from text.

Example:

$_example
By the Lemma from Section 2.3, the difference of any two solutions of the nonhomogeneous equation $L[y]=g(t)$ is a solution of the homogeneous equation $L[y]=0$.

Displays as:


A pair of dollar signs (e.g. $$y = mx + b$$) will bump it to a new line and center it on the assignment page in a more prominent display.

Example:

$$_example
$$ \eqalign {
2x &= 3y \cr
2x^2 &= 3y + 2z \cr
x^3 &= 3x^{@e}
} $$

Displays as:

Notice that:

  • \eqalign is used for equation alignment for aligning multi-line displays at a single place
  • Each line is aligned by centering on the ampersand ("&")

  • A carriage return is inserted after every "\cr"

  • Only the code between "$$ { . . . } $$" is shown


Commonly Used TeX Markup Tools

All of the following, plus more, can be accessed on the TeX Reference Card!

Tool CategoryItemTeX Code
Elementary Math Control Sequences

Fraction

(overline is for larger

equations)

{<numerator>\over <denominator>}

\overline{ . . . }

Square root\sqrt{<expression>}
Integral\int_{lower bound}^{upper bound} {<expression>}
Formatting Alignment and SpacingIndentation\indent{ . . . }
No Indentation\noindent{ . . . }
Alignment\eqalign{ . . . }

Horizontal Spacing

(spacing within text)

\;

\enspace

Vertical Spacing of

various sizes

\smallskip

\medskip

\bigskip

Text FormattingBold font\bf{ . . . }
Superscript<variable>^{<subscript expression>}
Subscript<variable>_{<subscript expression>}
Displaying Dollar Sign$\$


Tips for Using TeX

  1. Incorrect use of curly braces can cause errors, so make sure that for each opening bracket there is a corresponding closing one (and vice versa)
  2. To call variables define in the code field,  prepend it with '@'
    Example: "@ans1" calls variable ans1
  3. Feel free to Google what you're looking for with TeX as well