# References and cross references

## Labels and cross references

Creating cross references in a LaTeX document is fairly simple. All standard elements of the document like section, figure, table, equation, can be given logical names, so called labels. Suppose that you decided to give a label "My_introduction" for the section "Introduction":

\section{Introduction}\label{My_introduction}


Later in your text you can refer to that section using the command \ref. Referring to equations, tables, and figures is done in an identical way.

... as it has been suggested in Section \ref{My_introduction} the average number of...


LaTeX will automatically number all the sections and replaces \ref command with an appropriate number of the referenced section. You can also refer by page number if you replace the \ref command with \pageref:

... we have shown on page \pageref{My_introduction} ...


Some people like to classify their labels by prefixing the label names with a few letters that describe what kind of target they are referring to. For example, equations could be given labels like eq:kinetic_energy, sections sec:introduction, and figures fig:white_noise. These prefixes have no special meaning to LaTeX. They are only a notational aid for the writer.

When you are giving labels to sections, figures, etc., it's better to give a descriptive name, like fig:simulated_noise_spectrum and sec:noise_analysis instead of fig:figure1 and sec:first_section. Numbers are not good because you may decide to change the order of your sections or figures and then the label names become misleading and confusing.

When referring to, for example, figures you can prohibit LaTeX from breaking the line between the word "Fig." and the number if you glue them together by using ~ instead of a normal space:

... as shown in Fig.~\ref{fig:simulation_results} ...


You can find further examples of references in the LaTeX source of this example. For more thorough explanations please refer to A (Not So) Short Introduction to LaTeX and Online tutorials for LaTeX.

## Bibliographical references

Handling of citation references and bibliography is one of the most powerful features of LaTeX and its companion program BibTeX. They take care of linking citations in your text to bibliography references (such as books or journal articles) and automatic updating of them. In addition, they provide a way to store your bibliography data in a personal database, which helps you to make a literature review in an organized way. The database is reusable so that you can collect all your references you have ever needed. Thus they are not lost and you can find them easily the next time you need them. When you use your database while writing a document, BibTeX picks only those references that you need in your current document.

The bibliography database is a simple text file called for example My_references.bib. You don't need to edit it manually. Instead, there are many free programs that can help you maintain this database. Our personal favorite is called JabRef. Among many nice features it allows you to import the references from such scientific search engines as IEEE Xplore or ISI, so it saves you from a lot of boring typing. You can browse through your references, sort them, store a PDF with the article, and so on.

How does it work with LaTeX? Each database entry has own logical name, for instance Einstein_PhD_work_1905. If you want to refer to this work just type in your LaTeX document:

... it has been shown in the classic study \cite{Einstein_PhD_work_1905} that...


When you compile the document, the \cite command prints a label that refers to the desired entry in your bibliography. And when you want to print the list of referenced bibliographic sources (probably near the end of your document), you write the following commands in your LaTeX document:

\bibliographystyle{unsrt}
\bibliography{My_references}


Now the entire reference is taken from the database, nicely formatted and appended to the end of your document. Here we assume your database file is named My_references.bib.

The \bibliographystyle command defines how you would like the bibliography to look like. LaTeX allows you to choose a bibliography style independently of the document style. Additionally, the bibliography database is not affected by the chosen style, so you don't need to modify your database when you must use different styles in your document.

There are many bibliography styles available but in technical reports the most often used is unsrt. It prints numeric labels ([1], [2], [3], ...) and sorts the bibliography using the order of citation. Another one is IEEE's widely used style IEEEtran. If you are using IEEE's abbreviated journal names in your database, you should change the aforementioned lines like this:

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,My_references}


Some publications and books may require "author + year" style labels in citations, like "(Einstein, 1905)". For this kind of styles use the natbib package.

For more help on creating a bibliography refer to chapter 15 "Bibliographic Databases" of the Online tutorials for LaTeX. More thorough documentation is included with the BibTeX distribution.