Latex Basics
Syntax for parts of Latex that I tend to use the most.
Inline Equations
To specify an equation inline (i.e. in the same line as your text), simply surround the equation with $$
.
Code:
My equation is $$ y = 8x $$ and I'm proud of it!
Output:
My equation is \(y = 8x\) and I’m proud of it!
Next Line Equation
To specify an equation in the next line (in the center of the line), add a \
in front of the first $$
, i.e. \$$
:
Code:
This equation will appear in the next line, in the center: \$$ y = 3x $$.
Output:
This equation will appear in the next line, in the center: $$ y = 3x $$
Subscript
Code:
x_1
Output: \(x_1\)
Multi-letter subscript, Code:
x_{1d}
Output: \(x_{1d}\)
Fraction
Code:
\frac{topExpression}{bottomExpression}
Output: \(\frac{topExpression}{bottomExpression}\)
Vector
Code:
\vec{a}
Output: \(\vec{a}\)
Sum
Code
\sum_{n}
Output: \(\sum_{n}\)
Sum With Top Bound
Code
\sum_{n=1}^3
Output: \(\sum_{n=1}^3\)
Dot product
Code (\cdot
)
\vec{a} \cdot \vec{b}
Output: \(\vec{a} \cdot \vec{b}\)