Table of Contents
TexLive References
Cross-references link to sections, figures, tables, and equations using \label and \ref. Place \label{key} after a section heading, caption, or equation, then use \ref{key} or \eqref{key} (for equations) to insert its number.
\section{Introduction} \label{sec:intro} In Section \ref{sec:intro}, we... \begin{equation} E = mc^2 \label{eq:einstein} \end{equation} From equation \eqref{eq:einstein}, we derived...
Compile twice for references to resolve: first pass creates .aux file with labels, second pass reads it and inserts numbers. Always use ~ (tilde) to prevent line breaks: Section~\ref{sec:intro} not Section \ref{sec:intro}.
Citations reference sources in a bibliography. LaTeX uses BibTeX: create a .bib file with bibliography entries, then cite them with \cite{key}:
\documentclass{article} \usepackage{natbib} \begin{document} As shown in \cite{einstein1905}, relativity... \bibliographystyle{plain} \bibliography{references} \end{document}
The .bib file (references.bib) contains entries:
@article{einstein1905, author = {Einstein, Albert}, title = {On the Electrodynamics of Moving Bodies}, journal = {Annalen der Physik}, year = {1905} } @book{knuth1984, author = {Knuth, Donald E.}, title = {The TeXbook}, publisher = {Addison-Wesley}, year = {1984} }
\bibliographystyle{plain} sets citation format (plain, apalike, natbib, etc.). \bibliography{references} includes the .bib file (omit .bib extension).
To generate the bibliography, compile with: pdflatex main.tex && bibtex main && pdflatex main.tex && pdflatex main.tex. The bibtex command generates the formatted bibliography from the .bib file. Two final pdflatex runs resolve references.
Citation styles: \cite{key} produces a number [1] or author-year depending on the bibliographystyle. \citet{key} (textual) produces “Author (Year)”; \citep{key} (parenthetical) produces “(Author Year)”. Requires natbib package.
URL citations: Use @misc entries for websites:
@misc{wikipedia2024, author = {Wikipedia}, title = {Article Title}, url = {https://...}, year = {2024} }
Hyperref integration: With \usepackage{hyperref}, citations become clickable links to the bibliography.
