LaTeX: Setting up the page

This page was translated from German with AI. It has not been checked by a native speaker. Original page in German

Paper format, margins, font and line spacing are in one single place in LaTeX: in the preamble at the start of the file. Seven lines set up the page for the whole paper.

The video

In the video you see TeXstudio under Linux. The orange frame always shows the spot in question. Under Windows and macOS TeXstudio looks exactly the same. The practice file above is the state at the start of the video – so you can follow along with each part separately.

Subtitles are available in ten languages. Choose them at the bottom right of the video.

Contents of the video

  1. 0:00 What it is about
  2. 0:22 Starting point
  3. 0:53 Document class
  4. 1:16 Page margins
  5. 1:32 Font
  6. 2:04 Line spacing and justified text
  7. 2:22 Result
  8. 2:36 Other compilers
  9. 3:00 Summary

The most important points

The preamble

\documentclass[a4paper,12pt]{scrartcl} · \usepackage[ngerman]{babel} · \usepackage[margin=2.5cm]{geometry} · \usepackage[T1]{fontenc} · \usepackage{lmodern} · \usepackage{tgtermes} · \usepackage[onehalfspacing]{setspace}. Your teacher's requirement comes first – usually you only change one number.

The document class scrartcl from KOMA-Script with the options A4 and 12 pt.
The document class scrartcl from KOMA-Script with the options A4 and 12 pt.

lmodern provides a complete font family (it supplies e.g. the headings, sharp in print too), tgtermes the text font Termes. LaTeX does justified text and hyphenation by itself. More margin on the left: [margin=2.5cm,left=3cm].

After compiling: narrower margins, larger font with serifs, more line spacing.
After compiling: narrower margins, larger font with serifs, more line spacing.
The compiler is under Options › Configure TeXstudio › Build. We stay with pdfLaTeX; LuaLaTeX and XeLaTeX can use any installed font.
The compiler is under Options › Configure TeXstudio › Build. We stay with pdfLaTeX; LuaLaTeX and XeLaTeX can use any installed font.

The worksheet

Here you can see the worksheet for the video (in German). You download the practice files above and work in your own editor. The hints are printed upside down – turn the sheet only when you cannot get on by yourself. You can also open it as a PDF.

📄 Open worksheet (PDF, German)

The worksheet – Page 1
Page 1/3
The worksheet – Page 2
Page 2/3
Show the worksheet solutions
The worksheet – Page 3
Page 3/3

Try it yourself

Task

Your school requires 3 cm margin on the left, otherwise 2.5 cm, and font size 11 pt. Which two lines of the preamble do you change, and how?

Show solution

\documentclass[a4paper,11pt]{scrartcl} and \usepackage[margin=2.5cm,left=3cm]{geometry}.

Keep learning with a language model

My school specifies for the Facharbeit: [enter requirements, e.g. margins, font, line spacing]. Here is my LaTeX preamble: [insert preamble]. Check whether it meets the requirements and explain to me every necessary change instead of just giving me the finished preamble.

How this was made: The idea and the choice of topics are mine. A language model (LLM) drafted the script, the sample paper, the tasks and this page following my instructions. The screen recordings were made automatically by a script in TeXstudio under Linux, which checked the finished PDF after every step: are margins, font, numbers and references right, are there warnings? The voice was generated with Qwen3-TTS, modelled on my own voice.

The sample paper about the thread pendulum is invented, and so are the person “Alex Beispiel” and the two sources in the bibliography.

The videos, worksheets, practice files, texts and prompts in this series are licensed under CC BY 4.0: you may use, change and share them if you name the source.