Table of Contents

TexLive Basics

Every LaTeX document starts with \documentclass, which selects the document type (article, book, report). Then you open the document environment with \begin{document} and close it with \end{document}. Everything between those tags is your content; everything before (the preamble) defines packages, settings, and commands.

A minimal document compiles and produces a PDF:

\documentclass{article}
\begin{document}
Hello, world!
\end{document}

Save this as main.tex and compile:

pdflatex main.tex

This produces main.pdf. The .log file shows compilation details; .aux and .out are auxiliary files used during compilation.

Commands in LaTeX start with backslash and take arguments in curly braces (mandatory) or square brackets (optional). \textbf{bold} makes bold text. \textit{italic} makes italic. \emph{emphasized} is context-aware (italic in normal text, upright in italic context). Comments start with % and ignore everything to the end of the line.

Most of your editing happens after \begin{document}. Everything before that (preamble) configures packages and commands. As documents grow, move preamble to separate files and use \input{preamble.tex} to keep things organized.

The first compilation is slow (building caches); subsequent compiles are fast. If you reference labels or citations, compile twice to resolve cross-references: pdflatex main.tex && pdflatex main.tex.

Errors stop compilation. Read the .log file (or terminal output) for line numbers and error messages. Common errors: mismatched braces, undefined commands, missing packages. See TexLive Debugging for error message reference.