LateX Guide
LateX Guide
LateX Guide
Slader LLC
Outline
Introduction
Typesetting Text
Typesetting Mathematics
Dollar Signs
Packages
Additional Examples
Overset Command
Overbrace/Underbrace Commands
Gather Environment
Matrices
Colors
Fractions
Brackets
Final Comments
Why LATEX
I For the most part, you can just type your text normally.
I For the most part, you can just type your text normally.
Example code:
Use single dollar signs for in line display of
$f(x)=x^2\cdot \sin x$.
LaTeX output:
f (x) = x 2 · sin x
f (x) = x 2
LaTeX output:
1 Chain rule
(log(x 2 sin x))0 = · (x 2 sin x)0
x 2 sin x
Product Rule
1
= 2 · ((x 2 )0 · sin x + x 2 · (sin x)0 )
x sin x
Example #2 - Command \overset
It can also be used to add detailed explanations later.
Code:
\begin{align*}
\dfrac{1}{\csc^2x}+\cos^2x&\overset{(1)}{=}
\sin^2x+\cos^2x\\
&\overset{(2)}{=}\color{red}{1}
\end{align*}
Explanations:
(1)\hspace{0.2cm}By definition,
$\dfrac{1}{\csc^2 x}
=\dfrac{1}{\frac{1}{\sin^2x}}=\sin^2x$
(2)\hspace{0.2cm}Pytagorean rule:$\sin^2x+\cos^2x=1$
Example #2 - Continued
LaTeX output:
1 (1)
2
+ cos2 x = sin2 x + cos2 x
csc x
(2)
=1
Explanations:
1 1
(1) By definition, 2
= 1 = sin2 x
csc x
sin2 x
(2) Pytagorean rule: sin2 x + cos2 x = 1
Integration by parts
u=x 2 du=2x
dv =e x v =e x
z
Z }| { Z
2 x
x e dx = x 2e x − 2xe x dx
Z
= x 2e x − 2 xe x dx +C
| {z }
Integration by parts
u=x du=1
dv =e x v =e x
Z
2 x x
= x e − 2(xe − 1 · e x dx) + C
Z
2 x x
= x e − 2(xe − e x dx) + C
= e x (x 2 − 2x − 2) + C
Example #3 - Further explanations
Example Code:
\begin{gather*}
3x+4y=17\\
4y=17-3x\\
y=\frac{17-3x}{4}
\end{gather*}
Example #4 - Continued
LaTeX output:
3x + 4y = 17
4y = 17 − 3x
17 − 3x
y=
4
As you can see, all rows written inside gather environment are
pushed towards the middle.
Example # 5 - Matrices
Below are examples of different types of matrices.
LaTeX code Output
\begin{matrix}
a_{11}&a_{12} \\ a11 a12
a_{13}&a_{14} a13 a14
\end{matrix}
\begin{bmatrix}
a_{11}&a_{12} \\
a11 a12
a_{13}&a_{14} a13 a14
\end{bmatrix}
\begin{Bmatrix}
a_{11}&a_{12} \\
a11 a12
a_{13}&a_{14} a13 a14
\end{Bmatrix}
Example # 5 - Continued
LaTeX code Output
\begin{pmatrix}
a_{11}&a_{12} \\
a11 a12
a_{13}&a_{14} a13 a14
\end{pmatrix}
\begin{Vmatrix}
a_{11}&a_{12} \\
a11 a12
a_{13}&a_{14}
a13 a14
\end{Vmatrix}
\bigl[ \begin{smallmatrix}
a_{11}&a_{12} \\ a11a12
a_{13}&a_{14} a13 a14
\end{smallmatrix}\bigr]
Example # 5 - Further explanations
\begin {*matrix}
cell 1 & cell 2 & cell 3 \\
cell 4 & cell 5 & cell 6
\end {*matrix}
\color{blue}{
$f(x)=\sin (3x)$} f (x) = sin(3x)
\color{orange}{
x2 x
$\frac{x^2}{3x}=\frac{x}{3})$} 3x = 3
List of all colors that can be used within Slader LaTeX compiler
can be found here:
https://en.wikibooks.org/wiki/LaTeX/Colors
Using a specific color is case sensitive, so something like
\color{maroon} is not going to work.
Example # 7 - Fractions
Basically, there are two types of fractions that are most commonly
used. These are \frac and \dfrac.
The main difference here is that frac reduces the font size in
numerator and denominator where dfrac keeps the same font. The
best way is to use dfrac when you have complicated expressions in
numerator and/or denominator and use frac otherwise.
$\dfrac{\frac{x^3}{x}} x3
{\frac{2x+1}{3x}}= x 3x 4
2x+1
= 2x 2 +x
\frac{3x^4}{2x^2+x}$ 3x
Example #8 - Brackets
Here is the correct way brackets should be used inside LaTeX
code. This way, brackets are automatically sized up to appropriate
expression inside them.