Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

LaTeX & Typst (papers, theses, resumes and slides)  Module 1 – Start here: from source file to PDF

Install TeX Live, TinyTeX or MiKTeX, and Typst

Install a TeX distribution and Typst on Windows, macOS or Linux, check every version from the command line and the log, and add a missing LaTeX package.

  • Beginner
  • 20 minutes
  • Examples run with TeX Live 2026, TinyTeX 2026.10, Typst 0.15.1, Python 3.14.8, Pyodide 314.0.7 and poppler 26.09.0
  • By MySmartCoPilot
Free lesson, Pro answers: 20 minutes
Free: the whole lesson. With a pass: the model answers to its 2 interview questions.

What you will learn

  • Choose and install a TeX distribution (TeX Live, MiKTeX or TinyTeX) and Typst on Windows, macOS or Linux
  • Check the engine, LaTeX, TeX Live and Typst versions from the command line and from inside a document
  • Add a missing LaTeX package with tlmgr, or let MiKTeX install it when a document needs it
  • Set up an editor that builds both systems, or choose an online editor and its TeX Live year

Before you start

What you’ll learn · Before you start

What you will learn

  • Choose and install a TeX distribution (TeX Live, MiKTeX or TinyTeX) and Typst on Windows, macOS or Linux
  • Check the engine, LaTeX, TeX Live and Typst versions from the command line and from inside a document
  • Add a missing LaTeX package with tlmgr, or let MiKTeX install it when a document needs it
  • Set up an editor that builds both systems, or choose an online editor and its TeX Live year

Before you start

On this page

A full TeX Live installation needs 9,402 MB of disk space in the example screen of its own installation guide, while TinyTeX starts at 50 to 70 MB and Typst is one small program. All three end with the same check: a version line that says what you really installed.

Below you will compare the ways of getting a TeX system and pick one for your computer, install Typst and list the fonts it carries, check every version from the command line and from inside a document, fix a build that stops on a missing class, and set up an editor or an online alternative.

A TeX distribution brings the engines, the format and the packages

You never install LaTeX on its own: you install a distribution, which brings the engines, the LaTeX format, packages and fonts in one TeX tree: The folders where a TeX distribution keeps its classes, packages, fonts and settings, such as texmf-dist. Engines find each file in it by name, and kpsewhich prints where a file is. and keeps them updated. Four ways are common:

  • TeX Live, from the TeX Users Group, for Unix, macOS and Windows. You download its installer and run perl install-tl on Unix or install-tl-windows on Windows; on macOS the TeX Live guide recommends the native MacTeX installer, which is TeX Live with a few Mac-specific additions. The full installation needs several gigabytes, and you need no administrator rights, only write access to the folder it goes into. Many Linux distributions also offer TeX Live through their package managers, which may carry an older year, so check its version line.
  • MiKTeX, for Windows, macOS and Linux. Its package manager installs missing components from the internet when a document first needs them, so the first installation stays small.
  • TinyTeX, a small, portable distribution built from TeX Live. Its FAQ gives 50 to 70 MB or more, zipped, and it grows as you install packages with the usual TeX Live tools. Its installers are one-line scripts on Linux and macOS and a batch file on Windows, all on its website.
  • An online editor such as Overleaf, which compiles on its servers, so nothing is installed on your computer.

Tectonic is a further option, a self-contained engine built on XeTeX and TeX Live that fetches support files as it needs them; whatever you install, read the LaTeX2e line of a log to see which LaTeX release you really got. Answer three questions about your computer, and the table says which distributions fit:

Interactive · answer and compare Which TeX distribution fits your computer? Answer three questions about the computer you write on. The table marks the options that fit and says why the others do not.
How much disk space and download can you spare for the TeX system?
Will you need to compile without an internet connection, on a train or in a lab?
May you install programs on the computer you write on?

Answer the questions above: the table then marks what fits your case and says why the rest does not.

