references-citations
Cross-references and Bibliography Management
Two powerful automation tools for long documents: cross-references (sections, figures, tables, and formulas pointing to each other) and bibliography management (BibTeX). Their shared philosophy: numbering is always automatic; you are only responsible for choosing a "label name."
Labels and References: \label and \ref
Cross-referencing in three steps: use \label{label} at the referenced location, and use \ref{label} (or \pageref, \eqref) at the reference location to get the number.
| Command | Output | Typical Use |
|---|---|---|
\label{key} | No output; tags the preceding object | Immediately after \section, \caption, or equation |
\ref{key} | Number (e.g., 3, 1.2) | Section~\ref{sec:method} |
\eqref{key} | Number in parentheses (e.g., (1)) | Eq.~\eqref{eq:loss} (for formulas) |
\pageref{key} | Page number | See page~\pageref{sec:method} |
\labelmust immediately follow the referenced command and be written at the same environment level—\section{Method}\label{sec:method}is the correct posture; if you move\labelto the next paragraph, it will refer to the wrong object. Formula\labelmust be written inside the equation environment.
Example: Cross-referencing Sections, Formulas, and Figures
\documentclass{ctexart}
\usepackage{amsmath, graphicx}
\begin{document}
\section{Method}\label{sec:method}
This section introduces the model structure. The loss function is Eq.~\eqref{eq:loss},
and the experimental analysis is in Section~\ref{sec:result}.
\begin{equation}\label{eq:loss}
L = \sum_{i=1}^n \left( y_i - \hat{y}_i \right)^2
\end{equation}
\section{Experimental Results}\label{sec:result}
The loss of the method (Section~\ref{sec:method}) is measured by Eq.~\eqref{eq:loss},
and the curve shape is shown in Figure~\ref{fig:sin}.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{sin}
\caption{Sine curve}
\label{fig:sin}
\end{figure}
\end{document}
1 Method
This section introduces the model structure. The loss function is Eq. (1), and the experimental analysis is in Section 2.
2 Experimental Results
The loss of the method (Section 1) is measured by Eq. (1), and the curve shape is shown in Figure 1.

Figure 1: Sine curve
The compiled effect of cross-referencing sections, formulas, and figures: All references automatically obtained the correct numbers. No matter how many new sections or formulas are inserted later, numbering and references will update automatically—the ultimate cure for the "manually changing numbers until collapse" problem in Word.
Label naming suggests the "prefix:content" convention. Common prefix conventions are as follows.
| Prefix | Object | Example |
|---|---|---|
| sec: | Section | \label{sec:method} |
| fig: | Figure | \label{fig:sin} |
| tab: | Table | \label{tab:result} |
| eq: | Formula | \label{eq:loss} |
| chap: | Chapter (report/book) | \label{chap:intro} |
Hyperlinks: The hyperref Package
After loading hyperref, all \ref, \cite, and \url automatically become clickable links, and a sidebar bookmark panel is generated in the PDF.
Example: Common hyperref Configuration
\usepackage[colorlinks=true, linkcolor=blue, % Body references: blue
citecolor=blue, urlcolor=blue]{hyperref}
% colorlinks=true marks links with color (default red boxes look bad)
% The three parameters control: internal references / citations / URL colors
\url{https://uniresearch.uniplore.com/} % URL typesetting: automatic line breaks, clickable
After configuration, references and URLs in the document become clickable hyperlinks.
For example: https://uniresearch.uniplore.com/
hyperrefshould almost always be the last package loaded in the preamble—it needs all other packages to be in place before it can correctly transform the document; loading it too early can cause mysterious conflicts.
Bibliographies: The BibTeX Workflow
The correct approach to bibliographies is not to hand-write a list at the end of the document, but to store bibliographic information in a .bib database, cite with \cite in the body, and let the BibTeX program automatically generate a formatted reference list.
First, see what a literature database looks like—each entry is an "item."
Example: refs.bib Literature Database
@article{alexnet2012, % Entry type: journal article
author = {Krizhevsky, Alex and Sutskever, Ilya and Hinton, Geoffrey E.},
title = {ImageNet Classification with Deep Convolutional Neural Networks},
journal = {Communications of the ACM},
year = {2017},
volume = {60},
pages = {84--90}
}
@book{goodfellow2016, % Entry type: book
author = {Goodfellow, Ian and Bengio, Yoshua and Courville, Aaron},
title = {Deep Learning},
publisher = {MIT Press},
year = {2016}
}
The first item in braces is the citation key (e.g., alexnet2012). In the body, \cite{alexnet2012} uses it to find this entry; the key name is arbitrary but must be unique throughout the document.
| Entry Type | Corresponding Literature | Key Fields |
|---|---|---|
@article | Journal article | author, title, journal, year |
@inproceedings | Conference paper | author, title, booktitle, year |
@book | Book | author/editor, title, publisher, year |
@phdthesis | PhD thesis | author, title, school, year |
@misc / @online | Webpage, report, etc. | title, url, note, year |
There are only two commands on the body side, placed at the end of the document:
Example: Citing and Generating a Reference List
\documentclass{ctexart}
\begin{document}
The breakthrough in deep learning originated from AlexNet~\cite{alexnet2012},
and systematic textbooks can be referenced~\cite{goodfellow2016}.
\bibliographystyle{plain} % Bibliography style: plain numeric style
\bibliography{refs} % Bibliography database file (without .bib extension)
\end{document}
The breakthrough in deep learning originated from AlexNet[2], and systematic textbooks can be referenced[1].
References
[1] Goodfellow I, Bengio Y, Courville A. Deep Learning[M]. MIT Press, 2016.
[2] Krizhevsky A, Sutskever I, Hinton G E. ImageNet Classification with Deep Convolutional Neural Networks[J]. Communications of the ACM, 2017, 60: 84-90.
Citations automatically appear as [1], [2], and a reference list arranged in citation order is automatically generated at the end of the document—without you writing a single line of formatting.
Why Compile Four Times
With BibTeX added, the complete compilation becomes four steps, forming a pipeline between files.
| Step | Command | Purpose |
|---|---|---|
| 1 | xelatex main | Generate main.aux, recording which keys are cited in the body |
| 2 | bibtex main | Read .aux and refs.bib, generate main.bbl reference list |
| 3 | xelatex main | Insert the .bbl content into the document |
| 4 | xelatex main | Citation numbers stabilize and display correctly |
The reason references show "??" is hidden in this pipeline: BibTeX was not run, or it was run but not followed by two more compilations. Overleaf automatically runs all the steps; locally, latexmk -pdf main.tex is recommended to handle it in one go.
BibLaTeX: A More Modern Choice
BibTeX is an old library from 1985; its successor, biblatex (with the biber backend), is more worth knowing in Chinese contexts.
| Dimension | BibTeX | biblatex + biber |
|---|---|---|
| Birth time | 1985 | From 2009 |
| Unicode / Chinese | Limited support | Native UTF-8 |
| Style customization | Requires writing .bst files, high threshold | LaTeX syntax, intuitive |
| Chinese national standard | Requires configuration, cumbersome | biblatex-gb7714-2015 package directly supports it |
| Usage suggestion | Use with old templates or when journals specify | Prefer for new projects and Chinese theses |
Example: Basic biblatex Usage
\usepackage[backend=biber, style=numeric]{biblatex} % backend specifies biber
\addbibresource{refs.bib} % Note: include the .bib extension
\begin{document}
The breakthrough in deep learning originated from AlexNet~\cite{alexnet2012}.
\printbibliography[title=References] % Print bibliography at the end of the document
\end{document}
The breakthrough in deep learning originated from AlexNet[1].
References
[1] Krizhevsky A, Sutskever I, Hinton G E. ImageNet Classification with Deep Convolutional Neural Networks[J]. Communications of the ACM, 2017, 60: 84-90.
The command changes from bibtex to biber; the rest of the compilation pipeline is identical. When writing a Chinese graduation thesis, install the biblatex-gb7714-2015 package and change the style to gb7714-2015 to meet the national standard bibliographic format.
Summary
| Need | Command |
|---|---|
| Tag | \label{prefix:name} (immediately after the referenced object) |
| Reference number / page / formula | \ref, \pageref, \eqref |
| Hyperlinks | hyperref (load last) |
| Cite literature | \cite{key}, literature stored in .bib database |
| Generate reference list | BibTeX: \bibliography; biblatex: \printbibliography |
| One-click compilation | latexmk -pdf main.tex |