Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 38 ยท Getting Started

What Is LaTeX?

Learn what LaTeX is, how it differs from Word-style editors, why scientists and students love it, and how the source, compiler and PDF fit together.

LaTeX (pronounced "LAH-tek" or "LAY-tek") is a system for typesetting documents. You do not drag text boxes around or click a bold button. Instead you write a plain text file that describes the document, and a program called a compiler turns that file into a polished PDF. The result is famous for beautiful mathematics, consistent layout and automatic numbering of everything from sections to citations.

LaTeX is built on TeX, a typesetting engine written by Donald Knuth in the late 1970s because he was unhappy with the printing quality of his own books. Leslie Lamport added a layer of ready-made commands on top (the "La" in LaTeX), so authors could think about structure ("this is a section") rather than low-level spacing. Today it is the standard tool for theses, research papers, textbooks and slide decks in mathematics, physics, computer science and engineering.

WYSIWYG versus markup

Word processors are WYSIWYG: what you see is what you get. You edit the page directly and fix the look by hand. LaTeX is WYSIWYM: what you see is what you mean. You mark the meaning of each piece of text and let LaTeX decide how it should look.

Question Word-style editor LaTeX
How do you write? On the page, with menus In a text file, with commands
Who positions things? You The compiler
Section numbers Often manual or semi-automatic Always automatic
Equations Equation editor Native, publication quality
References and citations Plugins Built in (see the later chapters)
Long documents Can become fragile Designed for hundreds of pages
Version control Awkward Plain text works with Git

Neither approach is "better" for everything. A flyer with photos is faster in a design tool. A 120-page thesis with 300 equations, 80 figures and 150 citations is where LaTeX shines.

The three pieces: source, compiler, output

Every LaTeX workflow has the same three parts.

flowchart LR
  A["main.tex<br/>(plain text source)"] --> B["LaTeX engine<br/>(pdfLaTeX, XeLaTeX, LuaLaTeX)"]
  B --> C["main.pdf<br/>(finished document)"]
  B --> D["main.log, main.aux<br/>(helper files)"]
  D --> B

The compiler writes helper files such as .aux (numbers for cross-references) and often reads them again on the next run.

  1. The source file ends in .tex. It is ordinary text that you can open in any editor.
  2. The engine reads the source and produces a PDF. The most common engines are pdfLaTeX (the classic), XeLaTeX and LuaLaTeX (both handle Unicode and system fonts well).
  3. The output is a PDF with exact fonts, line breaks and page breaks, identical on every computer.

Because the helper files remember things like "Section 3 is on page 12", LaTeX sometimes needs to run twice to settle all references. Modern tools do this for you automatically.

What LaTeX source looks like

Here is a tiny complete document. It is shown read-only because the LaTeX compiler is not available in your browser on this site.

LATEX
\documentclass{article}

\begin{document}

Hello, \LaTeX! This sentence is set in a serif font.

\end{document}

Three things stand out. Commands start with a backslash (\documentclass). Arguments sit in curly braces (). Environments such as document are opened with \begin{...} and closed with \end{...}. You will see those three shapes everywhere, and the next lessons explain them one by one.

Why people choose LaTeX

  • Typographic quality. TeX's line-breaking algorithm looks at a whole paragraph at once and chooses the breaks that give the most even spacing. Hyphenation, kerning and ligatures (such as the joined "fi" in "fine") are handled automatically.
  • Mathematics. Formulas are typed as text, for example \frac{a}{b}, and are spaced following the rules of professional math typesetters. Chapter 3 is entirely about this.
  • Automation. Table of contents, list of figures, numbered equations, cross-references, bibliographies and indexes are generated, and stay correct when you move things around.
  • Separation of content and style. Change one line (the document class or a package) and the whole document changes its look. Journals publish LaTeX templates for exactly this reason.
  • Stability and portability. A .tex file written years ago still compiles. The output does not depend on which computer or printer you use.
  • Free and open. The major distributions (TeX Live, MiKTeX, MacTeX) and the editors around them cost nothing.

Honest downsides

LaTeX has a learning curve. A forgotten brace produces an error message that can look cryptic at first (the lesson on document classes and the preamble and the later debugging lessons help). Fine-tuning layout beyond what a template offers means learning packages. And you cannot click an image and nudge it two pixels: you describe what you want and accept the result. Most beginners find that after a weekend of practice the benefits clearly outweigh these costs.

A tiny taste of the math

LaTeX math looks like this in a text file: $E = mc^2$ produces the famous formula, and \[ \int_0^1 x^2\,dx = \frac{1}{3} \] produces a displayed integral. The site cannot run a LaTeX compiler, but the browser editor below uses KaTeX, a JavaScript library that understands the same math syntax. It is a stand-in for the real thing: the formulas are genuine LaTeX math, while the surrounding page is just HTML.

LaTeX math rendered by KaTeX (stand-in)

Try changing x^2 to x^3 and the answer \frac{1}{3} to \frac{1}{4}. In real LaTeX you would type exactly the same math between dollar signs or inside a \[ ... \] pair.

Who uses LaTeX

Mathematicians, physicists and computer scientists write nearly all research papers in it. arXiv, the free preprint server, accepts LaTeX source directly. Universities provide thesis templates. Many companies use it for reports, invoices and documentation, because documents can be generated by programs: a script can fill in a template and compile a hundred personalised PDFs.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What do you write when you work with LaTeX?

    A .tex file is plain text. The compiler turns it into a PDF.
  2. 2. What does WYSIWYM mean?

    You describe the meaning of the content (a section, a quote) and LaTeX decides the look.
  3. 3. Why might LaTeX need to run twice?

    Cross-references and tables of contents depend on information collected in an earlier run.
  4. 4. Which is a typical strength of LaTeX compared with a word processor?

    Math typesetting and automation of numbering, references and bibliographies are its main strengths.

Summary

  • LaTeX turns a plain text .tex file into a PDF through a compiler.
  • It is built on Knuth's TeX; LaTeX adds structure-oriented commands.
  • You describe meaning (WYSIWYM) and the engine does the layout.
  • Strengths: math, automatic numbering, stable output, templates, Git-friendly files.
  • Commands use backslashes, braces and \begin{...} / \end{...} environments.

Next: Installing LaTeX and Choosing an Editor