The compile-and-check guide

Turn your LaTeX source into a dependable PDF.

Compilation is a repeatable editing step, not a final-day hurdle. Start from a working example, read the first error, and change one thing at a time.

For new and returning LaTeX users · Updated 1 November 2026

Establish a working baseline

A LaTeX project contains plain-text source and, often, supporting files such as figures and a bibliography. The compiler reads those files and produces the PDF. An editor and a compiler have different jobs: a document can look correct in the editor while still containing a command the compiler cannot process.

Before troubleshooting a large project, try this small document in a separate test project. It uses a standard class and a basic equation, with no external images or bibliography.

\documentclass{article}
\usepackage[T1]{fontenc}
\title{A Short Research Note}
\author{Your Name}
\date{}

\begin{document}
\maketitle
\section{Observation}
The sample mean is
\[
  \bar{x} = \frac{1}{n}\sum_{i=1}^{n}x_i.
\]
This document is a small compilation check.
\end{document}

If this succeeds but your full project does not, investigate the project’s files and settings rather than repeatedly pressing Compile. Keep a copy of the failing source before making broad changes.

Use a short compile-and-inspect cycle

  1. Open the intended project and main document. Identify the file that contains \documentclass and the document environment. A chapter fragment is not usually the file to compile on its own.
  2. Begin an editing session if required. In a shared LaTeXDesk project, wait until you have editing access. A Locked control means another editing session is active.
  3. Make one small change, then choose Compile. Wait for the result before starting another run.
  4. Check both the result and the PDF. Read errors or warnings, and inspect a visible detail you just changed. A previously generated PDF may still be present when a later compile fails.

Follow the compiler and package requirements supplied with your template. Some templates require a particular engine. If you do not know whether that engine or package is supported in your project, check the available settings and documentation instead of assuming every local TeX configuration will work online.

Fix the first meaningful error

Several later messages can be consequences of one earlier mistake. Start with the first error in the compiler log, note the file and line, and read a few lines above that location. The place where LaTeX notices a problem is not always where the problem began.

Undefined control sequence

Check the command spelling first. For example, \textbf{Important} is a standard command, while \textbold{Important} is not. If the command belongs to a package, verify that the correct package is loaded in the preamble and is available.

Missing braces or an unfinished environment

Match opening and closing braces in the most recent edit. Check that \begin{itemize} has a corresponding \end{itemize}. A missing brace can make the next heading, paragraph, or end of the document look like the source of the error.

A file cannot be found

Check that the file is uploaded, the path is correct, and capitalization matches exactly. If the missing file ends in .sty or .cls, verify the package or document-class name. Do not rename an unrelated file to satisfy the message.

Special characters in ordinary text

Some characters have a LaTeX meaning. Write 10\% for a percentage and research\_data for an underscore in ordinary text. Put mathematical notation inside an appropriate math environment instead of adding dollar signs at random.

The official introductory course provides worked examples of these issues in Learn LaTeX: dealing with errors.

Distinguish a needed rerun from a broken citation

Tables of contents and cross-references may need another compile after headings or labels change. If a reference remains unresolved, compare the label and reference strings, check for duplicate labels, and confirm that the relevant file is included.

Bibliographies may require a separate processing step. Follow your template’s BibTeX or Biber workflow and the platform’s support for it. A missing citation key, a missing .bib file, and an unrun bibliography step are different problems; repeatedly compiling without identifying which one occurred may not help.

Reduce the problem. If an error is still unclear, make a separate minimal example that retains the failure. Remove unrelated material in small steps. Never discard the only copy of your research while debugging.

Inspect the output, not just the success message

A successful run means the compiler produced output; it does not establish that the research, layout, or citations are correct. An overfull-box warning often points to content extending beyond its intended width. Find that location in the PDF and decide how to fix it without hiding meaningful text.

A practical final pass

  • Check the changed text appears in the latest PDF.
  • Review equations, captions, tables, and page breaks at a readable zoom.
  • Resolve unexplained question marks and missing references.
  • Download the PDF and open it independently before submitting.
  • For a shared project, finish editing when you are ready to hand over.