Let
X
Lesson 1 of 8

Getting Started: What LaTeX Is and Your First Document

~7 min read

By the end of this lesson you can write and compile a minimal LaTeX document. LaTeX is a typesetting system where you write plain text marked up with commands, and a compiler turns it into a polished PDF — you describe structure (a section, a figure, an equation) and LaTeX handles the formatting.

What is LaTeX?

LaTeX (pronounced “lay-tek” or “lah-tek”) is a document preparation system built on the TeX typesetting engine. Instead of formatting text by hand like in a word processor, you write plain text with \commands that describe what each part is — a title, a section, an equation — and LaTeX produces consistent, professional output. It is the standard for academic papers, theses, and anything heavy with mathematics.

LaTeX vs. a word processor

  • Separation of content and style: you write meaning; the document class decides appearance. Change one line and the whole document restyles.
  • Superb math & references: equations, citations, cross-references, and numbering are automatic and never drift.
  • Plain text: works with version control, diffs, and real-time collaboration. No corrupt binary files.
  • Stable output: the same source compiles to the same PDF anywhere.

Your first document

Every LaTeX document has two parts: the preamble (setup, before \begin{document}) and the body (your content). Here is the smallest complete document:

hello.tex — a minimal compiling document
\documentclass{article}

\begin{document}
Hello, world! This is my first LaTeX document.
\end{document}

\documentclass{article} chooses the overall document type. Everything between \begin{document} and \end{document} is what appears in the PDF. Compile it and you get a clean, typeset page.

The preamble

The preamble is where you load packages and configure the document. A common starting point adds an input encoding and a package or two:

A typical starting preamble
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}   % input encoding
\usepackage{amsmath}          % better math
\usepackage{graphicx}         % images

\begin{document}
Your content here.
\end{document}

The [12pt] is a class option — it sets the base font size. Common options: 10pt (default), 11pt, 12pt, and paper sizes like a4paper.

How compiling works

A LaTeX compiler (such as pdflatex) reads your .tex source and produces a .pdf. On LetX this happens in the browser in 1–2 seconds — no local TeX installation needed. You write on the left, see the PDF on the right.

Key commands

CommandPurpose
\documentclass{...}Set the document type (article, report, book)
\usepackage{...}Load a package to add features
\begin{document} … \end{document}The body — everything that prints
%Start a comment (ignored by LaTeX)

Frequently asked questions

Do I need to install LaTeX?

Not with an online editor. On LetX you write and compile in the browser — no TeX distribution to install. Locally you would install TeX Live (Linux/Windows) or MacTeX (Mac).

Which document class should I use?

Use article for papers and short documents, report for longer documents with chapters, and book for books. Journals and universities often provide their own class file.

Why does my document not compile?

The most common causes are a missing \end{document}, an unbalanced brace, or a command whose package is not loaded. Read the first error in the log — it usually names the line.