%Every LaTeX file begins with a header that defines the most important settings like page margins, etc. For now, you can leave this as is and jump straight to the text at "Introduction"!

%Definition of the basic settings (font size, single- or double-sided, paper size), usually left unchanged
\documentclass[12pt,oneside,a4paper]{article}

%Loading "packages," important for German language (umlauts, hyphenation, etc.) and embedding graphics
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[dvips]{graphicx}

%Definition of the page (already somewhat adapted for university paper requirements)

%Margins
\setlength {\oddsidemargin}{1.5 cm}
\setlength {\topmargin}{0 cm}
\setlength {\headsep}{0 cm}
\setlength {\headheight}{0 cm}
%Width (to the right) and length (downwards) of the text on the page
\setlength {\textwidth}{15 cm}
\setlength {\textheight}{24.5 cm}

%Here ends the "header," which contains definitions, packages, etc., and the "text" begins
\begin{document}

%If we want, we can set the line spacing to 1.5 with the following command
%\renewcommand{\baselinestretch}{1.5}\small\normalsize

%Generate table of contents
\tableofcontents

%Start a new page after the table of contents? Then we can use \newpage (forces a page break)
%\newpage

%Now begins the main content

\section{Introduction}   %This is a chapter heading
It's best to read the commented `.tex` file and not the PDF file! This introduction to LaTeX is intentionally kept very brief and includes only the most essential commands. Essentially, almost anything is possible, from automated bibliographies to PowerPoint-like presentations. However, the aim here is to start simply and see how easily formulas, etc., can be created with LaTeX!

\section{LaTeX Editor}   %This is a chapter heading
Just as we use Word and Excel to display and edit `.doc` and `.xls` files, we also need an editor for `.tex` files in LaTeX. For beginners, I recommend a free online editor like Overleaf.

\begin{center}
https://overleaf.com
\end{center}

Here, you can simply upload, edit, and compile this `.tex` file (green button "`Recompile"') to view the result and download it as a PDF.

\section{Basics}   
LaTeX can of course also write \textbf{bold}, \textit{italic}, or \underline{underlined} text. In most text editors, this can be done by selecting the text and clicking.

\subsection{Formulas}
For mathematical formulas, we use the math environment. In regular text, we can simply use dollar signs: $f(x)=x^3+5$. If the formula should appear on its own line, we use double dollar signs:
$$g(x)=x^2-8x+2$$

\subsubsection{Exponents and Subscripts} % done with ^ and _
$$p_A(x)=9x^3-p_B(x)$$
$$Y_{2004}=519$$ %For exponents or subscripts longer than one character, we need to enclose the exponent or subscript in brackets.

\subsubsection{Square Roots}
For square roots, we use \textbackslash sqrt\{value\}:
$$h(x)=\sqrt{25}=5$$

\subsubsection{Fractions}  % done with \frac{numerator}{denominator}
Fractions are created with \textbackslash frac\{numerator\}\{denominator\}
$$\frac{5x+y}{9x^3-x}$$
Double fractions and similar are also possible:
$$\dfrac{\dfrac{5x+y}{9x^3-x}}{\dfrac{27z}{16x-p}}$$ %\dfrac prevents the text from becoming too small. \frac also works.

\subsubsection{Aligning Formulas}  % done with \frac{numerator}{denominator}
Sometimes we want to align and number multiple formulas neatly. This can be done using the \textit{align} math environment:
\begin{align}
f(x,y)&=5x^2+17+29^3y+6\cdot 4\\ %with \cdot we create a multiplication dot
g(x)&=y^3+\sqrt{x}
\end{align}
For no numbering, use align*:
\begin{align*}
f(x,y)&=5x^2+17+29^3y+6\cdot 4\\ %with \cdot we create a multiplication dot
g(x)&=y^3+\sqrt{x}
\end{align*}

\subsection{Lists}   %This is the heading of a subchapter (2.1)
Often we need bullet points:
\begin{itemize}
\item This is a bullet point list
\item This is how it looks
\end{itemize}
%
Similarly, there are enumerations:
\begin{enumerate}
\item This is a numbered list
\item This is how it looks
\end{enumerate}

\section{Figures}
Figures are embedded using \textbackslash includegraphics[height$=5cm$]\{picture.png\}, where `height` adjusts the height and `picture.png` is replaced with the actual name of the image file.

\section{Tables}
\begin{tabular}{|l|c|c|}  %    {|l|c|c|} defines the columns: We have a table with 3 columns. The first is left-aligned (l), and the other two are centered (c)
\hline % horizontal line
At the top & Column 2 & Column 3\\
\hline
Row 2 & $f(x)=5x^4+5$ & more data\\
\hline
\end{tabular}

%This tells LaTeX that the end of the file has been reached. Without this command, no PDF file will be created!
\end{document}
