I want to create source blocks (in any language including LaTeX), then refer to these in the text using internal links, with descriptions as shown below. This similar post is not working for me.
I have easily been able to created many source blocks using the common structure, for example:
#+BEGIN_SRC python
for i in 1:10:
print i
#+END_SRC
Then I added names to the blocks because I want to talk about them with internal links. Id did this by adding #+NAME:
, and so have this:
#+NAME: some-source-code
#+BEGIN_SRC python
for i in 1:10:
print i
#+END_SRC
So the text block is somewhere within an org file (the same one in my case) and I want to insert a link to that code block above using C-c C-l
. I have tried this with and without a description, so ending up with both:
[[some-source-code][my description]]
and
[[some-source-code]]
but neither are recognised in the exported PDF file. I simply get a pair of question marks in the PDF file and in the *Org PDF LaTeX output buffer*
there is just a message stating:
Hyper reference some-source-code on page 6 undefined on input line 182.
Within the org-file itself, the links are shown and if I click on them I am taken to the code block as expected.
In the babel documentation for such source blocks there was an unfinished-looking sentence regarding the (which I assume to mean the name I provde for a source block), saying:
The name can be 20 characters long, and contain…XXX
Are there actually rules regarding the #+NAME: <label>
?
Should I be including a specific #+LaTeX_HEADER in the org-file??
I am able to create links to websites using C-c C-l
, with a description - and this is exported as expected to PDF.
I have org-version 8.2.10, emacs version 24.5.