In my org file I have something like:
#+NAME: fig:figure
\begin{figure}
\includegraphics{figure}
\end{figure}
and then I want to reference that figure inside a code block:
#+BEGIN_SRC r
# code ...
x <- 3
# more code for fig. [[fig:figure]]
plot(1:x)
#+END_SRC
[[fig:figure]] is not a link in the org document and does not get resolved when exported, it simply stays verbatim in the text. Is it somehow possible to make it reference the figure?