Given the following example org-document:
* For Loops
This is a for loop in Python:
#+name: lst:src-ref
#+caption: This is an example for loop.
#+begin_src python
for i in range(0, 10):
print(i)
#+end_src
- References
Remember the for-loop example\nbsp{}[[lst:src-ref]].
The link lst:src-ref
is never actually (properly) set, at least for exports to
HTML and LaTeX (PDF). The only workaround I've found so far is to use the
double-bracket link <<lst:src-ref>>
above the source block, but that will
refer to the section, not the block itself.
What is the correct way to create internal links to source blocks such that they can be referenced in at least HTML and LaTeX export?
Notice that this is similar to this question, however, the answers are seemingly out of date, or just not working in many cases, hence a complete (and current) answer would be appreciated.
org-ref
to make it converge with the genericorg-cite
framework and I see he has an answer based on org-ref in the duplicate question. Also I tested Melioratus's answer with current Org mode and bleeding-edge Emacs and it all works for me (with some limitations) but there is no mention of HTML in that answer. – NickD Feb 01 '23 at 18:05org-cite
support internal references though? I can only find documentation regarding external references so far – Xaldew Feb 03 '23 at 10:28