Forum digitalis

1.2 Basics

Documentclasses

The document class defines the basic structure and layout of a document. You determine font sizes, page layout, header and footer, spacing between paragraphs and lines, and much more.

Preamble

In LaTeX, every document begins with a preamble in which the document class and packages are defined. The line \documentclass[a4paper,twoside,10pt]{article} specifies the format, layout and font size. This is followed by the title (\title), author (\author) and date (\date). Everything between \begin{document} and \end{document} is displayed in the PDF. Commands such as \maketitle generate the title, while \tableofcontents, \listoffigures and \listoftables automatically generate the table of contents, list of figures and list of tables. \printbibliography inserts the bibliography, while the actual content comes after \newpage. The preamble and these commands therefore structure the document layout, tables of contents and layout.

\documentclass[a4paper,twoside,10pt]{article} % Here are the packages \title{Lorem ipsum} \author{Your name} \date{\today} \begin{document} \maketitle \tableofcontents % Table of contents \listoffigures % List of figures \listoftables % List of tables \printbibliography[title={Bibliography}] \newpage % Here comes the content \end{document}

Basic packages

In programming, mathematics or TeX/LaTeX, packages are additional modules or libraries that provide functions, classes or styles so that you don't have to program everything yourself. Here are some basic packages:

% Default \usepackage{a4wide} % Page setting to A4 \usepackage[T1]{fontenc} % Text fonts with T1 encoding \usepackage[utf8]{inputenc} % Special and diacritical characters in UTF-8 format \usepackage{lmodern} % Latin Modern font as standard serif font \usepackage[ngerman]{babel} % German language pack % Basic packages \usepackage{fancyhdr} % Header and footer \usepackage{xcolor} % Coloured font \usepackage{enumitem} % Various enumeration methods \usepackage{tcolorbox} % Boxes for highlights