Math Manipulation
This is what LaTeX is famous for!
Last updated
This is what LaTeX is famous for!
Last updated
It's really easy to write basic equations in . Let's look at this example:
In this example, mathematical expressions are described inside the delimeter \( \)
or \[ \]
. However, how it is displayed depends on the choice of delimeter.
allows two writing modes for mathematical expressions: the inline math mode and display math mode.
inline math mode is used to write formulas that are part of a paragraph
display math mode is used to write expressions that are not part of a paragraph, and are therefore put on separate lines
There are 3 delimeters than can be used to typeset the mathematical expression:
\(...\)
$...$
\begin{math}...\end{math}
In display math mode, mathematical expressions are displayed on a separate line. You can use these delimeters to typeset your math:
$$...$$
\[...\]
\begin{displaymath}...\end{displaymath}
\begin{equation}...\end{equation}
\begin{equation*}...\end{equation*}
- only available when import amsmath
Let's have a look at this example:
In , numbers and letters are displayed without the need of any special syntax, numbers in math mode will be printed normally while letters will be printed in italics.
The use of superscripts and subscripts is very common in mathematical expressions involving exponents, indexes, and in some special operators.
Let's define an integral as an example:
The result is:
By convention, superscripts and subscripts in are created using the characters ^
and _
respectively. The command \limits
changes the way the limits are displayed in the integral, if not present the limits would be next to the integral symbol instead of being on top and bottom:
To summary, it just depends on the syntax to write these characters. Let's look at this example:
Parentheses and brackets are very common in mathematical formulas. provides a set of commands that provides you with brackets in different sizes and styles.
Parentheses
(x+y)
Brackets
[x+y]
Braces
\{x+y\}
Pipes
|x+y|
Double pipes
\|x+y\|
Let's take this equation for universal gravitation as an example:
By default, the size of the brackets are fixed, even in display math mode. In order for them to be dynamically resized, we can use the \left
and \right
command combine with the left/right brackets. Let's look at this example:
Thanks to the \left
and \right
command, we can create dynamically-resized pairs of brackets. However, even if you want to use only one bracket, both commands are mandatory. In order to solve this, we just need to put a dot after the command we want. Let's look at this exercise as an example:
In order to typeset binomial coefficients you need to use the command \binom
from amsmath
package:
Fractions, however, is more flexible. Its visual appearance will change depending on whether they appear in inline math mode, or typeset in display math mode. Let's look at this example:
As in the example, fraction is typeset using the \frac
command with the syntax \frac{numerator}{denominator}
However, if you want to write text as numerator or denominator, you can not typeset it normally, but you need to use the \text
command from amsmath
, which is used to prevent from typesetting the text as regular mathematical content. Here is the example:
Fractions can be nested, however, if they are deeply nested, may not produce ideal results. You can use \cfrac
from amsmath
to solve this.
In order to typeset square root, you can use the following command: \sqrt[index]{radicand}. Here is an example:
Limits can be displayed differently between inline and display math mode. Let's look at this example:
Regarding the symbol, you can also use \to
from amsmath
.
Integral expression can be typeset using the \int_{lower}^{upper}
command. And in order to get the final result by calculating with the upper and lower limit, you can use \vert
. Like limits, its display can be different between display math mode and inline math mode.
The default length of \vert
is pretty short, you can enhance that by using \big
or \bigg
.
You can also typeset double integrals, triple integrals using \iint
, \iiint
, respectively.
It's also noteworthy that you can change the place of the integral limits using the command \limits_{lower limit}^{upper_limit}
. This is also applied in inline math mode. Let's look at this example:
If you notice, you may see the notation placing too close to the equation. Therefore, I will introduce a set of command to create small "space" in your mathematical notion, which will beautify your math.
This can also be used in text environment, only integrals.
Like integral, Sigma notation and Pi notation use a similar syntax: \sum_{lower}^{upper}
and \prod_{lower}^{upper}
. Both of them may be displayed differently when in display math mode or inline math mode. Here is the example:
Vectors are a widely explored subject within Algebra. Therefore, in order to write this in , you need to import the esvect
package (this package must be manually installed). After that, you can use the command \vv
to create vector notations.
However, in some situations, you may have multiple vectors, and you may want to number them.
When it comes to calculating the dot product of 2 vectors, you may need a pair of angle brackets. The correct way to write it is \langle
and \rangle
("l" and "r" are left and right, respectively).
It all works, but it's standard to use \(...\)
to express math. If you want to know why, head to this .
It's suggested to use \[...\]
instead of $$...$$
. You can read more about this .
Every Greek letters can be written using a command. You can have a complete list of Greek characters . In addition, you can also use \mathbb
to display letters in blackboard-style. (\mathbb
need to be put in inline math mode)
As shown in the previous part of , if you type normal characters in math mode, it will become italics. As a result, when it comes to special functions like sine, cosine, tangent, you need to use a command to properly typeset them. Let's look at this example:
You can find a lot of commands for different operations .