The Not So Short Introduction to LaTeX 2

\documentclass{article}

\begin{document}

Small is beautiful.

\end{document}

latex foo.tex

dvipdf foo.dvi

break a line: \\ or \newline

start a new line without starting a new paragraph \\*

\newpage

\linebreak[n], \nolinebreak[n], \pagebreak[n], \nopagebreak[n]

For the article class:

\section{}

\subsection{}

\subsubsection{}

\paragraph{}

\subparagraph{}

\part{}

\chapter{}

\tableofcontents{}

\footnote{footnote text}

If you want to typeset (advanced) mathematics, you should use AMS-LATEX. The AMS-LATEX bundle is a collection of packages and classes for mathematical typesetting. AMS-LATEX is produced by *The American Mathematical Society* and it is used extensively for mathematical typesetting. LATEX itself does provide some basic features and environments for mathematics, but they are limited and in some cases inconsistent.

AMS-LATEX is a part of the required distribution and is provided with all recent LATEX distributions. We assume amsmath is loaded in the preamble; \usepackage{amsmath}.

A mathematical formula can be typeset in-line within a paragraph (text style), or the paragraph can be broken and the formula typeset separately (display style). Mathematical equations within a paragraph are entered between $ and $.

\(a^2 + b^2 = c^2\)

\(\lim_{x \to 2} f(x) = 5\)

\(\lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}\)

If you want to name the equation something specific, you \tag it instead.

3.2.1 Math Mode

There are also differences between math mode and text mode. For example, in math mode:

- Most spaces and line breaks to not have any significance, as all spaces are either derived logically from the mathematical expressions, or have to be specified with special commands such as \, \quad or \qquad
- Empty lines are not allowed. Only one paragraph per formula.
- Each letter is considered to be the name of a variable and will be typeset as such.

\(\forall x \in \mathbf{R}: \qquad x^{2} \geq 0\)

\(x^{2} \geq 0\qquad \text{for all }x\in\mathbf{R}\)

Most of the commands in this section will not require amsmath, but load it anyways.

Lowercase Greek Letters are entered as \alpha, \beta, \gamma, and uppercase letters are entered as \Gamma, \Delta, ...

\(\lambda, \xi, \pi, \theta, \mu, \Phi, \Omega, \Delta\)

Exponents, Superscripts, and Subscripts can be specified using the ^ and _ characters. Most math mode commands act only on the next character, so if you want a command to affect several characters, you have to group them together using curly braces: {...}.

\(p^3_{ij}\)

\(m_\text{Knuth}\)

\(\sum_{k=1}^3 k\)

\(a^x+y \neq a^{x+y}\)

\(e^{x^2}\)

\({e^x}^2\)

The square root is entered as \sqrt; the nth root is generated with \sqrt[n]. The size of the root sign is determined automatically by LaTeX.

\(\sqrt{x} \Leftrightarrow x^{1/2}\)

\(\sqrt[3]{2}\)

\(\sqrt{x^{2} + \sqrt{y}}\)

\(\surd[x^2 + y^2]\)

The dot sign to indicate the multiplication operation is normally left out, it is sometimes written tho help the eye in grouping a formula. Use \cdot to typeset a single centered dot. \cdots is three centered dots while \ldots sets the dots low (on the baseline). Besides that, there are \vdots for vertical and \ddots for diagonal dots.

\(\Psi = v_1 \cdot v_2 \cdot \ldots\)

\(n! = 1 \cdot 2 \cdots (n-1) \cdot n\)

The commands \overline and \underline create horizontal lines directly over or under an expression.

\(0.\overline{3}\)

The commands \overbrace and \underbrace create long horizontal braces over or under an expression.

no \overbrace{a+b+c}

no \underbrace{a+b+c}

To add mathematical accents such as small arrows or tilde signs to variables, wide hats and tildes covering several characters are generated with \widetilde and \widehat.

The apostrophe mark ' gives a prime.

\(f(x) = x^2\)

\(f'(x) = 2x\)

\(f''(x) = 2\)

\(\hat{xy}\)

no \widehat{XY}

\(\bar{x_0}\)

\(\bar{x}_0\)

Vectors are often specified by adding small arrow symbols on the tops of variables. This is done with the \vec command. The two commands \overrightarrow and \overleftarrow are useful to denote the vector from A to B.

\(\vec{a}\)

\(\vec{AB}\)

no \overrightarrow{AB}

\(\lim_{X \rightarrow 0} \frac{\sin x}{x}=1\)

no \DeclareMathOperator

no a\bmod b

no x\equiv a \pmod{b}

A built-up fraction is typeset with the \frac{...}{...} command.

\(3/8\)

\(\frac{3}{8}\)

\(\tfrac{3}{8}\)

In text style: \(1\frac{1}{2}\)

\(1\dfrac{1}{2}\) hours

\partial command for partial derivatives is used.

\(\sqrt{\frac{x^2}{k+1}}\)

\(x^\frac{2}{k+1}\)

\(\frac{\partial^2f} {\partial x^2}\)

To typeset binomial coefficients or similar structures, use the command \binom from amsmath.

\(\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1}\)

no f_n(x) \stackrel{*}{\approx} 1

The integral operator is generated with \int, the sum operator with \sum, and the product operator with \prod. The upper and lower limits are specified with ^ and _ like subscripts and superscripts.

\(\sum_{i=1}^n\)

\(\int_0^{\frac{\pi}{2}}\)

\(\prod_\epsilon\)

LaTeX provides all sorts of symbols for bracketing and other delimiters.

\({a,b,c} \n

## Share on Social Media