Basic LaTeX Document

Published May 26, 2022  -  By Marco Garosi

Any TeX\TeX — and thus LaTeX\LaTeX — document should have some basic elements to work properly. TeX documents should indeed provide some basic yet fundamental information on the document in order to be successfully compiled. This note gives a basic “skeleton” that you may use as a starting point for any (La)TeX document.

A book with not-too-small text

Following is the code to produce a book using font-size of 11 points (11 pt.). Standard size in LaTeX is 10 points. Also, it defines the paper to be A4 size (210 x 297 millimiters), which is the main type of paper in Europe. American fellows should just delete that instruction, since their typical sheet is called a letter and is slightly different. Pay attention to sheet format!

documentclass[a4paper,11pt]{book}

\usepackage[T1]{fontenc} % font encoding
\usepackage[utf8]{inputenc} % input encoding - important for non-english languages. It allows you to use accented letters directly from your keyboard, without having to use weird commands
\usepackage[your-lang-here]{babel} % hyphenation rules. You should put your language - if supported by babel - between the square brackets. Example: \usepackage[italian]{babel}

\author{Your Name}
\title{Book title}
\date{\today}

\begin{document}

\frontmatter % initial content
\maketitle % makes the title with the information given above

\tableofcontents % produces a table of contents based on section, subsection, etc.

\mainmatter % start of main content

Write here your document

\end{document}
Share on: