Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical Supply Distributor100,000+ medical supplies. 48-hour critical dispatch.Ships from 8 regional U.S. hubs. Net-30 terms for verified institutional accounts.Shop lac.us CodeCASRAIlac.us

thebibliography in LaTeX: Syntax, bibitem and When to Use BibTeX Instead

Write and cite a LaTeX thebibliography list: bibitem keys, the widest-label argument, custom labels, fixing [?] citations, and BibTeX alternatives.

Written and maintained by CASRAI Editorial Board

Last updated

The thebibliography environment is LaTeX’s built-in way to write a reference list by hand: you type each reference after a \bibitem command, and \cite commands in the text point to those entries by key. It suits short lists and manuscripts that must carry the references inside the .tex file; for larger or reusable collections, a BibTeX .bib file is the usual route.

Who this is for: researchers writing a LaTeX paper or thesis who need to produce a numbered reference list, fix its alignment, or understand what BibTeX output actually contains. After reading you should be able to write a working thebibliography block, cite from it, and decide whether to keep it or move to a .bib file.

What thebibliography is used for in research

According to the LaTeX2e reference, thebibliography produces a bibliography or reference list, and the manual-entry approach is suited to cases where you have only a few references and can maintain the list by hand (LaTeX2e reference, as mirrored by W3cubDocs, read 2026-11-07). Overleaf’s bibliography documentation describes the same structure as what a LaTeX reference list is under the hood: a thebibliography list of \bibitem entries, while recommending BibTeX for day-to-day use (Overleaf, read 2026-11-07).

The environment is also what BibTeX writes for you. The Tame the BeaST manual (CTAN) notes that BibTeX generally creates complete thebibliography environments, with all the \bibitem entries for the cited references, in a .bbl file. Understanding the hand-written form therefore helps when you read or edit that output.

Install or access

Nothing needs installing beyond a LaTeX distribution or an online editor. thebibliography is not a package: Tame the BeaST explains it is not defined in LaTeX’s kernel and has to be defined by the document class (for example article.cls or book.cls), so it is available with the standard classes. Free ways to compile are a local TeX distribution, or Overleaf, which re-runs the compiler automatically to resolve citations.

Step-by-step: write and cite a hand-made reference list

  1. Open the environment near the end of the document (before \end{document}), with the widest-label argument:

    \begin{thebibliography}{9}
    \bibitem{texbook}
    Donald E. Knuth (1986) \emph{The \TeX{} Book}, Addison-Wesley Professional.
    
    \bibitem{lamport94}
    Leslie Lamport (1994) \emph{LaTeX: a document preparation system}, Addison Wesley, Massachusetts, 2nd ed.
    \end{thebibliography}

    This is the example used in Overleaf’s documentation (read 2026-11-07).

  2. Give every entry a cite key. Each \bibitem takes a cite key as its parameter, which you use with \cite commands (Overleaf).

  3. Cite in the text. For example:

    \LaTeX{} \cite{lamport94} is a set of macros built atop \TeX{} \cite{texbook}.

    Multiple keys can be combined in one command, such as \cite{latexdps, texbook}, which the LaTeX2e reference shows producing a combined label like [1, 2].

  4. Compile twice. The LaTeX2e reference states that you must compile the document twice to resolve the references. Overleaf explains why: after the first run the cite keys are written to the .aux file, and only the second run lets \cite look them up.

The widest-label argument

The mandatory argument is text that, when typeset, is as wide as the widest item label produced by the \bibitem commands. The tradition is 9 for fewer than 10 references and 99 for fewer than 100 (LaTeX2e reference). Overleaf shows the symptom of a value that is too small: with more than ten entries, the numerical labels start to misalign, and switching to {99} fixes it. Tame the BeaST gives the reason: the argument should be the largest label occurring in the list so the margins can be set properly.

Custom labels with the optional argument

The synopsis of the environment is \begin{thebibliography}{widest-label} and \bibitem[label]{cite_key}. When you supply the optional [label], \cite prints that label instead of a sequential number. Tame the BeaST demonstrates this with an alphanumeric label, setting the widest-label argument to the longest label in the list:

