0. How to Use This Guide

How to Use This Guide #

LaTeX is a system for turning structured text into a typeset document. It is especially useful for scientific writing, but its tools for headings, references, tables, and page layout also work for reports, books, and presentations.

The chapters build from basic documents to more advanced layouts:

  1. LaTeX Basics: source files, commands, document structure, and compilation.
  2. Real World LaTeX: text, languages, lists, code, tables, images, and large projects.
  3. Typesetting Mathematical Formulae: notation, equations, units, matrices, and theorems.
  4. Bibliographies: citations and reusable reference databases.
  5. Specialities: indexes, PDF links, metadata, and presentations.
  6. Graphics in Your Document: drawing with TikZ.
  7. Customising LaTeX: commands, fonts, colours, spacing, and page design.

Run the examples #

In TeXPage, create a project and choose XeLaTeX in its settings. For local compilation, use a TeX distribution that provides XeLaTeX or LuaLaTeX.

A block starting with \documentclass and ending with \end{document} is a complete document. Otherwise, it is a fragment to insert into an existing document. Package-loading commands and definitions marked “Preamble” go before \begin{document}; examples marked “Body” go between \begin{document} and \end{document}.

Use this basic document when a section provides only a fragment:

\documentclass[a4paper,11pt]{article}
% Add the packages required by the example here.

\begin{document}
% Insert the body example here.
\end{document}

Load each package once. When a section introduces package options, update the existing \usepackage line instead of adding a second conflicting one.

Compiler choices #

Use XeLaTeX or LuaLaTeX. These engines support the OpenType fonts and Unicode mathematics used in this course. The short beginner’s guide uses pdfLaTeX for its simpler examples; switch compilers when moving to this guide.

Examples using fontspec, polyglossia, or unicode-math require XeLaTeX or LuaLaTeX. An example using xeCJK specifically requires XeLaTeX. Font names refer to fonts installed in the compilation environment, not necessarily those installed on your own computer.

Packages and their behaviour can vary between TeX distribution versions. These examples use modern package interfaces; a publisher’s template may require a different setup.

Read code and output together #

The code is the editable source. The rendered images show details that Markdown cannot reliably reproduce, such as aligned equations, decimal-aligned columns, and TikZ paths. They are actual LaTeX output, not illustrations of approximate results. Each image includes a link to its complete .tex source.

Chapter sections identify any extra files or compilation steps. References and contents lists may need repeated LaTeX runs; bibliographies and indexes also need their processing programs.

When compilation fails #

Read the first error in the log, then inspect that line and the lines immediately before it. Check matching braces, matching environment names, missing packages, and filenames. Fix one issue and compile again. Later errors may be consequences of the first one.

A warning is different from a fatal error. An Overfull \hbox warning means some material extends beyond its allowed width. A missing-character warning means a font cannot display a character. An undefined-reference warning often means a label is wrong or another compilation pass is needed.

For a difficult problem, copy the document and remove unrelated parts until the smallest example that still fails remains. This makes package conflicts and incomplete commands much easier to find.

Next: LaTeX Basics →

Sources and Licence