TeX Live, MiKTeX, TinyTeX and an online editor against what decides between them
Option Disk space A missing package Working offline Updates
TeX Live Installs: everything you choose up front Poor the full scheme needs 9,402 MB in the TeX Live guide's own example Good rare with the full scheme; otherwise tlmgr install adds it Good everything is on your disk once installed Good you run tlmgr update --all; each yearly release gets its own folder
MiKTeX Installs: a base that grows on demand Good starts small and installs only what documents use Good its package manager installs missing parts from the internet when needed Mixed only packages installed before you went offline work Good you update it through its own package manager
TinyTeX Installs: a small TeX Live you extend Good 50 to 70 MB or more zipped, and it grows with each package you add Mixed you install each one by name with tlmgr install Mixed only packages installed before you went offline work Good you run tlmgr, as in TeX Live, which it is built from
Online editor Installs: nothing on your computer Good nothing to install; the server holds the TeX system Mixed the provider decides which packages its servers have Poor needs a connection to edit and to compile Mixed the provider updates; an old project keeps its old TeX Live year
How the answers decide
  • “How much disk space and download can you spare for the TeX system?” Little: a few hundred MB: adds a caveat to TeX Live. A full TeX Live needs several gigabytes; choose a smaller scheme in its installer, or a distribution that starts small.
  • “Will you need to compile without an internet connection, on a train or in a lab?” Yes, often: rules out Online editor and adds a caveat to MiKTeX and TinyTeX. Offline, only what is already installed can be used: compile your documents once while online so their packages are in place.
  • “May you install programs on the computer you write on?” No, it is locked down: rules out TeX Live, MiKTeX and TinyTeX. Without permission to install, an online editor needs nothing on the computer; ask before installing even into your own folder.

In short: TeX Live when disk space is no problem and you want everything ready, MiKTeX or TinyTeX when space or bandwidth is short, and an online editor when you may not install anything. Every LaTeX example in this track was recorded with TinyTeX 2026.10, which is TeX Live 2026.

Typst is one program, with its fonts inside

Installing Typst means putting one program on your computer. Its README lists brew install typst for macOS, winget install --id Typst.Typst for Windows, cargo install --locked typst-cli for anyone with Rust, and ready-made binaries on its releases page; Linux distributions package it too. Typst’s guide for LaTeX users calls the compiler a single, small binary that any user can run without root privileges.

The program carries its own fonts, so a document builds the same on any computer that has nothing else installed. typst fonts lists every font family Typst can use; this session ignores the computer’s own fonts, as every Typst example in this track does, so the list shows only the families built into the program:

The fonts inside the Typst program Python · typst_fonts_session.py
from session import run

# The font families built into the Typst program: with system fonts ignored, these are all it can use.
run("""
typst fonts
""")

Output

$ typst fonts
DejaVu Sans Mono
Libertinus Serif
New Computer Modern
New Computer Modern Math

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 typst_fonts_session.py

Libertinus Serif is the default text font and New Computer Modern Math the maths font of the note in the first lesson, which is why its PDF embedded Libertinus. Without that setting, Typst also finds the fonts installed on your computer, so typst fonts on your machine lists more. Packages are different: they stay on Typst Universe until a document asks for one, and then Typst fetches it once and reuses its saved copy, so build once while online before you work on a train.

Expecting a Typst package to work offline the first time

Wrong: importing a new package on a laptop with no connection and expecting the build to work. Right: build the document once while online, which fills the package cache, and the same build works offline afterwards.

Checkpoint

Check: Choosing a TeX distribution · Typst's one program and its fonts

  1. Question 1 of 2 A student has an old laptop with 2 GB of disk space left and is online most days. Which distribution suits it best?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: TinyTeX or MiKTeX, which start small and grow as documents need packages

    With little disk space, start small: TinyTeX or MiKTeX install the core and add packages as documents need them. A full TeX Live is the choice when space is no problem and you want everything ready offline.

  2. Question 2 of 2 With the computer's own fonts ignored, how many font families did typst fonts list?

    Choose one answer.

    Show the answer: Question 2 of 2

    Answer: Four, the families built into the Typst program

    The Typst program carries four font families. Ignoring system fonts, as every Typst example in this track does, means a build uses only those, so it gives the same PDF on any computer.

Check every version, from the command line and from inside the document

Each tool answers --version. This session asks the three engines for their first line, then latexmk, the TeX Live Manager tlmgr: The TeX Live Manager: the command that installs, updates and lists the packages of a TeX Live or TinyTeX installation, as in tlmgr install exam or tlmgr update --all. and Typst, and finally asks the shell where it finds pdflatex and typst:

Every tool's version, from the command line Python · cli_versions_session.py
from session import run

# The version of every tool, asked from the command line: the three engines (first line only), latexmk, tlmgr and
# Typst, then where the shell finds pdflatex and typst.
run("""
pdflatex --version | head -1
lualatex --version | head -1
xelatex --version | head -1
latexmk --version
tlmgr --version
typst --version
which -a pdflatex typst
""")

Output