\begin{thebibliography}{GMS93}
\bibitem[GMS93]{companion} Michel Goossens, Franck Mittelbach and Alexander Samarin, \emph{The \LaTeX{} Companion}, Addison Wesley, 1993.
\bibitem[Lam97]{lamport} Leslie Lamport, \emph{LaTeX: A Document Preparation System}, Addison Wesley, 1997.
\end{thebibliography}

Output and how to read it

By default the environment produces a numbered list with labels [1], [2] and so on, and \cite inserts the matching label (Overleaf). In the article class a numberless section heading is inserted with the title held in \refname (default “References”); in book and report, a numberless chapter heading uses \bibname (default “Bibliography”) (Overleaf; LaTeX2e reference). To change the heading, redefine the macro after \begin{document}, for example \renewcommand{refname}{Cited references} (LaTeX2e reference). Language packages such as babel redefine these automatically to fit the chosen language.

thebibliography versus a .bib file

Overleaf lists the drawbacks of maintaining \bibitem entries manually: you must format each entry to the required reference style yourself, sort entries yourself if the style needs alphabetical order, and rewrite entries when a different manuscript uses a different style. A .bib database stores format-independent data and a style file does the formatting; Overleaf calls this the recommended approach for most journals and theses.

Approach You maintain Formatting and sorting
thebibliography + \bibitem The reference text inside the .tex file By hand, per reference style
BibTeX with a .bib file A format-independent database of entries Done by the chosen style file

For the BibTeX route, see our guides on adding citations and a bibliography in Overleaf and the BibTeX file format.

Embedding BibTeX output (the .bbl file)

BibTeX writes its formatted result to a .bbl file that contains the thebibliography environment; Tame the BeaST shows the .bbl being read back in with \input of the job name’s .bbl file when the \bibliography command is processed. This is why the generated thebibliography block can be placed in the .tex source to give a document a complete reference list without a separate .bib file. Follow the target publisher’s submission instructions on whether they ask for this.

Troubleshooting

  • Citations show as [?]: the list appears but \cite shows question marks after one run. Run LaTeX again; keys are only read from the .aux file on the second pass (Overleaf). If it persists, check that the key in \cite matches the \bibitem key exactly. See fixing undefined citations and BibTeX errors.
  • Misaligned labels: enlarge the widest-label argument, for example from {9} to {99} (Overleaf).
  • Text before the first entry raises an error: Tame the BeaST notes that placing text right after \begin{thebibliography} fails because the list demands an \item; its workaround is an empty \item[] with the text in a minipage.
  • Heading missing from the table of contents: the heading is an unnumbered \section*, so it is not listed; Tame the BeaST suggests the tocbibind package.
  • Package conflicts: Tame the BeaST warns that packages such as hyperref can conflict with others that redefine thebibliography or \bibitem; the last one loaded wins.
  • “Empty thebibliography environment” warning: LaTeX issues it when the environment contains no references (Tame the BeaST).

Free alternatives

Option What it does Source
BibTeX with a .bib file Extracts cited entries from a database, sorts and formats them, and exports a thebibliography environment Tame the BeaST
biblatex Also uses a .bib file, with a slightly different approach Overleaf
Manual thebibliography Hand-maintained list for a few references LaTeX2e reference

A reference manager can maintain the references for you; see our overview of citation management software for research groups.

FAQ

What is the thebibliography environment in LaTeX?

It is the environment that produces a reference list: a heading followed by a list of \bibitem entries, each with a cite key you use in \cite.

What does the {9} or {99} after \begin{thebibliography} mean?

It sets the label width. Use text as wide as the widest label; by tradition 9 for fewer than 10 references and 99 for fewer than 100.

How do I use a bib file instead?

Create a .bib database, choose a style, and point to the file; BibTeX then builds the thebibliography block for you. Our Overleaf walkthrough covers the steps.

Why do my citations appear as question marks?

The cite keys have not yet been read from the .aux file. Compile again, and confirm the keys match.

Can I rename the References heading?

Yes. Redefine \refname (article) or \bibname (book, report) with \renewcommand after \begin{document}.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about thebibliography in LaTeX: Syntax, bibitem and When to Use BibTeX Instead

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →