38

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.

1

2 Answers 2

45

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.

7
  • 3
    The OP wants a clickable link. So the hyperref package is required in addition. Commented Mar 30, 2011 at 17:19
  • @Martin Scharrer: you are right, I'll add the hyperref package to my answer. Commented Mar 30, 2011 at 17:26
  • @Gonzalo Medina thanks so much. how i can change the color of hyper-linked equation from red to green?
    – user4549
    Commented Mar 30, 2011 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 Commented Mar 30, 2011 at 18:02
  • There's a small typo in your answer : you type \eqre{key} instead of \eqref{key} Commented Mar 30, 2011 at 18:18
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.

2
  • Does this work also for a beamer presentation with slides?
    – Alessandro
    Commented Apr 30, 2019 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. Commented Apr 30, 2019 at 21:46

You must log in to answer this question.