# LaTeX by example: equations

Need help writing scientific and engineering documents with LaTeX? Use this sample document as a reference for equations and mathematics.

LaTeX (more formally stylized as LATEX) is a popular markup language that provides an incredibly versatile system to represent scientific and engineering documents. Getting started with typesetting equations and other mathematics can be daunting for the beginner, so we've provided this sample document to help you get started.

This sample file includes many of the common math symbols you might need in most documents. Use this file as a quick reference guide to formatting equations with LaTeX:

```
\documentclass{article} \begin{document}
\LaTeX\ makes it easy to write equations in a natural way.
You can write inline equations like $ A = \pi r^2 $ and
that works well if the equations don't take up too much
vertical space. If you need to write a more complicated
equation, use a block like this numbered equation:
\begin{equation}
x(t) = x_0 + v_0 t + \frac{1}{2} a t^2
\end{equation}
or this unnumbered equation: (solving for $t$)
$$
t = \sqrt{ \frac{2x}{a} }
$$
For most symbols, what you can type on your keyboard will
work in \LaTeX, such as $ x<3 $ and $ y>0 $ for less than
and greater than.
Other symbols require a backslash, such as these Greek
letters:
$$ \alpha \ldots \beta \ldots \gamma \ldots \delta $$
You can enter other symbols in a somewhat natural way. At
least, the abbreviations make sense after you see them,
such as $x \le 0$ or $y \ge 1$ or $z \ne 2$ for comparing
values. Or other symbols like $x \equiv z$ and
$\pi \approx 3.14$ for defining values in equations.
Engineers and scientists might also enter
$ x \to \infty $ for convergence, $ g = 9.81 \pm 0.01 $ to
indicate precision, or $ \overline{x} = 4.3 $ for a mean.
Also consider $\sum$ for sums, $\int$ for integrals and
$\partial$ for partial differentiation:
$$
\sum_{n=1}^{10} n = 55
$$
$$
\int e^x dx = e^x + C
$$
Be careful when entering trigonometric function names;
without a backslash, these will be interpreted as separate
symbols, such as:
$$ W = F \times d \times cos(\theta) $$
See how the ``cos'' name is in \textit{italics}, like it was
part of an equation? Instead, use a backslash to ``protect''
the function name inside the equation:
$$ W = F \times d \times \cos(\theta) $$
Do the same for other trigonometric functions like
$ \sin(\theta) \cos(\theta) \tan(\theta) $ or
$ \arcsin(x) \arccos(x) \arctan(x) $
\end{document}
```

Process this file using the `pdflatex`

command:

```
$ pdflatex math.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/CVE-2023-32700 patched) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./math.tex
LaTeX2e <2022-06-01> patch level 5
L3 programming layer <2022-12-17>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./math.aux) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./math.aux
) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></u
sr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/sha
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/share/texl
ive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/tex
mf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/share/texlive/texmf-dist/
fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/
type1/public/amsfonts/cm/cmti10.pfb>
Output written on math.pdf (1 page, 83170 bytes).
Transcript written on math.log.
```

For more information about how to typeset mathematics with LaTeX, refer to the LaTeX Project's Documentation website. The Userâ€™s Guide for the amsmath Package (Version 2.1) provides a full reference.

Download: latex-math.pdf