TroubleshootingMarch 4, 202614 min read

20 Common LaTeX Errors and How to Fix Them (2026 Guide)

From undefined control sequences to runaway arguments and missing citations — a practical guide to the most common LaTeX errors and how to fix them fast.

latexerrorstroubleshootingdebuggingbeginners

LaTeX errors can feel like a brick wall: cryptic messages, line numbers that don't help, and the dreaded "?" prompt. Whether you're writing your first paper or your fiftieth, these 20 errors show up constantly — and once you know the fix, you can resolve them in seconds. This guide is updated for 2026 and includes tips for avoiding many of these issues when you use an AI-powered editor like Bibby AI.

1. Undefined control sequence

Error: ! Undefined control sequence.

Cause: You used a command (e.g. \documentclass, \usepackage, or a package command) that LaTeX doesn't recognize. Usually it's a typo or a missing package.

Fix:

  • Check spelling: \documentcalss\documentclass
  • Add the package that provides the command: \usepackage{amsmath} for \frac, \usepackage{graphicx} for \includegraphics
  • Ensure the command is in the right mode (math vs. text)

In Bibby AI, LaTeX autocomplete suggests valid commands and required packages as you type, so many of these typos never happen.

2. Missing $ inserted

Error: ! Missing $ inserted.

Cause: You used a math-only character or command in text mode. Common culprits: _, ^, \frac, \sum outside of $...$ or \begin{equation}.

% ❌ Wrong — underscore in text
The variable x_1 is important.

% ✅ Correct
The variable $x_1$ is important.
% Or in display math:
\[ x_1 = 0 \]

Bibby's equation and math tools keep math in the right mode and can generate equations from plain language.

3. Runaway argument / unclosed brace

Error: Runaway argument? or ! Paragraph ended before ... was complete.

Cause: A missing } or \end{...}. LaTeX keeps reading until it hits the next } or end-of-paragraph, so the reported line is often after the real error.

Fix: Count braces and environment delimiters. Use your editor's bracket-matching; Bibby AI highlights matching braces in the LaTeX editor so you can spot the mismatch quickly.

4. File not found

Error: ! LaTeX Error: File 'xyz' not found.

Cause: \includegraphics{file}, \input{file}, or \bibliography{refs} references a file that isn't in the path (or the extension is wrong).

% For graphics, no extension or use .pdf/.png
\includegraphics[width=0.8\textwidth]{figures/plot}  % looks for plot.pdf, plot.png, etc.

% For \input/\include, no .tex extension in some setups
\input{chapters/intro}

Check the path relative to your main .tex file. In Bibby AI, project files stay in one place and paths are predictable, so "file not found" is rare.

5. Citations showing as [?] / bibliography missing

Error: Citations appear as [?] and the reference list is empty.

Cause: BibTeX/BibLaTeX wasn't run, or the compile order is wrong. LaTeX needs: pdflatex → bibtex/biber → pdflatex → pdflatex.

Fix: Run the full sequence, or use an editor that does it for you. See our full walkthrough: LaTeX bibliography not showing. In Bibby AI, smart citation search inserts correctly formatted references and manages the bibliography so you avoid most BibTeX pitfalls.

6. Overfull/underfull hbox

Error: Overfull \hbox (X.Xpt too wide) in the log (often not fatal).

Cause: A line or box is too wide for the margin — long URLs, wide tables, or long words without hyphenation.

Fix: Use \sloppy or \usepackage{microtype}, break long URLs with \url or href, or resize tables with \resizebox{\textwidth}{!}{...}. For tables, our LaTeX table generator helps you build tables that fit.

7. Float too large for page

Error: ! LaTeX Error: Float(s) lost. or figures/tables disappear.

Cause: A float (figure/table) is taller than \textheight, so LaTeX can't place it.

Fix: Reduce the float size (e.g. \includegraphics[height=0.85\textheight]), or split into subfigures. More on placement: why LaTeX puts figures in the wrong place.

8. Something's wrong—perhaps a missing \item

Error: ! LaTeX Error: Something's wrong--perhaps a missing \item.

Cause: Empty itemize, enumerate, or description environment, or a blank line/item in a list that confuses the parser.

% ❌ Wrong
\begin{itemize}
\end{itemize}

% ✅ Correct — at least one item
\begin{itemize}
    \item First point.
    \item Second point.
\end{itemize}

9. Misplaced alignment tab character &

Error: ! Misplaced alignment tab character &.

Cause: You used & outside a tabular/array environment. In LaTeX, & is only for column alignment in tables.

% ❌ Wrong — & in normal text
Smith & Jones (2024)

% ✅ Correct — use \& or \and
Smith \& Jones (2024)

In Bibby AI, when you type "&" in text the editor can suggest \& so you avoid this error.

10. Extra alignment tab character &

Error: ! Extra alignment tab character &.

Cause: Too many & in one row of a tabular — the number of columns must match the column spec (e.g. {lcc} means 3 columns, so 2 & per row).

Fix: Count columns: l|c|r = 3 columns → 2 & per row. Use our table generator or CSV to LaTeX tool to generate correct column counts.

11. Undefined reference (??)

Error: \ref{fig:myfig} or \eqref{eq:1} shows ??.

Cause: Label misspelled, label defined in a different file that isn't included, or you need to compile twice (LaTeX resolves refs on the second pass).

Fix: Ensure \label{...} and \ref{...} match exactly (case-sensitive). Compile again; multi-file projects may need a full recompile. Bibby AI handles multi-file projects and recompilation so refs stay in sync.

12. Package/option conflicts

Error: ! LaTeX Error: Option clash for ... or ! Package X Error: ...

Cause: Two packages (or the same package loaded twice with different options) conflict — e.g. geometry and page layout, or babel language options.

Fix: Load conflicting packages once with compatible options, or change the order of \usepackage. When using Bibby's templates, the preamble is already tested so option clashes are avoided.

13. \begin{...} ended by \end{...} mismatch

Error: ! \begin{xyz} ended by \end{abc}.

Cause: Nested environments closed in the wrong order, or a copy-paste left the wrong \end.

% ❌ Wrong
\begin{figure}
\begin{center}
...
\end{figure}   % should be \end{center} first
\end{center}

% ✅ Correct
\begin{figure}
\begin{center}
...
\end{center}
\end{figure}

Bibby's editor highlights \begin/\end pairs so you can catch mismatches before compiling.

14. Missing } inserted

Error: ! Missing } inserted.

Cause: Unbalanced { and } — often inside a command argument or a group.

Fix: Work backward from the line LaTeX reports; use brace matching in your editor. In Bibby AI, matching braces are highlighted so you can fix them quickly.

15. Dimension too large

Error: ! Dimension too large.

Cause: A length (e.g. for a figure or table) exceeds LaTeX's max (~16384pt). Often from \textwidth or \textheight used in the wrong context, or a calculation that overflowed.

Fix: Use a fixed size (e.g. 0.8\textwidth) or a smaller multiplier. Check nested \resizebox or repeated scaling.

16. No positions in optional float specifier

Error: ! LaTeX Error: Unknown float option 'X'. or similar.

Cause: Invalid letter in the float placement, e.g. \begin{figure}[hktbp] (typo: k). Valid: h, t, b, p, !, H (with float package).

% ✅ Correct
\begin{figure}[htbp]
\begin{figure}[H]   % requires \usepackage{float}

See figure placement for a full breakdown of options.

17. Command already defined

Error: ! LaTeX Error: Command \xxx already defined.

Cause: You (or a package) defined \xxx and then tried to define it again without \renewcommand.

Fix: Use \renewcommand{\xxx}{...} to override, or rename your command. Avoid redefining core LaTeX commands; prefer a new name like \mycommand.

18. Font shape/size not available

Error: ! Font shape 'T1/cmr/m/n' not found or similar.

Cause: The requested font family, shape, or size isn't installed or isn't available for the current encoding.

Fix: Install the missing font package (e.g. lmodern, fontenc with T1), or change to a font that is available. With Bibby's cloud compiler, common font packages are available so this error is less frequent.

19. Emergency stop / no output

Error: ! Emergency stop. or the PDF is empty/not produced.

Cause: A fatal error stopped the run — often a missing file, a bad package, or an infinite loop (e.g. a circular \input).

Fix: Read the last few lines of the .log file; the real error is usually just above "Emergency stop." Fix that first. If compilation keeps failing, try a minimal template and add content back gradually. Bibby AI shows clear error messages in the compiler output so you can fix and recompile without digging through logs.

20. Slow compilation / timeout

Error: Not a LaTeX error per se — but builds that never finish or hit a timeout (common on free tiers of cloud editors).

Cause: Large documents, big images, TikZ/PGFPlots, or too many packages.

Fix: Use \includeonly, draft mode, and image optimization. We have a full guide: 7 ways to fix slow LaTeX compilation. With Bibby AI, there are no arbitrary compile timeouts — your document compiles until it's done, and our AI features help you write less boilerplate so there's less to compile.

Quick reference table

ErrorQuick fix
Undefined control sequenceFix typo or add \usepackage{}
Missing $ insertedPut math in $...$ or \[\]
Runaway argumentFind missing } or \end{}
File not foundCheck path and filename (no extension for \includegraphics often)
Citations [?]Run BibTeX/Biber and recompile twice
Overfull hbox\sloppy, microtype, or resize
Float too largeReduce figure/table size
Missing \itemAdd at least one \item in list
Misplaced &Use \& in text
Extra &Match column count in tabular
Undefined ref ??Check label spelling, compile twice
Option clashLoad packages once with compatible options
\begin/\end mismatchClose environments in reverse order
Missing }Balance braces
Dimension too largeUse smaller lengths
Bad float optionUse only h, t, b, p, !, H
Command already definedUse \renewcommand or new name
Font not foundInstall font package or change font
Emergency stopCheck .log; fix last real error
Timeout / slowDraft mode, \includeonly, optimize images

Fewer errors with a smarter editor

Many of these errors come from typos, missing packages, and unclear compiler output. Bibby AI is built to reduce that friction:

Ready to spend less time debugging and more time writing? Try Bibby AI free — no compile limits, AI-assisted LaTeX, and free LaTeX tools all in one place. For more tips, see our write LaTeX faster guide.

Try a LaTeX Editor Built for Researchers

AI-powered writing, smart citations, no compile timeouts. Join 5,000+ researchers using Bibby AI.

Start Writing Free
20 Common LaTeX Errors and How to Fix Them (2026 Guide) | Bibby AI Blog