\documentclass[a4paper,12pt]{article} % paper size, font size, document type
\usepackage[T1]{fontenc} % output encoding
\usepackage[utf8]{inputenc} % input encoding
\usepackage[english]{babel} % language specific rules

\usepackage{times} % font

\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cancel}
\usepackage{amssymb}
\usepackage{graphicx}

%user-defined symbol
\def\dd{\operatorname{d}\!}

%user-defined command (with argument)
\newcommand{\formula}[1]{(\ref{#1})}

\newcommand{\myvector}[1]{\underline{#1}}

\newtheorem{thm}{Theorem} % theorem environment

\title{\LaTeX \ syllabus}
\author{Gábor Borbély}

\begin{document}
\maketitle %makes the title from \title, \author, \date
\tableofcontents %generates table of content from sections, subsections

\section{Text}
``\'Arv\'izt\H{u}r\H{o} t\"uk\"orf\'ur\'og\'ep'' or ``árvíztűrő tükörfúrógép''

New paragraph.
Still going on.

New paragraph.











if you leave many \texttt{Enter}that makes only one newline \vspace{1cm} \\
Or you can put \texttt{vspace}, or pagebreak.
\newpage
Or an entire empty page like this:
\newpage %starts new page
\mbox{} %an empty box 
\thispagestyle{empty} %don't write page number, either
\newpage %new page again
The page numbering continues.

The hyphenation hyphenation hyphenation hyphenation hyphenation
hyphenation hyphenation hyphenation hyphenation hyphenation 
hyphenation hyphenation hyphenation hyphenation hyphenation 
hyphenation hyphenation hyphenation hyphenation hyphenation 
hyphenation hyphenation hyphenation hyphenation hyphenation 
hyphenation hyphenation hyphenation hyphenation hyphenation 
is built-in, but you can put unbreakable space:
Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth
You don't want to wrap
Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth
Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth Donald~Knuth

You can insert a picture, see Figure \ref{pic1}.
\begin{figure}[h] % h: here, t: top of this page, b: bottom of this page, p: separate page for float objects
\centering
\caption{A nice picture}
\includegraphics[width=0.7\textwidth]{my_favorite_img}
\label{pic1}
\end{figure}

Lists:
\begin{itemize}
\item First
	\begin{enumerate}
	\item sub-list first
	\item sub-list second
	\item sub-list third
	\end{enumerate} 
\item Second
\item[-] Third 
\item Fourth
\end{itemize}

\subsection{Typography}
In \LaTeX one can make text \textit{italic}, \textbf{bold} or {\fontfamily{lmodern}\selectfont different font},
{\Large but don't fuss} {\tiny with formatting}.

Don't \! modify \ the spacing \quad that should be left to the typesetter.

The change in format should reflect the intent, use different environements for the different contents, like in Theorem \ref{thm1}.
Likewise, you can define Definition, Corollary, Example, Exercise etc. environements.
Use \texttt{emph} for emphesise.
Also, use a well-defined notation system for mathematical expressions:
\begin{itemize}
 \item vectors should be \texttt{mathbf} or \texttt{underline}: $\myvector{a}$
 \item matrices with capital letters: $A, B, C$
 \item Number sets with blackboard-bold: $\mathbb{R}, \mathbb{C}, \mathbb{N}, \mathbb{Z}$
 \item to include program codes, use a package (ex. \href{https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings}{listing}) and not \texttt{texttt}.
\end{itemize}

\begin{thm}[The principle of \LaTeX]
\label{thm1}
Write the \emph{content}, not the \emph{format}!
\end{thm}
\begin{proof}
A mathematician should know the content, not the look of it. That is a different profession.
\end{proof}

\subsection{Ligature}
Usually we don't bother this, but watch carefully:
\begin{table}[h]
\centering
\fontfamily{lmodern}\selectfont
\begin{tabular}{c|c|c}
ligature & example & counter-example \\ \hline
fi & final & f{}i \\
ff & differential & f{}f \\
ffi & difficulty & f{}f{}i \\
fl & flake & f{}l \\
\end{tabular}
\end{table}
Hyphening the ligatures is automatic, like in 
differential differential differential differential differential differential
differential differential differential differential differential differential
differential differential differential differential differential differential
differential differential differential differential differential differential
differential differential differential differential differential differential
differential differential differential differential differential differential,
if it wraps around a lew line.

\subsection{References}
You can put a \href{https://en.wikipedia.org/wiki/Hyperlink}{link} or a \href{mailto:borbely@math.bme.hu}{mail} link.

Within a document, you can refer to formula \formula{most_beautiful} or with automatic naming: \autoref{most_beautiful}.
With tables and figures: Figure \ref{pic1}, and Table \ref{table1}.
\begin{table}[h]
\centering
\begin{tabular}{c|c}
Good & Bad \\ \hline
\texttt{OK} & \texttt{WRONG}
\end{tabular}
\caption{Rules to live by}
\label{table1}
\end{table}

\section{Math and text mode}
Text mode is the default, just like this line.
There are two types of math mode: inline and display style.
Inline: $\int_a^b f(x) \dd x$, display:
\[
\int_a^b f(x) \dd x
\]
The sum in inline: $\sum_1^\infty a_n$, in display style:
\[
\sum_1^\infty a_n
\]
But you can put text in math mode:
\[
\#\{A\} = \text{cardinality of set }A
\]

There are several types of display formulas:
\begin{itemize}
\item \textbackslash[ \ldots \textbackslash]
\[
e^{i\cdot \pi} = -1
\]
\item With \texttt{\textbackslash begin\{equation\} \ldots \textbackslash end\{equation\}} you get numbering and labeling.
\begin{equation}
e^{i\cdot \pi} = -1
\label{most_beautiful}
\end{equation}
\item Multiline formula: \texttt{\textbackslash begin\{align\}}, where you can align with the \& character:
\begin{align}
\label{euler}
e^{i\cdot \pi} & =  -1 \\
\label{euler_minus}
-e^{i\cdot \pi} & =  1
\end{align}
You can skip the numbering with * or \texttt{nonumber}.
\begin{align*}
e^{i\cdot \pi} & = -1 \\
-e^{i\cdot \pi} & = 1
\end{align*}
An other example.
\begin{align}
\label{ode1}
\dot{x} &= -x \\
\nonumber x(0) &= 1
\end{align}
\item \texttt{align} with more \& character:
\begin{align*}
A & \Rightarrow B & \text{therefore}\\
\neg B & \Rightarrow \neg A &  \text{follows}\\
\end{align*}
\end{itemize}

\section{Formulas}
In this section the left-hand-side is incorrect, the right-hand-side is the right one.
If there is only one formula in the middle, then that is correct.
Mind the source code, too!

\subsection{Blocks}
\begin{align*}
&\frac1234 & \frac{12}{34}\\
&this   that^some & this \cdot {that}^{some}
\end{align*}

\subsection{Parenthesis}
Adaptive parenthesis:
\begin{align*}
&\big( e^x \big)^y = e^{xy} & \left( e^x \right)^y = e^{xy} 
\end{align*}
Dot-product:
\begin{align*}
&< \myvector{a}; \myvector{b}> & \left< \myvector{a}; \myvector{b}\right>
\end{align*}

The two sides of the parenthesis can be different, but match in size.
\begin{align*}
\left< \frac{a}{2} \right| \left|\frac{b}{2} \right> & = \frac14 \cdot a^\top \cdot b & 
\left| \frac{a}{2} \right> \left< \frac{b}{2} \right| & = \frac14 \cdot a \cdot b^\top & 
\end{align*}
Or you can leave one parenthesis out:
\[
\left( \int \omega \ldots \right.
\]
You can put a delimiter in the middle to match the size as well:
\begin{gather*}
\mathbb{Q} = \left\{\frac{a}{b}\middle| a, b\in \mathbb{Z}\right\}\\
\left< \frac{a}{2} \middle\| \frac{b}{2} \right>
\end{gather*}

\subsection{Binomial coefficient}
\begin{align*}
& \left(\begin{matrix} 5 \\ 3 \end{matrix}\right) = 10 & \binom{5}{3} = 10
\end{align*}

\subsection{Integrals}
\begin{align*}
&\int_from^to &\int_\text{from}^\text{to} \\
&\int_a^b f(x) d x &\int_a^b f(x) \dd x \\
&{\int \int}_A f(x,y) dx dy &\iint_A f(x,y) \dd x \dd y \\
\end{align*}

\subsection{Sums}
\begin{align*}
&\Sigma_{i=1}^n a_i  & \sum_{i=1}^n a_i \\
&\Pi_{i=1}^n a_i  & \prod_{i=1}^n a_i
\end{align*}

\subsection{Differentiation}
\begin{align*}
& \text{\"x}(t) & \ddot{x}(t)
\end{align*}
This one is good:
\[
\frac{\partial f}{\partial x} = f'(x)
\]
\subsection{Logical operations}
\begin{align*}
& A => B & A \Rightarrow B \\
& A \backslash \left(B \text{U} C\right) & A \setminus \left(B \cup C \right)
\end{align*}

\subsection{Matrices, vectors}
\begin{align*}
& \left(\begin{matrix}
	a_1 & b_1 & ... & c_1 \\ a_2 & b_2 & ... & c_2 \\ ... \\ a_n & b_n & ... & c_n
  \end{matrix} \right) & 
  \left(\begin{matrix}
	a_1 & b_1 & \ldots & c_1 \\ a_2 & b_2 & \ldots & c_2 \\ \vdots \\ a_n & b_n & \ldots & c_n
  \end{matrix} \right)
\end{align*}
Transpose, perpendicular:
\begin{align*}
 & A^T & A^\top \\
 & \myvector{a} \bot \myvector{b} & \myvector{a} \perp \myvector{b}
\end{align*}
Although, the complementing subspace and perpendicular vectors are marked differently.
\begin{align*}
 & A^\bot = \{\myvector{x} | \myvector{x}\perp \operatorname{Im}(A)\}
\end{align*}
Norm:
\begin{align*}
 & ||\frac{\mathbf{a}}{2} || = \frac{||\mathbf{a}||}{2} & \left\|\frac{\mathbf{a}}{2}\right\| = \frac{\|\mathbf{a}\|}{2}
\end{align*}
Cross product (in $\mathbb{R}^3$): $\myvector{a} \times \myvector{b}$. Square matrix: $A\in\mathbb{R}^{3\times 3}$.

\subsection{Relations}
You can negate relations usually with \texttt{n} in front of the command:
\begin{align*}
 & a \cancel= b & a \neq b
\end{align*}
A mistake:
\begin{align*}
 & a \underline{<} b & a \leq b \\
\end{align*}
These are correct:
\begin{align*}
a & \leqslant b \\
\text{this} & \leq \text{that} \\
e & \ngeqq \pi \\
\alpha & \lneqq \beta
\end{align*}
Don't try to fabricate new symbols, search one for your specific need.
\begin{align*}
 & \myvector{a} \cdot \myvector{b} \overset{\triangle}{=} |\myvector{a}| \cdot |\myvector{b}| \cdot \cos(\angle(\myvector{a}, \myvector{b})) &
  \myvector{a} \cdot \myvector{b} \triangleq \lvert \myvector{a}\rvert \cdot \lvert \myvector{b}\rvert \cdot \cos(\angle(\myvector{a}, \myvector{b}))
\end{align*}
You can also negate a relation with \texttt{not} command: $a \not\triangleq b$.

\subsection{Number theory}
\begin{align*}
 & a | b \Leftrightarrow b \equiv 0 (\operatorname{mod} a ) & a \mid b \Leftrightarrow b \equiv 0 \mod{a}
\end{align*}
The ``not divide'' is \texttt{nmid}: $a\nmid b$.
\subsection{Functions}
\begin{align*}
 & {log}_{2}(16)=4 & \log_2(16)=4 \\
 & sin(x) & \sin(x) \\
 & f(x) = \left\{\begin{array}{ll} x & \text{ha } x \geq 0 \\ -x & \text{otherwise}\end{array}\right. &
 f(x) = \begin{cases}x & \text{ha } x \geq 0 \\ -x & \text{otherwise}\end{cases} \\
 & span\{\myvector{v_1}, \myvector{v_2}\} & \operatorname{span}\{\myvector{v_1}, \myvector{v_2}\}\\
\end{align*}

\section{Useful links}
\begin{itemize}
 \item You can find various symbols \href{http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf}{here} or \href{http://www.rpi.edu/dept/arc/training/latex/LaTeX_symbols.pdf}{here}.
 \item You can search for answers \href{http://tex.stackexchange.com/}{here}.
 \item If you are struggling with some formatting, ask whether you really need it at all.
\end{itemize}

\end{document}