$ pdflatex --version | head -1
pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026)
$ lualatex --version | head -1
This is LuaHBTeX, Version 1.24.0 (TeX Live 2026)
$ xelatex --version | head -1
XeTeX 3.141592653-2.6-0.999998 (TeX Live 2026)
$ latexmk --version
Latexmk, John Collins. Version 4.88
$ tlmgr --version
tlmgr revision 79639
tlmgr using installation: …
TeX Live (https://tug.org/texlive) version 2026
$ typst --version
typst 0.15.1 (9dfd3a08)
$ which -a pdflatex typst
…/bin/universal-darwin/pdflatex
…/typst

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 cli_versions_session.py

Read them as the first lesson read the log: pdfTeX 1.40.29, LuaHBTeX 1.24.0 (LuaTeX built with the HarfBuzz library, the engine lualatex uses) and XeTeX 0.999998, each followed by (TeX Live 2026); latexmk 4.88; tlmgr reporting TeX Live version 2026; and typst 0.15.1 (9dfd3a08), the version followed by a short code that identifies the exact build. which -a lists every copy of a command on your PATH, in the order the shell tries them, and here it found one of each.

A document can report the same facts about the build that made it. \fmtversion is the LaTeX release, each engine defines its own banner, and Typst’s sys.version is the compiler’s version. The second session builds these two files and reads each PDF back:

Documents that print their own versions

LaTeX: versions.tex · versions/versions.tex

\documentclass{article}
\begin{document}
\section*{Versions}
% \fmtversion is the release of the LaTeX format; each engine defines its own banner or version.
LaTeX format: \fmtversion\par
\ifdefined\pdftexbanner Engine: \pdftexbanner\par\fi
\ifdefined\luatexbanner Engine: \luatexbanner\par\fi
\ifdefined\XeTeXrevision Engine: XeTeX \the\XeTeXversion\XeTeXrevision\par\fi
\end{document}

Typst: versions.typ · versions/versions.typ

= Versions
// sys.version is the version of the Typst compiler that built this file.
Typst #sys.version
The versions as each document sees them Python · doc_versions_session.py
from session import files, run

# The versions as the documents themselves see them, printed into the PDF, and the program that wrote each PDF.
files("versions/versions.tex", "versions/versions.typ")
run("""
pdflatex -interaction=nonstopmode -halt-on-error versions.tex
pdftotext versions.pdf -
lualatex -interaction=nonstopmode -halt-on-error -jobname=versions-lua versions.tex
pdftotext versions-lua.pdf -
typst compile versions.typ versions-typst.pdf
pdftotext versions-typst.pdf -
pdfinfo versions.pdf | grep Producer
pdfinfo versions-lua.pdf | grep Producer
pdfinfo versions-typst.pdf | grep Creator
""")

Output

$ pdflatex -interaction=nonstopmode -halt-on-error versions.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./versions.tex
LaTeX2e <2026-06-01>
L3 programming layer <2026-09-09>
(…/texmf-dist/tex/latex/base/article.cls
Document Class: article 2025/01/22 v1.4n Standard LaTeX document class
(…/texmf-dist/tex/latex/base/size10.clo)) (…/texmf-dist/tex/latex/l3kernel/l3backend-pdftex.def)
No file versions.aux.
[1{…/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./versions.aux) )<…/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb><…/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on versions.pdf (1 page, 27096 bytes).
Transcript written on versions.log.
$ pdftotext versions.pdf -
Versions
LaTeX format: 2026-06-01
Engine: This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026)
kpathsea version 6.4.2

1

$ lualatex -interaction=nonstopmode -halt-on-error -jobname=versions-lua versions.tex
This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) 
 restricted system commands enabled.
