On 03/11/2023 13:29, David Masterson wrote:
the generated LaTeX href looks like
\href{contacts.tex}{My text}
which looks wrong.
Search part definitely should be retained.
I have realized that in the LaTeX world inter-document cross-linking
works differently. With the xr-hyper package, labels from another
document may be used directly or with a prefix:
https://texfaq.org/FAQ-extref
It may be implemented for Org random labels.
However I would strongly prefer PDF files having stable anchors based on
CUSTOM_ID, not ones derived from section, figure, etc. counters. I am
unsure if there is a package that allows to get such anchors out of the box.
When I looked into the code for link targets resolution in the context
of ox-html, I found it rather complicated.
I use publish for LaTex (org-latex-publish-to-pdf)
Depending on your requirements, it might be possible to export to HTML
files and then print them to PDF as a workaround. Chromium supports
headless printing, so it should be scriptable. However to improve
quality of formatting almost certainly heavy customization of CSS.
I have realized that Chomium scrolls to proper position in PDF when it
opens a file URI with #anchor part, but it does not update tab address
bar when an internal link is clicked and it does not react when URL is
edited to change #anchor part.