Advanced Math Manipulation

At this point, you should know how to properly typeset your mathematical idea. This article will provide you with advanced LaTeX elements and how to position them.

Dots

In LaTeX\LaTeX, to define horizontal, vertical and diagonal dots, we are provided with \ldots, \cdots, \vdots and \ddots.

  • \ldots for horizontal dots on the line

  • \cdots for horizontal dots above the line

  • \vdots for vertical dots

  • \ddots for diagonal dots

\documentclass{article}
\usepackage[textwidth=8cm]{geometry}
\begin{document}
\noindent First, let's take a look at the difference between \verb|\ldots| and \verb|\cdots| \\
\underline{\( \ldots \cdots \)} \\

\noindent Let's these all of them in action!
\[
\Sigma = \left[
\begin{array}{ccc}
\alpha_{11} & \cdots & \alpha_{1n} \\
\vdots & \ddots & \vdots \\
\alpha_{n1} & \cdots & \alpha_{nn}
\end{array}
\right] \quad \forall n=1,\ldots,100
\]
\end{document}
circle-info

The AMS (American Math Society) suggests that \cdots should be used between operators and relations (it has mathematical meaning), while \ldots should be used between variables with other punctuation (for readability purposes).

Regarding other Math symbols

I won't mention too much about symbols like \in, \subset, \cup, \cap, \land,     \impliesor \leq. These symbols are simple and can be typeset using a single command. You can check list of LaTeX\LaTeX symbols herearrow-up-right.

Arrays and Matrices

Arrays

In the previous dots example, I have coded a document which use array to present the dots. Arrays are good ways to typeset and store a collection of elements of the same type in a sequential manner. In order to use arrays, you need to define an array environment. The basic syntax for creating an array is:

circle-info

In this code example, the dots are unnecessary and can be removed.

Let's explain the code. First, we define the array environment by the pair \begin{array} and \end{array}. After that, we have a special properties called "column spec" - which defines the alignment of the columns. <row i, column j> is just the element.

circle-info

3 possible values of column spec: "l" - left, "r" - right, "c" - center. So for example: lcr, the first column will be left-aligned, the second one will be centered and so on.

You can combine arrays with the \left and \right command introduced in Brackets and Parentheses to create Matrices.

Here is an example of arrays in action:

Matrices

matrix is an environment that is bundled into the amsmath package, which could simplify the process of creating a matrix. Luckily, amsmath provides us with a lot of matrices with different delimeters:

Type
Environment name
Rendered as

Plain (no parentheses)

matrix

Parentheses

pmatrix

Brackets

bmatrix

Curly brackets

Bmatrix

Pipes

vmatrix

Double pipes

Vmatrix

The syntax is very simple. Let's take pmatrix as an example:

circle-info

If you want to know the difference between arrays and matrices, look at thisarrow-up-right page.

Display style in math mode

As mentioned in Math mode, there are 2 modes in LaTeX\LaTeX, display math mode and inline math mode. There will be a situation when you want to manually adjust the style of typeset mathematics. Right now, I'm typing a fraction f(x)=11+xf(x) = \frac{1}{1+x}. It's a bit small, so I enlarge it by changing to display math mode: f(x)=11+x\displaystyle f(x) = \frac{1}{1+x}, although it does impact heavily on the line spacing.

TeX engines provide several commands which can be used to override the default style in which a piece of math is typeset:

  • \textstyle: apply the style used for mathematics typeset in paragraphs (inline mode while in display math mode)

  • \displaystyle: apply the style used for mathematics typeset on lines by themselves (display math mode while in inline mode)

  • \scriptstyle: apply the style used for subscripts or superscripts (make your math smaller)

  • \scriptscriptstyle: apply the style used for second-order subscripts or superscripts (make your math smallest)

Let's look at this example to understand how it works:

Last updated