(./versions.tex
LaTeX2e <2026-06-01>
L3 programming layer <2026-09-09>
 (…/texmf-dist/tex/latex/base/article.cls
Document Class: article 2025/01/22 v1.4n Standard LaTeX document class
(…/texmf-dist/tex/latex/base/size10.clo)) (…/texmf-dist/tex/latex/l3kernel/l3backend-luatex.def)
No file versions-lua.aux.
[1{…/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./versions-lua.aux))
 411 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 49 glue_spec, 4 attribute_list, 1 write nodes
   avail lists: 2:36,3:10,4:2,5:28,6:6,7:246,9:24,11:18
<…/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf><…/texmf-dist/fonts/opentype/public/lm/lmroman12-bold.otf>
Output written on versions-lua.pdf (1 page, 7790 bytes).
Transcript written on versions-lua.log.
$ pdftotext versions-lua.pdf -
Versions
LaTeX format: 2026-06-01
Engine: This is LuaHBTeX, Version 1.24.0 (TeX Live 2026)

1

$ typst compile versions.typ versions-typst.pdf
$ pdftotext versions-typst.pdf -
Versions
Typst 0.15.1

$ pdfinfo versions.pdf | grep Producer
Producer:        pdfTeX-1.40.29
$ pdfinfo versions-lua.pdf | grep Producer
Producer:        LuaTeX-1.24.0
$ pdfinfo versions-typst.pdf | grep Creator
Creator:         Typst 0.15.1

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 doc_versions_session.py

The same versions.tex reported pdfTeX when pdflatex built it and LuaHBTeX when lualatex did, because the engine is chosen by the command, not by the file. The last three commands read the PDFs’ own records: a PDF names the program that wrote it, pdfTeX-1.40.29, LuaTeX-1.24.0 or Typst 0.15.1, so you can tell how any PDF was made without its source.

Two TeX installations on one PATH

Wrong: installing TeX Live 2026 next to an older MacTeX or a Linux package and assuming the new one runs. Right: run which -a pdflatex (on Windows, where pdflatex), and check the first line of the log, which names the TeX Live year that really ran; remove the old one, or put the new one first on your PATH.

PDF Metadata Viewer & Editor Open any PDF in your browser and read its Producer and Creator to see which engine or program wrote it.

Key idea

Trust the version line of the build, not the installer you remember running: the log, --version and the PDF’s producer all say which engine, LaTeX release and TeX Live year really ran.

Checkpoint

Check: Checking versions

  1. Question 1 of 2 You receive a PDF but not its source. How can you tell whether pdfTeX, LuaTeX or Typst wrote it?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Read the PDF's own record of the program that wrote it, its Producer or Creator, with pdfinfo or a metadata viewer

    Every PDF in the session named the program that wrote it: Producer for the TeX engines, Creator for Typst. The PDF Metadata Viewer tool shows the same fields in a browser.

  2. Question 2 of 2 which -a pdflatex lists an old MacTeX copy first and your new TeX Live 2026 second. What runs when you type pdflatex, and how do you confirm it?

    Choose one answer.

    Show the answer: Question 2 of 2

    Answer: The old copy, the first on PATH; the first line of the log names its TeX Live year

    Order on PATH decides which copy runs. Check the log's first line or pdflatex --version, then remove the old installation or put the new one first.

A missing class or package is one install away

Sooner or later a document asks for something your distribution does not have. This file uses the exam class, which teachers use for question papers and which this TinyTeX does not include. The session shows the error, then asks the tree what is installed, without touching the network:

quiz.tex: a document whose class is missing TEX · quiz/quiz.tex
\documentclass{exam}
\begin{document}
\begin{questions}
\question What does the command pdflatex start?
\end{questions}
\end{document}
A missing class, and what is installed Python · missing_package_session.py
from session import files, run

# A document whose class is not installed: the error, then how to find out what is installed, without the network.
files("quiz/quiz.tex")
run("""
!pdflatex -interaction=nonstopmode -halt-on-error -file-line-error quiz.tex
kpsewhich article.cls
!kpsewhich exam.cls
tlmgr info --only-installed --data name,installed,cat-version csquotes
tlmgr info --only-installed exam
""")

Output

$ pdflatex -interaction=nonstopmode -halt-on-error -file-line-error quiz.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./quiz.tex
LaTeX2e <2026-06-01>
L3 programming layer <2026-09-09>

! LaTeX Error: File `exam.cls' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)

Enter file name: 
./quiz.tex:2: Emergency stop.
<read *> 
         
l.2 \begin
          {document}^^M
./quiz.tex:2:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on quiz.log.
[exit status 1]
$ kpsewhich article.cls
…/texmf-dist/tex/latex/base/article.cls
$ kpsewhich exam.cls
[exit status 1]
$ tlmgr info --only-installed --data name,installed,cat-version csquotes
csquotes,1,5.2p
$ tlmgr info --only-installed exam
package:     exam
installed:   No

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 missing_package_session.py

The error names a file, exam.cls, not a package. kpsewhich looks a file up in the installed tree: it printed the path of article.cls, printed nothing for exam.cls and ended with exit status 1. tlmgr info --only-installed reads only the local package list, so it works offline: it gave 1 (installed) for csquotes and installed: No for exam. To fix the build in TeX Live or TinyTeX, find the package that holds the file with tlmgr search --global --file exam.cls and install it with tlmgr install exam; tlmgr also installs what that package depends on and updates the file database. Step through the fix, and where MiKTeX differs:

Interactive · stage by stage From "File not found" to a working build Step through the fix for quiz.tex, whose exam class is not installed, in TeX Live or TinyTeX, and see where MiKTeX differs.
From "File not found" to a working build, step 6 of 6. Showing The build stops, Is the file installed? (printed nothing, status 1), Which package has it?, Install that package, Build again. In focus: miktex.MiKTeX installs it for youThe build stopsFile `exam.cls' not foundIs the file installed?printed nothing, status 1Which package has it?tlmgr search --global --fileInstall that packagetlmgr install examBuild againsame command as before

The drawing shows the whole scene; its 6 steps are listed below.

Every step as text
  1. The error names a file. pdflatex stopped at the first line that needs the class, with LaTeX Error File exam.cls not found. The error names a file, not a package, and the build wrote no PDF.
  2. Ask the tree. kpsewhich exam.cls looks the file up in the installed TeX tree. It printed nothing and ended with exit status 1, so the file is really not installed; a typo in the class name would look the same.
  3. Find its package. A file and its package often share a name, as exam.cls and exam do, but not always. tlmgr search --global --file exam.cls asks the online TeX Live repository which package holds the file.
  4. Install the package. tlmgr install exam downloads the package and updates the file database. A system-wide TeX Live on Linux or macOS may need the command run with administrator rights.
  5. Build again. The same pdflatex command now finds exam.cls and continues. If it stops on another missing file, repeat the steps for that one.
  6. MiKTeX takes a shortcut. MiKTeX's package manager installs missing parts from the internet when a document needs them, so the build continues without the middle steps, as long as the computer is online.

A file and its package often share a name, as exam.cls and exam do, but not always, which is why the search step exists. On Overleaf you choose a project’s TeX Live year in its settings instead, and new projects use the newest one.

Checkpoint

Check: Fixing a missing package

  1. Question 1 of 2 What did kpsewhich exam.cls do in the session, and what did it tell you?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: It printed nothing and ended with exit status 1, so exam.cls is not in the installed tree

    kpsewhich answers "is this file installed, and where?" from the local TeX tree. A path means yes; no output and exit status 1 mean no.

  2. Question 2 of 2 In TeX Live or TinyTeX, a build stops with a missing file whose package name you do not know. Which commands find and install it?

    Choose one answer.

    Show the answer: Question 2 of 2

    Answer: tlmgr search --global --file with the file name, then tlmgr install with the package it names

    A file and its package often share a name, but not always, so search first, then install. tlmgr updates the file database too, and the same build command then finds the file.

An editor that builds on save, or one in the browser

Any plain-text editor can write LaTeX and Typst, and the TeX Live guide notes that something TeX-specific is not required. An editor that builds and shows the PDF as you type saves a lot of switching, though:

Editor Builds What it adds
VS Code with LaTeX Workshop LaTeX Builds on save, shows the PDF beside the source, jumps between a line and its place in the PDF
VS Code with Tinymist Typst An integrated language service: a live preview, diagnostics as you type, export to PDF
TeXstudio LaTeX A dedicated LaTeX editor with its own PDF viewer
TeXworks or TeXShop LaTeX Installed with TeX Live on Windows (TeXworks) and with MacTeX (TeXShop)
Overleaf LaTeX A browser editor; the TeX Live year is a setting of each project
The Typst web app Typst A browser editor with a live preview

Online editors need no installation at all, but they decide the version for you. Overleaf’s documentation says new projects compile with the latest TeX Live on its servers while existing projects keep the year they were created with, so an old project can fail on a package a new project has. Check the year in the project’s settings before you blame the document.

One build command everywhere

Whatever editor you choose, make sure it runs the same command you would type, such as latexmk -pdf or typst compile, so a build that works in the editor also works in a script.

Checkpoint

Check: Editors and online editors

  1. One question An Overleaf project created years ago fails on a package that builds fine in a new project. What should you check first?

    Choose one answer.

    Show the answer: One question

    Answer: The TeX Live year in the old project's settings

    Online editors pick the TeX Live year per project. Moving an old project to a newer year usually fixes a package that needs newer code, after you check that nothing else breaks.

Practise: check an installation from its output

A lab or a coaching class often checks many computers at once by asking students to paste their version lines. Build that check in two steps: read the versions out of the pasted text, then flag anything older than this track’s versions. The sample tests paste real version lines:

Code lab · 2 steps

Check an installation from pasted output

Read the TeX Live year, the LaTeX release and the Typst version from pasted output, then list what is missing or older than this track uses.

  1. Read the versions out of a build's output To do
  2. Flag an installation that is older than the track's To do

Exercise · Easy · Python

Read the versions out of a build's output

Write read_versions(text) in versions.py. It reads text that a student pasted from their computer, any mix of pdflatex --version, the start of a LaTeX log and typst --version, and returns a dictionary with three keys:

  • "texlive": the TeX Live year as a whole number, from text such as (TeX Live 2026);
  • "latex": the LaTeX release as a string, from the line LaTeX2e <…>, the part between the angle brackets;
  • "typst": the Typst version as a string such as "0.15.1", from a line that starts with typst .

A value the text does not contain is None. The sample tests use lines that the lesson's sessions really printed, plus lines from older installations.

Starter code · versions.py

import re


def read_versions(text):
    """Return {"texlive": year or None, "latex": release or None, "typst": version or None} found in text."""
    found = {"texlive": None, "latex": None, "typst": None}
    # Replace this comment with one search per value.
    return found
The sample tests · test_versions.py
from versions import read_versions

PDFLATEX = "pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026)\nkpathsea version 6.4.2"
LOG = "This is LuaHBTeX, Version 1.24.0 (TeX Live 2026)\n(./versions.tex\nLaTeX2e <2026-06-01>\nL3 programming layer <2026-09-09>"
TYPST = "typst 0.15.1 (9dfd3a08)"


def test_all_three():
    """finds the year, the LaTeX release and the Typst version in one paste"""
    assert read_versions("\n".join([PDFLATEX, LOG, TYPST])) == {"texlive": 2026, "latex": "2026-06-01", "typst": "0.15.1"}


def test_only_a_log():
    """leaves Typst as None when the text has no Typst line"""
    assert read_versions(LOG) == {"texlive": 2026, "latex": "2026-06-01", "typst": None}


def test_nothing_found():
    """returns None for every value when the text names no tool"""
    assert read_versions("command not found: pdflatex") == {"texlive": None, "latex": None, "typst": None}


def test_older_installation():
    """reads older versions the same way"""
    text = "This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024)\nLaTeX2e <2024-11-01>\ntypst 0.13.1"
    assert read_versions(text) == {"texlive": 2024, "latex": "2024-11-01", "typst": "0.13.1"}


def test_typst_word_in_a_sentence():
    """does not take a sentence that only mentions typst as a version line"""
    assert read_versions("I will install typst later.")["typst"] is None
A hint

Use one regular expression per value with re.search, and take the group you need: r"TeX Live (\d{4})" for the year, r"LaTeX2e <([^>]+)>" for the release and r"^typst (\d+\.\d+\.\d+)" with re.MULTILINE for Typst. Turn the year into a number with int().

The sample tests run on this device, in your browser (Pyodide): nothing is sent to mysmartcopilot.com. The first run downloads Python (about 13.5 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.

Exercise · Easy · Python

Flag an installation that is older than the track's

Write version_problems(found, pins) in problems.py. Both arguments are dictionaries with the keys "texlive" (a year, a whole number), "latex" (a release written as year-month-day, a string) and "typst" (a version such as "0.15.1", a string). found is what a student's computer reported, as read_versions returns it, and may hold None; pins holds the versions this track uses.

Return a list of messages, in the order TeX Live, LaTeX, Typst, one for each value that is missing or older than its pin:

  • missing: "TeX Live: not found", "LaTeX: not found" or "Typst: not found";
  • older: "TeX Live 2025 is older than 2026", "LaTeX <found> is older than <pin>", "Typst 0.14.2 is older than 0.15.1", with the actual values.

A value equal to or newer than its pin gives no message. Compare Typst versions number by number, so that 0.9.0 is older than 0.15.1.

Starter code · problems.py

def version_problems(found, pins):
    """Return a message for each value of found that is missing or older than its pin: TeX Live, LaTeX, then Typst."""
    problems = []
    # Replace this comment with one check per value.
    return problems
The sample tests · test_problems.py
from problems import version_problems

PINS = {"texlive": 2026, "latex": "2026-06-01", "typst": "0.15.1"}


def test_up_to_date():
    """reports nothing when every value equals its pin"""
    assert version_problems({"texlive": 2026, "latex": "2026-06-01", "typst": "0.15.1"}, PINS) == []


def test_older_tex_live_and_latex():
    """reports an older TeX Live and an older LaTeX, in that order"""
    found = {"texlive": 2025, "latex": "2025-11-01", "typst": "0.15.1"}
    assert version_problems(found, PINS) == ["TeX Live 2025 is older than 2026", "LaTeX 2025-11-01 is older than 2026-06-01"]


def test_missing_typst():
    """reports a value that was not found"""
    found = {"texlive": 2026, "latex": "2026-06-01", "typst": None}
    assert version_problems(found, PINS) == ["Typst: not found"]


def test_typst_versions_compare_by_number():
    """treats 0.9.0 as older than 0.15.1, and 0.16.0 as newer"""
    assert version_problems({"texlive": 2026, "latex": "2026-06-01", "typst": "0.9.0"}, PINS) == ["Typst 0.9.0 is older than 0.15.1"]
    assert version_problems({"texlive": 2026, "latex": "2026-06-01", "typst": "0.16.0"}, PINS) == []


def test_nothing_found():
    """reports all three when the paste named no tool"""
    found = {"texlive": None, "latex": None, "typst": None}
    assert version_problems(found, PINS) == ["TeX Live: not found", "LaTeX: not found", "Typst: not found"]
A hint

Releases written as year-month-day compare correctly as strings, and years as numbers. Typst versions do not: "0.9.0" < "0.15.1" is False for strings, so turn each into a tuple of numbers first, tuple(int(part) for part in version.split(".")), and compare the tuples.

The sample tests run on this device, in your browser (Pyodide): nothing is sent to mysmartcopilot.com. The first run downloads Python (about 13.5 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.

Then answer questions about distributions, versions and packages; the ones you get wrong come round again:

Practice that adapts to you

Practise this lesson

11 questions about 5 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.

  1. Question 1 of 11 How many megabytes of disk space does the full TeX Live scheme need in the example screen of the TeX Live guide?

    Type a number.

    A hint

    The number is in the first sentence of the lesson.

    Show the answer: Question 1 of 11

    Answer: 9402 MB

    The guide's example installer screen shows 9,402 MB for the full scheme, which is why smaller schemes, MiKTeX and TinyTeX exist for computers with little space.

  2. Question 2 of 11 A MiKTeX user opens a document that loads a package they have never used, and the computer is online. What happens?

    Choose one answer.

    Show the answer: Question 2 of 11

    Answer: MiKTeX's package manager installs the missing package from the internet, and the build continues

    MiKTeX installs missing parts on demand. Offline, the same document would stop, because the package cannot be fetched.

  3. Question 3 of 11 Which of these installs Typst on Windows, according to Typst's README?

    Choose one answer.

    Show the answer: Question 3 of 11

    Answer: winget install --id Typst.Typst

    Typst is one program: winget on Windows, brew on macOS, cargo anywhere, or a binary from the releases page.

  4. Question 4 of 11 You will write on a long flight with no connection, in a Typst template that imports two packages you have never used. What do you do before the flight?

    Choose one answer.

    Show the answer: Question 4 of 11

    Answer: Build the document once while online, so both packages are downloaded into the local cache

    A first build while online fills Typst's package cache; later builds read the cache and need no connection.

  5. Question 5 of 11 In versions.tex, what does \fmtversion print into the PDF?

    Choose one answer.

    Show the answer: Question 5 of 11

    Answer: The release of the LaTeX format that built the document

    \fmtversion is the LaTeX release, written year-month-day. The engine and the TeX Live year come from the engine's banner, and Typst's sys.version gives the Typst compiler's version.

  6. Question 6 of 11 The same versions.tex printed pdfTeX once and LuaHBTeX once. What decided the engine?

    Choose one answer.

    Show the answer: Question 6 of 11

    Answer: The command that built it, pdflatex or lualatex

    The engine is chosen when you type the command: pdflatex starts pdfTeX and lualatex starts LuaHBTeX. A template that needs one engine says so, and your editor must run that command.

  7. Question 7 of 11 A student pastes This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024). This track uses TeX Live 2026. What do you tell them?

    Choose one answer.

    Show the answer: Question 7 of 11

    Answer: Their TeX Live is two years older than the track's, so install TeX Live 2026 or expect some examples to differ

    The banner names the TeX Live year in brackets. A learner on an older year can follow most lessons, but a feature added since then fails, so updating is the safe advice.

  8. Question 8 of 11 Why does the fix for a missing file begin with tlmgr search --global --file instead of tlmgr install with the file's name?

    Choose one answer.

    Show the answer: Question 8 of 11

    Answer: A file and the package that holds it do not always share a name

    The error names a file; tlmgr installs packages. The search maps one to the other, then tlmgr install takes the package name.

  9. Question 9 of 11 A class works on your laptop with TeX Live 2026 but not in an old Overleaf project. What is the first thing to try there?

    Choose one answer.

    Show the answer: Question 9 of 11

    Answer: Set the project to the newest TeX Live year in its settings and build again

    On an online editor the TeX Live year is a project setting. Moving an old project to the newest year is the first thing to try, then check the rest of the document still builds.

  10. Question 10 of 11 Which VS Code extension in the lesson builds Typst documents?

    Choose one answer.

    Show the answer: Question 10 of 11

    Answer: Tinymist

    In VS Code, LaTeX Workshop handles LaTeX and Tinymist handles Typst; TeXstudio, TeXworks and TeXShop are stand-alone LaTeX editors.

  11. Question 11 of 11 A document builds in your editor but fails in the build script you wrote for it. What is the first thing to compare?

    Choose one answer.

    Show the answer: Question 11 of 11

    Answer: The command each one runs, such as latexmk -pdf or lualatex, and its options

    An editor is a front end for a build command. When editor and script disagree, compare the commands and their options first, then the versions they find on PATH.

Interview questions

Warm-up (fresher to 2–5 years): how do TeX Live, MiKTeX and TinyTeX differ?

All three are TeX distributions: they install the engines, the LaTeX format, packages and fonts. TeX Live, from the TeX Users Group, is the comprehensive one, with a yearly release for Unix, macOS (as MacTeX) and Windows; a full installation takes several gigabytes, and tlmgr adds or updates packages. MiKTeX starts small and fetches a package over the internet at the moment a document asks for it. TinyTeX is a small distribution built from TeX Live, tens of megabytes at first, that grows as you install packages with tlmgr. Choose by disk space, by whether you work offline, and by what your template or team uses; check the result with pdflatex --version and the first line of a log.

Two harder questions follow, about a build that works on one computer and fails on another, and about an old installation that will not go away. Decide your first step before you open each one:

Model answers open with any pass: ₹79 for 1 week ($2.99), one payment that never renews.

  1. Fresher to mid

    Every student's thesis builds on their own laptop, but the department's build server stops on some of them with "File `exam.cls' not found" or a similar missing file. What do you check, and how do you make the build give the same result for everyone?

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page. First step and follow-ups

  2. Fresher to mid

    You installed TeX Live 2026, yet your logs still begin with TeX Live 2023 and a package you just installed with tlmgr is not found. Explain what is going on and how you fix it without reinstalling anything.

    Model answer, Pro. First step and follow-ups

Key takeaways

  • A distribution brings the engines, the LaTeX format, packages and fonts: TeX Live is complete and large, MiKTeX installs missing parts on demand, TinyTeX starts small and grows, and online editors install nothing.
  • Typst is one program with its own fonts; it downloads packages on first use, so build once online before working offline.
  • --version, the first lines of a log, \fmtversion, sys.version and a PDF’s producer all say which engine, release and TeX Live year really ran, and which -a shows which copy of a command runs first.
  • A missing class or package stops the build with the name of a file: confirm it with kpsewhich, find its package and install it with tlmgr, or let MiKTeX fetch it.
  • An editor that builds on save speeds up writing, and an online editor sets the TeX Live year per project.

Flashcards · 8 cards

Recall it, then check

Say the answer to yourself before you look: recalling it is what makes it stick.

  1. How much disk space do a full TeX Live and a fresh TinyTeX take?

    The TeX Live guide's example screen shows 9,402 MB for a full installation; TinyTeX starts at 50 to 70 MB zipped and grows as you install packages.

  2. What does MiKTeX do when a document needs a package it lacks?

    Its package manager installs the missing component from the internet when a document first needs it, so the first installation stays small.

  3. Why build a Typst document once while online before working offline?

    Typst downloads each package on first import and keeps it in its package cache; later builds of the same version reuse that copy without the network.

  4. How do you find which copy of pdflatex your shell runs?

    which -a pdflatex (where pdflatex on Windows) lists every copy on your PATH in the order the shell tries them; the first line of a log names the TeX Live year that really ran.

  5. Why did the same versions.tex report pdfTeX in one build and LuaHBTeX in another?

    The engine is chosen by the command, pdflatex or lualatex, not by the file.

  6. How can you tell which program made a PDF without its source?

    Read the PDF's producer, which names the program and its version, such as pdfTeX-1.40.29, LuaTeX-1.24.0 or Typst 0.15.1.

  7. A build stops because exam.cls is missing. How do you fix it in TeX Live or TinyTeX?

    Confirm it with kpsewhich exam.cls, find the package that holds the file with tlmgr search --global --file exam.cls, then install it with tlmgr install exam.

  8. Which TeX Live year does an Overleaf project use?

    The one set in the project's settings: new projects compile with the latest TeX Live, while existing projects keep the year they were created with.

Terms in this lesson

TeX tree
The folders where a TeX distribution keeps its classes, packages, fonts and settings, such as texmf-dist. Engines find each file in it by name, and kpsewhich prints where a file is.
tlmgr
The TeX Live Manager: the command that installs, updates and lists the packages of a TeX Live or TinyTeX installation, as in tlmgr install exam or tlmgr update --all.

References

Related tools

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.