30

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.

38

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.

  • 2
    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? – user4549 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: 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
7

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.

  • Does this work also for a beamer presentation with slides? – Alessandro Apr 30 at 16:46
  • 1
    @Alessandro -- I'm sorry, I don't know whether it works for beamer, and am unable to experiment now. But I think it's worth a try. – barbara beeton Apr 30 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy