37

I am wondering how I can link an equation in LaTeX, I mean when I click on the link then I'll be directed to that specific equation.

Stefan Kottwitz
  • 231,401
  • I recommend you to take a look at the book LaTeX on WikiBooks which covers many of these basic questions. The following part fits your needs: http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing – Harold Cavendish Mar 30 '11 at 17:22

2 Answers2

44

You can use the standard \label{key}, \ref{key} (or, if amsmath has been loaded, \eqref{key} to automatically include the parenthesis in the reference) mechanism; \label assigns a "key" (a string of characters and/or digits and/or punctuation) to the element (a sectioning command, one of the environments equation, figure, table, the theorem-like structures, etc.); \ref typesets the "number" associated to the key. There's also \pageref{key} to typeset the number of the page where the \label command was used.

The hyperref package will automatically generate customizable hyperlinks in your document.

A little example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}

\begin{document}

\begin{equation}\label{eq:test}
  a=b
\end{equation}
\eqref{eq:test}

\end{document}

You'll have to compile twice to generate the cross-references.

Gonzalo Medina
  • 505,128
  • 3
    The OP wants a clickable link. So the hyperref package is required in addition. – Martin Scharrer Mar 30 '11 at 17:19
  • @Martin Scharrer: you are right, I'll add the hyperref package to my answer. – Gonzalo Medina Mar 30 '11 at 17:26
  • @Gonzalo Medina thanks so much. how i can change the color of hyper-linked equation from red to green? –  Mar 30 '11 at 17:57
  • @MON: you can use \usepackage{xcolor}\hypersetup{linkbordercolor=green}. The hyperref documentation (follow the link in my answer) explains many other options; here is a summary of the available options: http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/options.pdf – Gonzalo Medina Mar 30 '11 at 18:02
  • There's a small typo in your answer : you type \eqre{key} instead of \eqref{key} – Frédéric Grosshans Mar 30 '11 at 18:18
  • @Frédéric Grosshans: I don't see any typo... ah, now I see it (I looked only at the code). I will correct it; thank you very much. – Gonzalo Medina Mar 30 '11 at 18:20
  • @Gonzalo: Your answer start with :"You can use the standard \label{key}, \ref{key} (or, if amsmath has been loaded, \eqre{key} ..." . Just before the dots, you use eqre{} while you use eqref{} in the code example. – Frédéric Grosshans Mar 30 '11 at 18:26
8

you need to use an environment -- like equation or many of the environments in amsmath -- that can be numbered and take a \label. then using the hyperref package and \ref{label-value} (or, better, amsmath's \eqref) there will be hyperlinks in your pdf output.