Mathematics Documentation in Latex: How to Properly use Math Environments and Symbols
Writing mathematics in Latex seems to be a bit difficult at first. However, here I compiled a short summary on how you can write good mathematical expressions easily with examples.
I am assuming, you already know some basics how to write basic equations. Here, I show you how you can present and document it in well manner.
If you are new to Latex, this post might be helpful for you. Check Latex Resources in a Nutshell.
Environments
Within Paragraph/Texts
-
Use
$$
for mathematical expressions inside text. For example,$x^2 + y^2 = z^2$
will look like $x^2 + y^2 = z^2$. -
You can also use
parenthesis
for equations inside text. For example,\(x^2 + y^2 = z^2\)
will look like $x^2 + y^2 = z^2$ in the output document.
Outside Paragraph/Texts
- Use
\begin{equation}...\end{equation}
to write equations. Put your mathematical symbols within this environment and it will add an equation number as well.% With equation number \begin{equation} x^2 + y^2 = z^2 \end{equation}
To avoid equation number, use
\begin{equation*}...\end{equation*}
% Without equation number \begin{equation} x^2 + y^2 = z^2 \end{equation}
- Aligning equations is one of my favorite option and it can be done using
\begin{align*}...\end{align*}
. We actually use it to align several equations.\usepackage{amsmath} \begin{align*} x^2 + y^2 &= z^2 \\ x^3 + y^3 &= z^3 \end{align*}
Here,
&
helps to keep the equations aligned. Use\\
for newline. Or, you can use\begin{multline*}...\end{multline*}
.\begin{multline*} f(x) = (a^2 + b^2 + c^2 + d^2 + e^2 + f^2)\\ -(g^2 + h^2 + i^2 + j^2) \end{multline*}
- You can also simply use
\[...\]
and put mathematical expressions within this.\[ x^2 + y^2 = z^2 \]
Mathematics Symbols in Latex
You can find all necessary Latex commands in the following link-
http://cs.brown.edu/about/system/managed/latex/doc/symbols.pdf
As this is a public document, I embed here for your convenience.
Example Equations
Please check this Overleaf Document to find real different examples related to general equations, matrix, and calculus.
Leave a comment