LaTeX Reference Section: Bibliography and Cross-References

A LaTeX reference section is usually a bibliography printed from a .bib database file, while references to headings use labels and cross-reference commands. Keeping those two systems separate makes it easy to cite sources, refer to sections by number, and keep everything correct when your document changes. This guide shows both workflows, including compilation and common fixes.

What a LaTeX Reference Section Does

LaTeX uses two different kinds of references:

  • Bibliographic references cite books, papers, websites, and other sources. They appear in a bibliography or references section at the end of the document.
  • Cross-references point readers to numbered parts of the same document, such as sections, subsections, figures, tables, equations, and pages.

A bibliography identifies external sources; a cross-reference points to a numbered location inside your document.

For example, a sentence might cite a research paper and also direct the reader to a section of your report. Those are separate tasks, even though both use “references.”

How to Add a LaTeX Bibliography Reference Section

Use a bibliography manager when you want LaTeX to format citations and generate the reference list automatically. The biblatex workflow is a flexible modern choice and keeps source details in a separate .bib file.

Choose the workflow that matches what you need before adding anything to your document.

You Need To Do Use Result
Cite books, articles, papers, or websites biblatex with a .bib file In-text citations and a generated reference list
Refer to a heading, figure, table, or equation Labels and cross-references Automatically updated section or item numbers
Refer to where a section begins A page cross-reference The page number containing the label
  1. Create a bibliography database file in your project. A common name is references.bib, but you can use any filename.
  2. In the document preamble, before the document begins, load the bibliography package.

For an Overleaf Online LaTeX Editor project, add this package line in the preamble:

\usepackage{biblatex}
  1. Add \addbibresource{sample.bib} immediately after \usepackage{biblatex} to import the bibliography data file: The example below expects a file named sample.bib in the same folder as the main document.
\addbibresource{sample.bib}

The filename and path must match your actual bibliography file. For example, if your file is named references.bib, replace sample.bib with that exact name; if it is in a subfolder, include the relative path.

Add entries to the .bib file using a citation key that you will later use in your document:

@article{einstein,
  author  = {Albert Einstein},
  title   = {Zur Elektrodynamik bewegter K{\"o}rper},
  journal = {Annalen der Physik},
  year    = {1905},
  volume  = {17},
  pages   = {891--921}
}

The key here is einstein. It must be unique, and citation keys are case-sensitive. Avoid spaces in keys.

I use a plain-text editor for .bib files because it makes citation keys and file paths easy to inspect when a reference does not resolve.

Step 2: Insert a Citation Where You Use the Source

  1. Put the cursor in the document text where you need to cite the source.
  2. Insert a citation using the key from the .bib entry.
\cite{einstein}

The citation style controls whether the result appears as a number, an author-year citation, or another format. Do not type reference numbers manually: LaTeX can renumber citations when you add, remove, or reorder sources.

Step 3: Print the Bibliography Where the Reference Section Belongs

  1. Go to the end of the document, usually after the final chapter, section, appendix, or conclusion.
  2. Add the bibliography-printing command.
\printbibliography

This command creates the visible bibliography section. Linking a .bib file alone does not print a reference list.

By default, the bibliography normally includes entries cited in the document. The style you select determines which fields from each entry appear, such as author, title, publication year, journal, volume, pages, or URL.

Step 4: Compile the Document With Biber

A bibliography needs more than one processing pass because LaTeX writes citation data first, then the bibliography processor creates formatted reference data.

For a local document named main.tex, run the following sequence:

pdflatex main.tex
biber main
pdflatex main.tex
pdflatex main.tex

In an online editor, recompile the project and make sure the bibliography backend is set to Biber if your project configuration requires choosing one. Check the output after compiling: citations should be formatted, and the bibliography should appear where you placed the print command.

How to Cross-Reference LaTeX Sections

Cross-references are for locations within the same document. They are useful for statements such as “see Section 3,” “as discussed in Subsection 2.1,” or “the procedure starts on page 7.”

LaTeX assigns numbers to sectioning commands automatically. A label captures the current number, and a reference command recalls it later.

Step 1: Put a Label Immediately After the Heading

  1. Add the sectioning command for the heading that needs a cross-reference:
\section{Methods}
  1. Place a \label command immediately after the \section or \subsection command so LaTeX stores the heading’s number:
\label{sec:methods}

Use a consistent naming pattern such as sec: for sections and subsec: for subsections. Label keys can contain letters, numbers, and punctuation, but not spaces. Uppercase and lowercase letters are different.

Step 2: Insert the Section Number in Your Text

Use the label key wherever you need the section number to appear.

Section~\ref{sec:methods}

The tilde keeps “Section” and the generated number on the same line. If the Methods section moves from Section 2 to Section 4, LaTeX updates the reference automatically after compilation.

Step 3: Reference a Subsection or a Page Number

Subsections use the same method: place a label after the subsection heading, then reference that label.

\subsection{Data Collection}
\label{subsec:data-collection}

To refer to the subsection number in a sentence, use its label:

Subsection~\ref{subsec:data-collection}

To show the page where a labeled section starts, use a page cross-reference:

page~\pageref{sec:methods}

You can use the same section label for both a section number and its page number.

Step 4: Compile the Document Twice

Cross-references are resolved through LaTeX’s auxiliary files. The first compilation records label information; the second applies the correct numbers and page references.

If you see ?? instead of a section number or page number, compile again. If it remains unresolved, check that the label key and the reference key match exactly.

Customize the Bibliography Heading and Contents Entry

The default bibliography title may be “Bibliography,” but many academic, technical, and business documents use “References” instead.

To change the title, replace the basic bibliography-printing command with this version:

\printbibliography[title={References}]

To add the bibliography heading to the table of contents, use this version:

\printbibliography[heading=bibintoc]

To change the title and add it to the table of contents in one command, use:

\printbibliography[title={References},heading=bibintoc]

Use one bibliography-printing command in the final document. Adding several print commands without a deliberate reason can produce duplicate reference lists.

You can also print a filtered bibliography instead of the complete list. For example, this creates a reference section containing only entries classified as articles:

\printbibliography[type=article,title={Journal Articles}]

Filtered bibliographies are useful for long reports that separate journal articles, books, standards, datasets, or web sources.

Check and Prevent Reference Problems

Before submitting or sharing a document, verify that both citation references and cross-references are working.

Confirm the Finished Output

Check the compiled PDF for these results:

  • Every in-text citation has the expected format instead of a placeholder.
  • The reference section appears once, in the correct location.
  • Every cited key has a matching bibliography entry.
  • Section and subsection references show numbers instead of ??.
  • Page references point to the correct page.
  • The bibliography heading appears in the table of contents if you requested it.

Fix Common Problems

Citations show as undefined. Make sure the key in the citation matches the key in the .bib entry exactly. Also verify that the bibliography file name and path in the database-linking command are correct.

The bibliography does not appear. A .bib file is only source data. You must also include a bibliography-printing command in the document body and compile with the correct bibliography processor.

A section reference shows ??. Check that the label appears after the section or subsection command, then compile the document twice. Confirm that you did not misspell or change the label key.

A reference points to the wrong section. Each label must be unique. Reusing one key in multiple places can cause LaTeX to use the wrong stored value.

The reference list has unwanted duplicates. Keep one final bibliography-printing command unless you intentionally use filtered bibliographies in separate locations.

Next, add one real source entry to your .bib file, cite it by its exact key, print the bibliography, and compile the project to confirm that both the citation and reference section appear correctly.

Frequently Asked Questions

Can I reference a section before it is defined?

Yes. You can place a cross-reference earlier in the document than the section it points to. LaTeX records the label when it reaches that section, so the first compilation may show an unresolved reference and the next compilation resolves it.

What Does the Tilde Do in Section~\ref{...}?

The tilde creates a nonbreaking space. It prevents “Section” from being separated from its number at the end of a line, so the output stays together as “Section 3” rather than splitting across lines.

How Do I Cite Multiple Sources in LaTeX?

Put multiple bibliography keys in one citation command, separated by commas.

\cite{einstein,dirac}

Both keys must exist in the linked .bib file. Your bibliography style determines whether the output appears as a combined numeric citation, an author-year group, or another format.

How Do I Reference the Page Number of a Section?

Use a page cross-reference with the same label assigned to the section heading.

page~\pageref{sec:methods}

The result is the page where that labeled section begins, and LaTeX updates it when pagination changes.

How Do I Reference a Subsection in LaTeX?

Place a \label{…} directly after the \subsection{…} command, then write Subsection~\ref{…} where you want its number to appear. The label stores the current subsection number under its key, and \ref{…} recalls that number elsewhere in the document.