Skip to main content

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.

CommandOutputTypical Use
\label{key}No output; tags the preceding objectImmediately 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 numberSee page~\pageref{sec:method}

\label must 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 \label to the next paragraph, it will refer to the wrong object. Formula \label must 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.

L=i=1n(yiy^i)2(1)L = \sum_{i=1}^n \left( y_i - \hat{y}_i \right)^2 \tag{1}

2 Experimental Results

The loss of the method (Section 1) is measured by Eq. (1), and the curve shape is shown in Figure 1.

Sine curve

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.

PrefixObjectExample
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}

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/

hyperref should 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 TypeCorresponding LiteratureKey Fields
@articleJournal articleauthor, title, journal, year
@inproceedingsConference paperauthor, title, booktitle, year
@bookBookauthor/editor, title, publisher, year
@phdthesisPhD thesisauthor, title, school, year
@misc / @onlineWebpage, 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.

StepCommandPurpose
1xelatex mainGenerate main.aux, recording which keys are cited in the body
2bibtex mainRead .aux and refs.bib, generate main.bbl reference list
3xelatex mainInsert the .bbl content into the document
4xelatex mainCitation 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.

DimensionBibTeXbiblatex + biber
Birth time1985From 2009
Unicode / ChineseLimited supportNative UTF-8
Style customizationRequires writing .bst files, high thresholdLaTeX syntax, intuitive
Chinese national standardRequires configuration, cumbersomebiblatex-gb7714-2015 package directly supports it
Usage suggestionUse with old templates or when journals specifyPrefer 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

NeedCommand
Tag\label{prefix:name} (immediately after the referenced object)
Reference number / page / formula\ref, \pageref, \eqref
Hyperlinkshyperref (load last)
Cite literature\cite{key}, literature stored in .bib database
Generate reference listBibTeX: \bibliography; biblatex: \printbibliography
One-click compilationlatexmk -pdf main.tex