let-def / texpresso

TeXpresso: live rendering and error reporting for LaTeX
MIT License
373 stars 18 forks source link

Clicking on references/links? #35

Open gasche opened 5 months ago

gasche commented 5 months ago

Does the TeXpresso viewer support jumping to the destination of a reference?

(When working on scientific LaTeX documents it is very useful to be able to follow references, and also to have a shortcut to go back to where we where before following it.)

let-def commented 5 months ago

No it doesn't, but it is possible in principle. It is a bit involved so I won't do that anytime soon, but the plan is roughly:

1) Parse PDF annotations. References are communicated as side data using the WTF XML protocol of PDF annotations. These are made available in the DVI file via specials that are ignored at the moment. Interpreting these specials is necessary to render and to find the zones sensitive to clicks.

2) Resolve local references. I am not 100% clear how this will work, but I think it should be modeled roughly on the design of SyncTeX support. Backward references can be handled by scanning the existing part of the document. If the reference is not resolved this way, it is likely a forward reference: keep rendering until resolving the reference or ending the document.

What might complicate this plan is dealing multiple passes, but I think auxiliary files are not needed for hyperref to work (unlike document outlines and page number references, "tying the knot" is mostly done by the document reader not by the TeX engine).

leanhdung1994 commented 2 months ago

My favorite packages cleveref and autonum produce auxiliary files and require multiple passes...