Mathematical Terms in LaTeX

Afnan Mostafa
The Startup
Published in
5 min readNov 28, 2020

So to initiate, we need to declare the type of document we want to have our project printed in; that is, whether we want an article or a book-type document.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

Then, we need some packages to help the LaTeX compiler understand the lines we are going to write. \usepackage{amsmath}- this is the package we need to use some commands, such as double integral, triple integral, and many more. AMS stands for American Mathematical Society.

There are 2 ways to write mathematical expressions in LaTeX:
1. In-line Mode: $ . . . . . $ or \(….\)
2. Display Mode: $$ . . . . . . $$ or \[ ….\]

The in-line mode is used if we want to inscribe equations within a text-line, while display mode provides an equation with a separate, dedicated line.

In-line Mode:

Albert Einstein’s famous energy-mass equation, $ E = mc^ 2 $ is one of the greatest marvels of this universe.

The above code-snippet will result in something like this:

Display Mode:

Albert Einstein’s famous energy-mass equation, $$ E = mc^ 2 $$ is one of the greatest marvels of this universe.

Thus the output will be:

The well known Pythagorean theorem \(x^ 2 + y^ 2 = z^ 2\) was
proved to be invalid for other exponents.
Meaning the next equation has no integer solutions:

\[ x^n + y^n = z^n \]

3 Differences Between Equation-like Characters and Text-like Characters:

\begin{equation}
x = y + z
\end{equation}

Output:

We can ignore the \begin{equation} and \end{equation} part for simpler equations, but then the font will be changed. Spot out the 3 differences between these two images.

x = y + z

Output:

In the first image, we can see the equation is numbered, unlike in the later image. Next, the first equation is positioned middle of the page, while in the latter case, the equation is regarded more as a text than as an equation; thus the leftmost alignment. Finally, the fonts are different. The font in the first image is more math-like than in the second image. So, to be on the beautiful side of LaTeX’s mathematical equations’ depiction, we should use the former method for math terms.

\begin{equation*}
x^ 2 + y^ 2 = Z^ 2
\end{equation*}

Asterisk (*) is used when we do not want the equation to be numbered.

Writing Multiple Equations:

To write multiple equations, we CANNOT use \begin{equation} method. Rather, we have to use \begin{align} and end\{align}. \\ is used to move to the next line/row.

\begin{align*}
y = x + a \\
i = av \\
a + b = c \\
x^ 2 + y^ 2 = Z^ 2
\end{align*}

Here, the equations are not aligned. So, to align, we have to use an ampersand (&) at each place where we want the equations to be aligned. So, to align at the equal sign, we have to write:

\begin{align*}
y &= x + a\\
i &= a*v\\
a + b &= c\\
x^ 2 + y^ 2 + z^ 2 &= 1
\end{align*}

Or, for left-alignment:

\begin{align*}
& y = x + a\\
& i = a*v\\
& a + b = c\\
& x^ 2 + y^ 2 + z^ 2 = 1
\end{align*}

By default, they are right-aligned.

X vs. \(x\):

x is equal to 7
\(x\) is equal to \(7\)

Split, Label, Refer:

The environment split is used inside an equation environment to split the equation into smaller pieces which will be aligned accordingly. This will not enumerate each step of an equation. Let’s have a good look at this.

With Split:

\begin{equation} \label{eqn1}
\begin{split}
A & = \frac{\pi r^ 2}{2} \\
& = \frac{1}{2} \pi r^ 2
\end{split}
\end{equation}

Without Split:

\begin{align} \label{eqn2}
A & = \frac{\pi r^ 2}{2} \\\label{eqn3}
& = \frac{1}{2} \pi r^ 2
\end{align}
The equation \ref{eqn2} states the area of a circle.\\
The equation \ref{eqn3} states the area of a circle.

\ref{..} results in the number only, like 1 or 2, whereas \eqref{..} gives out the number with parentheses, (1) or (2).

Some Typical Commands:

$$ \frac{x}{z} $$
$$ \frac{dx}{dz} $$
$$ \frac{\partial x}{\partial z} $$

Schrödinger’s Equation:

$$ H \Psi(x) = E \Psi(x) $$

$$ \left(-\frac{\hbar^ 2}{2m}\nabla^ 2+ V(r)\right)\Psi(r,t) = -\frac{i}{\hbar} {\frac{\partial}{\partial t}\Psi(r,t)} $$

Matrices can be formed by using \begin{pmatrix}. The environment pmatrix makes matrices enclosed in parentheses. Other matrix environments include matrix (no parentheses), bmatrix (for [ ]), and vmatrix (for | |). In the picture below, first matrix is created using {matrix}, then the next matrices are created using {pmatrix}, {bmatrix}, and {vmatrix} environments. A code-snippet of bmatrix environment, […], is shown below:

\[ \begin{bmatrix}
a & b\\
c & d
\end{bmatrix} \]

Let’s end this with a small detail that is ignored by most- the difference between \cdots and \ldots.

Similarly, \vdots is used for vertical dots and \ddots is for diagonal dots.

That’s all for now. I will try to continue this LaTeX series if I get positive feedback from the readers. Everyone knows, more or less about LaTeX, so it would be highly appreciated if anyone is benefitted through this article, no matter however trifling that might be. Thank you for reading my article. 😃

--

--

The Startup
The Startup

Published in The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

No responses yet