Latex Tutorial - Com 1
Latex Tutorial - Com 1
com/
1
01 FIRST DOCUMENT
2
1. Basic_layout 01 FIRST DOCUMENT\1. Basic_layout.pdf
\documentclass{article} %\commandname{option}
\begin{document}
Hello World!
\end{document}
3
2.Environment
One environment Two environments
% Valid:
% Valid:
\begin{document}
\begin{document}
\begin{environment1}
\begin{environment2}
\begin{environment}
\end{environment2}
\end{environment}
\end{environment1}
\end{document}
\end{document}
4
3. Adding a title page 01 FIRST DOCUMENT\3. Adding a title page.pdf
\documentclass{article}
\begin{document}
\maketitle
\newpage % Document
Hello World!
\end{document}
5
3a. Adding a title page 01 FIRST DOCUMENT\3a. Adding a title page.pdf
\documentclass{article}
\begin{document}
\pagenumbering{gobble} % to hide the page number for our first page
\maketitle % used to generate the title page
\newpage
\pagenumbering{arabic}
Hello World!
\end{document} 6
02 SECTIONS
7
1. Example output of sections and subsections 02 SECTIONS\1. Example output of sections and subsections.pdf
\documentclass{article}
\title{Title of my document}
\date{2013-09-01}
\author{John Doe}
\begin{document}
\maketitle
\pagenumbering{gobble}
\newpage
\pagenumbering{arabic}
\section{Section}
Hello World!
\subsection{Subsection}
Structuring a document is easy!
8
\end{document}
2. Hierarchy of sectioning elements 02 SECTIONS\2. Hierarchy of sectioning elements.pdf
\documentclass{article}
\begin{document}
\section{Section}
Hello World!
\subsection{Subsection}
Structuring a document is easy!
\subsubsection{Subsubsection}
More text.
\paragraph{Paragraph}
Some more text.
\subparagraph{Subparagraph}
Even more text.
\section{Another section}
9
\end{document}
03 PACKAGES
10
Using LaTeX packages
\documentclass{article}
\usepackage{PACKAGENAME}
\begin{document}
...
\end{document} 11
Purpose of packages - 03 PACKAGES\2. Purpose of packages.pdf
\documentclass{article}
\begin{document}
\begin{equation}
f(x) = x^2
\end{equation}
\end{document}
12
Using / Including a package 03 PACKAGES\3. Using _ Including a package.pdf
\documentclass{article}
\usepackage{amsmath}
% The automatic numbering is a useful feature,
% but sometimes it is necessary to remove them for auxiliary calculations.
% LaTeX doesn’t allow this by default, now we want to include a package.
\begin{document}
\end{document} 13
04 MATH
14
LaTeX math and equations
1.Inline math
2.Equations
3.Fractions
4.Matrices
15
There are two major modes of typesetting math in
LaTeX:
16
1. Using inline math – embed formulas in your text
To make use of the inline math feature, simply write your text
and if you need to typeset a single math symbol or formula,
surround it with dollar signs:
...
This formula $f(x) = x^2$ is an example.
...
17
2. The equation and align environment
18
2. The equation and align environment 04 MATH\2. The equation and align environment.pdf
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
1+2=3
\end{equation*}
\begin{equation*} % The asterisk (e.g. equation*) indicates that the equations need not be numbered .
1=3-2
\end{equation*}
\begin{align*} % The align environment will align the equations at the ampersand &.
1 + 2 &= 3\\
1 &= 3 - 2
\end{align*}
\end{document} 19
3. Fractions and more
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
f(x) &= x^2\\
g(x) &= \frac{1}{x}\\
F(x) &= \int^a_b \frac{1}{3}x^3
\end{align*}
\end{document} 21
4. Matrices
22
4. Matrices04 MATH\4. Matrices.pdf
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{matrix}
1 & 0 \\
0&1
\end{matrix}
\end{align}
\end{document}
23
5. Brackets in math mode – Scaling
24
5. Brackets in math mode – Scaling04 MATH\5. Brackets in math mode – Scaling.pdf
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\left[
\begin{matrix}
1 & 0\\
0&1
\end{matrix}
\right]
\end{align*}
\end{document} 25