This is similar to Org export to latex and HTML references, but for equations.

I like to use LaTeX math snippets in my org-files, as in

* The Quadratic Equation
The roots of $ax^2 + bx + c$ are given by
x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}

According to Equation \ref{eq:1}, ...

When I export to LaTeX, the \ref{eq:1} correctly turns into a hyper link to the equation. But I want to achieve the following additional behavior:

  1. Inside the org file, I can click the text \ref{eq:1} (the text doesn't have to be \ref{eq:1}, I just want a hyperlink) and be taken to to the equation. This functionality is present for headers, as in [[The Quadratic Equation]] becomes clickable in Org mode.

  2. When I export to HTML, I want to the references to be kept (actually, the label (1) doesn't even show up in HTML export).

Is there a way to accomplish this?

  • Technically... wrapping the equation into #+begin_src latex ... #+end_src and then, if you place #+name: eq:1 and #+label: eq:1, you should be able to reference this block the way you want, i.e. using a link [[eq:1][first equation]], but for some reason it doesn't work for me (but it could be due to the changes I've made).
    – wvxvw
    Commented Aug 21, 2015 at 9:27
  • @wvxvw If you changed the behaviour through advices only you can test without changes via emacs -Q. Naturally, this does not help if you changed the sources directly.
    – Tobias
    Commented Aug 21, 2015 at 12:39
  • @Tobias nah, I remember patching Org code, specifically something related to it inserting \label{} into verbatim environment, but I'd need to dig up my changes to make sure it's my fault. It would help me though, if someone could confirm that the suggested way with #+name etc works.
    – wvxvw
    Commented Aug 21, 2015 at 13:13
  • @wvxvw At html-export I get <pre>/</pre>-Tags around the equation environment. Therefore, firefox shows the source and not the equation.
    – Tobias
    Commented Aug 21, 2015 at 13:26
  • @Tobias, right, I completely forgot about it, you'd also need the by-backend macro from here: orgmode.org/worg/org-contrib/babel/languages/…
    – wvxvw
    Commented Aug 21, 2015 at 13:38

3 Answers 3


I had to run some test, but I managed to run a small file that exports correctly to both latex and HTML, I tested only in org 8.2.10, but it should work on other versions.

The answer is actually the same as in Org export to latex and HTML references

Here I have a small example

*  This is a latex experiment
so with the text...
#+NAME: code:1
#+BEGIN_SRC shell-script
echo hello world 
[[code:1]] is a reference to src block

#+NAME: eqn:1
    f(x) =  \sum\limits_0^\infty(f^{(n)}(x)|_{x=0} \cdot x)

And this is an equation [[eqn:1]]
  • Nice, this works for me out of the box.
    – Tobias
    Commented Aug 22, 2015 at 8:37
  • 1
    This works for me too in LaTeX, but it doesn't work for "out of the box" in HTML, since the equation doesn't even have a number (some Mathjax option isn't being set, probably). Now if only RefTeX would support this, but that's another question. I will wait a couple more days before accepting, to see if anyone else will chime in :)
    – Kevin
    Commented Aug 23, 2015 at 5:56
  • I accepted, but see my own answer below (later version of Org has support out of the box).
    – Kevin
    Commented Aug 25, 2015 at 0:23
  • 2
    Can this somehow be extended to multi-line AMS environments like align and subequations, where the label is specific to parts of the equation?
    – kdb
    Commented Jun 6, 2018 at 10:18
  • 1
    Does not work for me and I am at Org version 9.4.6 :-(
    – Ajned
    Commented Jun 20, 2021 at 11:42

Actually, it seems that Org mode 8.3.1 has built-in support for what the question is asking; label and ref work out of the box.

This requires one to update Org mode through the package manager; afterwards, stick (package-initialize) near the top of the initialization file.

EDIT. This does not allow you to click the \ref{...} and go to the label. For that, please see the accepted answer above, or use org-ref.

  • 1
    But you don't get to click on \ref{.} to go to \label{.}, right?
    – rvf0068
    Commented Sep 2, 2015 at 23:45
  • 1
    No I cannot. For that, you have to use either Joafigue's answer above or see my comment above regarding github.com/jkitchin/org-ref. I will edit my answer to reflect that.
    – Kevin
    Commented Sep 3, 2015 at 2:01

As is described in Internal links.

You can use <<id>> to set your target id and use [[id]] or [[id][description]](You can use C-c C-l to insert this) to find your target.

This works for me while exporting to HTML.

  • But does it work with LaTeX equations? Commented Oct 5, 2021 at 12:50
  • 1
    This is an alternative solution. You can put <<id>> before equation.
    – Ynjxsjmh
    Commented Oct 6, 2021 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.