Overview
LaTeX is a somewhat markup language that is used to prepare documents and more importantly for my use can render mathematical symbols and operations written in plain text. This allows for documents to be written in a much easier to type format and is fairly readable in plaintext, while also maintaining the readability of mathematical expressions when formatted.
Syntax
The syntax for LaTeX is very very extensive and I could not begin to write out everything that it offers. Entire documents can be written in LaTeX which can specify formatting, style, etc. However the following are bits that I use often when using LaTeX in my Markdown notes.
Operations
Operation | Syntax |
---|---|
Super Script | ^ |
Sub Script | _ |
Multiplication | * |
Addition | + |
Subtraction | - |
Division/Fraction | / |
Integral | \int |
Summation | \sum |
Fraction | \frac |
Letters/Symbols
Symbols | Syntax |
---|---|
Pi | \pi |
Greek Delta | \Delta |
Infinity | \inf |
Plus Minus | \pm |
Left Arrow | \leftarrow |
Right Arrow | \rightarrow |
Groupings
Closures | Syntax |
---|---|
Bubble Font | \mathbb |
Bold Font | \mathbf |
Left Angle Bracket | \langle |
Right Angle Bracket | \rangle |
Left Ceiling | \lceil |
Right Ceiling | \rceil |
Left Floor | \lfloor |
Right Floor | \rfloor |
Grouping | {} |
Groupings are put after an operation to specify that they belong to that operation. They can be nested.
e.g. x^{3ex}
would put the 3ex
in the exponent.
Trig Functions
Function | Syntax |
---|---|
Sine | \sin |
Cosine | \cos |
Tangent | \tan |
Cotangent | \cot |
Secant | \sec |
Cosecant | \csc |
Arc Sine | \arcsin |
Arc Cosine | \arccos |
Arc Tangent | \arctan |
Arc Cotangent | \arccot |
Arc Secant | \arcsec |
Arc Secant | \arcsec |
Alignment
Alignment can be useful you have multiple equations to line up, a long equation that needs to be split into multiple lines, or centering equations.
The syntax for alignment is as follows:
\begin{align*}
x &= 2y + z^5 - 439 \\
z^3 - 2x & = y^2 + 1
\end{align*}
Rendered Content:
All the content will be aligned at the &
a newline is denoted by the \\
.
align can also be changed to gather, and multiline to center a list of equations and split a long equation into multiple lines respectively. align requires the &
and \\
characters to properly align equations. gather and multiline only requires \\
to denote a newline.
Matrices
This is useful for rendering properly spaced matrices of an arbitrary size.
The syntax is as follows:
\begin{bmatrix}
a & b & c \\
d & e & f \\
h & i & j
\end{bmatrix}
Rendered Content:
Each item in a row is separated by an &
and a new row is denoted by the \\
.
bmatrix can be changed to one of the following to change the style of brackets:
Syntax | Bracket Style |
---|---|
pmatrix | round bracket ( ) |
Bmatrix | curly braces { } |
vmatrix | pipes | | |
Vmatrix | double pipes || || |
Brackets
The \left
and \right
operators can be used before bracket symbols to dynamically size brackets to fit the content.
e.g. without \left
and \right
:
z = (\frac{x^2 + 4}{y^2 -1} + 2) - (2x - 4y)
e.g. with \left
and \right
:
z = \left(\frac{x^2 + 4}{y^2 -1} + 2\right) - (2x - 4y)