\documentclass[12pt,a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{algorithmic}
\usepackage{algorithm}

\title{Very short introduction to typesetting with \LaTeX}
\author{}
\date{}

\begin{document}
\maketitle

\section{Writing some text}
Now I can just write whatever text I want.
It doesn't matter if I start each sentence on a new line or not.

For making a paragraph I leave one blank line between sentences. With double backslashes I can control the spacing between paragraphs and the indentation of the first line.

\section{Formulas and equations}
Mathematical formulas can be used inline: $a+b = c$.
Or they can be used in a math mode:
\[
\sum_{i=1}^n{a_i+b_i}
\]
Equations can be numbered:
\begin{equation}
\sum_{i=1}^n{\frac{a_i}{b_i}}
\end{equation}

\section{Creating tables}
Several editors have wizards for creating tables.
Using \textbf{tabular} environment enables to put the table in the exact location in the text.
Wrapping it into \textbf{table} environment makes it into floating object that is automatically put into the most suitable place in the document.
With table environment we can also add the caption to the table.
\\
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|}
\hline \bf header1 & \bf header2 & \bf header3 \\
\hline item11 & item12 & item13 \\ 
\hline item21 & item22 & item23 \\ 
\hline item31 & item32 & item33 \\ 
\hline 
\end{tabular} 
\caption{This is the caption}
\end{table}

\section{Inserting a figure}
Images can be imported with the \textbf{includegraphics} command.
Using \textbf{figure} environment makes it into floating object and allows to add captions.
The picture files must be in the same folder or we must specify the full path to the files.
\begin{figure}
\centering
\includegraphics[scale=0.5]{knnClassifyTrainData}
\quad 
\includegraphics[scale=0.5]{knnClassifyPredK10}
\caption{This is the caption of the figure}
\end{figure}

\section{Writing pseudocode}
For writing pseudocode we can use for example \textbf{algorithmic} package.
\begin{algorithm}
\caption{Calculate $\sum_{i=1}^n{x_i}$}
\begin{algorithmic}
\STATE $total \leftarrow 0$
\FOR{$i = 1$ to $n$}
\STATE $total = total + x_i$
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}
