Using LaTeX for Math Equations

it's pronounced latec.
02 Dec 2023

LaTeX is a high-quality typesetting system mostly used for stuff like academic papers and lets you do cool math equations like this:

x=b±b24ac2ax = \frac{-b\pm\sqrt{b^{2}- 4ac}}{2a}

and underneath the compiler, is this:

x = \frac{-b\pm\sqrt{b^{2}- 4ac}}{2a}

LaTeX is also commonly used in apps such as notion or obsidian for your math notes, or web blogs for math snippets with KaTeX or MathJax. (This website is running KaTeX.)

Even though LaTeX can be used for text, we're mainly going to focus on math here. For more in depth LaTeX commands and extensions, you can scroll to the bottom.

Inline vs. Block

Usually, on apps like notion or obsidian, you get to choose between using inline(y=mx+cy = mx + c) or block:

a2+b2=c2a^{2} + b^{2} = c^{2}

to display the formula differently. and this is typically done with a single '$' sign for $inline$ and a double '$$' for

$$
block
$$

I like to use blocks for equations that are more important, and inline for constants or less important equations.


Symbols and Functions

Operators

some operators, like ++ and - can be typed normally, but others like ×\times \times or ÷\div \div can't. So you will have to check the cheat sheet if you want to know if your operator can be typed with a command or not.

Trigonometry

instead of just typing 'tan' or 'sin', use \tan or \sin. LaTeX fanboys get very salty about this.

with backslash \sin(360): sin(360)\sin(360)

without sin(360): sin(360)sin(360)

Greek Letters

for greek symbols, use the backslash before typing the name of the letter.

e.g. \eta: η\eta

for upper case, just capitalize the first letter:

e.g. \Sigma: Σ\Sigma

Super and subscripts

base^{superscript}
x2x^2
base_{subscript}
x1x_1

Radicals

\sqrt[index]{radicand}
83=2\sqrt[3]{8} = 2

Fractions

\frac{numerator}{denominator}
22\frac{\sqrt{2}}{2}

Matrices

Here are different ways to make matrices in LaTeX. The & is used to separate values into columns and the \\ is for denoting a new line (row). These examples were taken from https://www.overleaf.com/learn/latex/Matrices.

Plain

\begin{matrix} 1 & 2 & 3 \\ a & b & c \end{matrix}
123abc\begin{matrix} 1 & 2 & 3 \\ a & b & c \end{matrix}

Parentheses (Round)

\begin{pmatrix} 1 & 2 & 3 \\ a & b & c \end{pmatrix}
(123abc)\begin{pmatrix} 1 & 2 & 3 \\ a & b & c \end{pmatrix}

Brackets (Square)

\begin{bmatrix} 1 & 2 & 3 \\ a & b & c \end{bmatrix}
[123abc]\begin{bmatrix} 1 & 2 & 3 \\ a & b & c \end{bmatrix}

Braces (Curly)

\begin{Bmatrix} 1 & 2 & 3 \\ a & b & c \end{Bmatrix}
{123abc}\begin{Bmatrix} 1 & 2 & 3 \\ a & b & c \end{Bmatrix}

Pipes

\begin{vmatrix} 1 & 2 & 3 \\ a & b & c \end{vmatrix}
123abc\begin{vmatrix} 1 & 2 & 3 \\ a & b & c \end{vmatrix}

\ce for Chem Equations

if you want to write chemical equations, you can use the mhchem package.

\ce{NaOH + HCl -> H2O + NaCl}
NaOH+HClHX2O+NaCl\ce{NaOH + HCl -> H2O + NaCl}

Useful Resources