Linking to other sections of text

Is there a way to create some sort of bookmark code in one location (of a Bible module) and then refer to it in other footnotes, so that ptxprint would automatically find that bookmark and do something based on where it is? Since this would be in a module, we’d like to insert the original bookmark manually and not rely on chapter:verse referencing.

The first request would be to have footnotes which could fill in data themselves at the point when ptxprint runs, so that they would say something like “see the text on lines X-Y on page ZZ”, where the X-Y and ZZ aren’t numbers we know beforehand (and which could change from printrun to printrun).

Secondly, if the above is possible can we also create linking in pdfs so that it will jump a person to that page automatically?

I believe that a mechanism for this already exists using \zlabel, \zpage, \zref milestones (for cross-referencing page numbers). I’m not sure if we have any way to make those clickable links yet.

More details are available here in this document on Github.

USFM includes links and anchors. Linking Attributes — Unified Standard Format Markers 3.0.0 documentation
These have been mostly implemented.

  • \jmp |link-id="target"\jmp* will provide a jump target in the PDF file.
  • \w text|link-href="#target"\w* jump to a target.
  • \w text| link-href="REV 20:14"\w* should jump to a verse, assuming it exists in the document.
  • \w text|link-href="https://website.com"\w* should work as long as your PDF view allows off-document links.
  • \w text|link-href="prj:RSV52 GEN 1:1"\w* has not been implemented. How is it supposed to work outside Paratext?

Thanks. The \zlabel and \zpage markers do exactly what I needed for page numbers. I’m assuming that having a similar anchor and reference to a line number isn’t currently enabled. I’m wondering if in xetex that’s theoretically possible (in which case I’ll write up a feature request), or if line numbering isn’t even possible.

I’ll test out the pdf linking later.

In case anyone reads such an old post, TeX has no idea where page breaks will be when it is arranging text into a paragraph, so unless you’re talking about lines into the paragraph, no, there’s no easy way to get line numbers.

If you know that your paragraph is crossing a page boundary, then the potential way to get line numbers would involve dropping the right sort of position-marking \write onto the page in the right place, which writes to the .parlocs file. At the end of the job, find the difference between that and the previous start of the page/column and dividing that number by the size of the baseline.
The maths, however, gets complicated by anything like a section-header, figure or change in line spacing, and of course it is based on the previous run, so the result might be wrong.

This is basically a more complicated version of how the offset cutouts for figures get calculated, (they only need to worry about the count into the paragraph) and the result there is … normally correct but not always.

Regarding the links, I don’t know if the above or the documentation is clear: the attributes don’t need to be attached to \w or any other particular character style, ptxt2pdf makes links based on the name of the attribute, not the marker the attribute is attached to.