# TeX and LaTeX 

##### Definition

TeX is a document typesetting system which was designed by Donald Knuth and later improved to LaTeX by Leslie Lamport. It allows the writer to define the general structure of a document (such as layout and sections), to stylise text (such as bold and italics), and to add citations and cross-references.

There exist several variants that are all based on the original TeX:

• LaTeX: adds commands for easier typesetting of typical documents such as books, articles, and letters.
• XeLaTeX: adds extended support for fonts and allows the use of system fonts.
• LuaLaTeX: adds support for the scripting language Lua.

## The Basics

LaTeX code is divided into two parts: preamble and document. In the preamble you can add packages and specify the page layout. The document part starts with \begin{document} and ends with \end{document}. It defines the visible part of your document where you put your content. Everything after \end{document} will be ignored.

##### Example of a minimal .tex file

% Preamble
\documentclass{article}
\title{My first article}

% Document
\begin{document}
\maketitle

This is the first paragraph.
\end{document}

### Special Characters

Some characters are not part of normal text but have a reserved special meaning for the LaTeX compiler.

• \ introduces a command
• {, } embraces arguments, creates logical parts
• [, ] embraces optional command parameters
• % comments: code after % will be ignored.
\end{tabular}
\caption{Professional looking table with random data.}
\end{table*}

#### Some Notes on Tables

• Ommit vertical lines! This is how professional books and journals typeset tables.
• To add extra vertical spacing: \renewcommand\arraystretch{1.5}
• To change horizontal spacing: \renewcommand{\tabcolsep}{3pt}

### Figures

\RequirePackage{graphicx}        % required to load images
\graphicspath{ {img/} {gfx/} }   % set default image subfolders

Afterwards, you can create figures using

\begin{figure}
\centering
\includegraphics[width=\textwidth]{example-image-golden}  % replace "example-image-golden" with filename
\caption{This is the full caption of the figure. It should explain what is shown and should be longer than one line.}
\label{fig:example} % used for referencing.
\end{figure}