Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 38 Β· Getting Started

Installing LaTeX and Choosing an Editor

Choose how to run LaTeX: online with Overleaf or locally with TeX Live, MiKTeX or MacTeX, plus editors such as TeXstudio and VS Code with LaTeX Workshop.

To use LaTeX you need two things: a TeX distribution (the compiler, fonts and thousands of packages) and an editor (where you type the source). You can get both in one step by working online, or install them on your computer. This lesson compares the options so you can pick one in a few minutes and start writing.

Since this site cannot run a LaTeX compiler in your browser, every real LaTeX listing in this course is read-only. Copy it into your own editor to compile it.

Option 1: Work online

An online editor needs nothing installed. You open a project in the browser, type, and the PDF appears next to the source.

  • Overleaf is the best-known service. It has a free plan, hundreds of journal templates and real-time collaboration (several people edit the same file, like a shared document). Projects can be synced with Git or GitHub on paid plans.
  • Several other web-based editors exist, and some universities host their own server. The workflow is the same.

Online is perfect for beginners, for group work and for submitting to a journal that supplies an Overleaf template. The trade-offs: you need an internet connection, free plans limit compile time, and your files live on someone else's server.

Option 2: Install locally

A local install works offline, has no time limits and keeps your files on your disk. You choose one distribution.

Distribution System Notes
TeX Live Linux, Windows, macOS Complete and the reference distribution; installs everything (several GB)
MacTeX macOS TeX Live plus Mac tools; a large download
MiKTeX Windows (and others) Small base install; downloads packages on demand the first time you use them
BasicTeX / TinyTeX macOS / all Minimal installs for people who add packages themselves

On Linux you usually install TeX Live from the package manager. A typical command on Debian or Ubuntu is shown below.

Terminal
sudo apt install texlive-full

texlive-full is the complete set. If disk space is a concern, install texlive-latex-recommended and add packages later. On Windows, either TeX Live or MiKTeX is fine; MiKTeX is lighter if you only need a few packages.

After installing, check that it works by running the compiler from a terminal.

Terminal
pdflatex --version

If a version banner appears, the engine is on your PATH and your editor will find it.

Choosing an editor

Any text editor can write .tex files, but a LaTeX-aware editor adds a compile button, syntax highlighting, a PDF preview with synchronised jumping (click in the PDF to find the source line, and the reverse), spell checking and error lists.

  • TeXstudio is a dedicated, cross-platform LaTeX editor with everything built in. A good first choice for a local install.
  • TeXworks comes with TeX Live and MiKTeX: very simple, a gentle start.
  • VS Code with the LaTeX Workshop extension is ideal if you already use VS Code. It compiles on save and shows a PDF tab inside the editor.
  • Vim/Neovim with VimTeX and Emacs with AUCTeX are powerful choices for keyboard-driven writers.
  • Overleaf counts as an editor too: it combines editor, compiler and preview.

Pick one and stick with it while you learn. Switching editors does not change your .tex files at all, because they are plain text.

Which engine should I use?

An engine is the program that reads your source. You choose it in the editor's settings or with a magic comment.

Engine Strengths
pdfLaTeX The default; fastest; best package support; limited Unicode
XeLaTeX Unicode input, any system font through fontspec
LuaLaTeX Unicode, system fonts, and Lua scripting for advanced layouts

If you do not need custom fonts or non-Latin scripts, start with pdfLaTeX. Switch to XeLaTeX or LuaLaTeX when you want a specific font, or text in Arabic, Chinese or Hindi. The later lesson on tooling returns to this choice.

What the install actually contains

flowchart TB
  D["TeX distribution"] --> E["Engines<br/>pdflatex, xelatex, lualatex"]
  D --> P["Packages<br/>amsmath, graphicx, geometry, ..."]
  D --> F["Fonts"]
  D --> T["Tools<br/>bibtex, biber, makeindex, latexmk"]
  X["Your editor"] -->|"runs"| E

Your editor does not compile anything itself; it calls the engine and shows the result.

Notice latexmk. It is a small tool that runs the engine as many times as needed (and also runs the bibliography program) so that references settle automatically. Most editors call it for you.

Your first test project

When your editor is ready, create a file called test.tex, paste the source below, and press the compile button (often a green arrow, or Ctrl+S in some editors).

LATEX
\documentclass{article}
\begin{document}
It works!
\end{document}

If a PDF opens containing "It works!", your setup is complete. Do not worry about what each line means yet: the next lesson explains the whole file.

Common setup problems

  • "pdflatex is not recognized" or "command not found". The distribution is not on your PATH. Restart the terminal or computer, or point the editor at the engine's folder in its settings.
  • MiKTeX asks to install packages. This is normal. Allow it, or set "install missing packages on the fly" to "Yes" in the MiKTeX console.
  • "File xyz.sty not found". A package is missing. Install it with the distribution's package manager (tlmgr install xyz on TeX Live, or the MiKTeX console).
  • The PDF does not update. Another program (a PDF viewer) may be locking the file on Windows. Close it, or use the editor's built-in viewer.
  • Spaces or accents in file paths. Older tools stumble on them. Keep project folders simple, such as thesis rather than My Thesis (final)!.

Organising projects

Give every project its own folder. A tidy starting layout looks like this.

Text
my-paper/
  main.tex
  references.bib
  figures/
    plot.png
  sections/
    introduction.tex

You will learn to split documents into several files later in the course. For now, one main.tex per folder keeps everything easy to find, and the helper files that LaTeX creates (.aux, .log, .toc) stay out of your way.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. What does a TeX distribution contain?

    A distribution bundles the compilers (engines), thousands of packages, fonts and helper tools.
  2. 2. Which option needs nothing installed on your computer?

    Online editors compile on their server and show the PDF in the browser.
  3. 3. You want to use a custom system font and Unicode text. Which engine fits best?

    XeLaTeX and LuaLaTeX support Unicode and system fonts through fontspec.
  4. 4. What does the latexmk tool do?

    latexmk automates the repeated runs that settle references and citations.

Summary

  • You need a TeX distribution plus an editor, or an online service that provides both.
  • TeX Live and MacTeX are complete; MiKTeX installs packages on demand.
  • TeXstudio, VS Code with LaTeX Workshop and Overleaf are friendly editors.
  • pdfLaTeX is the default engine; XeLaTeX and LuaLaTeX add Unicode and system fonts.
  • Most setup problems are PATH or missing-package issues.

Next: Your First LaTeX Document