On 22.01.2024 19:59, Ihor Radchenko wrote:
gerard.vermeu...@posteo.net writes:

FR: would it be possible to resolve such links?

What is the purpose? Why not simply leaving the result name same as the
source block?

I have Python "IN" blocks generating Python "OUT" blocks that may end up
on different pages after exporting to LaTeX and PDF.
The FR would allow to link always to the correct page.

Patches welcome.

This patch completes my "Make an org-lint warning more helpful" patch.

I have found that CAPTION keywords  in the "name-result-example" in the
manual are essential to produce correct links.

In case the relevant blocks have e.g. ":exports both", Org handles
this, but:
1. HTML export requires captions to produce links with unequivocal
   "link texts" which are numbers in the HTML output.
2. LaTeX export requires captions to produce captions with labels like
   =\caption{\label{path}desc}=.
Tested on example below:

Produced by listing [[IN]].

#+caption: Results block
#+name: OUT
#+RESULTS: IN
#+begin_src emacs-lisp :exports code
6
#+end_src

#+caption: Source block
#+header: :wrap "src emacs-lisp :exports code"
#+name: IN
#+begin_src emacs-lisp :exports both
6
#+end_src

Listing [[IN]] produces listing [[OUT]].

From inspecting HTML or LaTeX output using this example
for the difference between with and without captions it is
easy to see that only with captions the output is correct.

The patch tries to add this information to the manual.

Regards -- Gerard

Attachment: 0001-doc-org-manual-Add-CAPTION-keywords-to-named-results.patch
Description: Binary data

Reply via email to