Is it possible to export the preview-ref funcitonality to pdfs?
Previews in pdfs
I do not know if the possibility of such an export is coded in TeXmacs; if not, I think that it will take some work to add to the exported pdf file the previews of link targets on hovering over links.
I’m not sure how to implement this in the PDF. Do you have some example of this feature from other softwares?
I don’t have examples of conversion, but I do have examples of elements which appear on hovering in pdf documents:
The website itextpdf.com is the commercial website of a software for conversion to pdf, I have seen there is also the AGPLv3 free license, but I do not understand the details.
Where I can find that document?
I don’t know, it’s a screenshot I plucked off the net because I’m not at the computer. I was trying to say that the Evince viewer does this automatically for any link in PDFs, independent of the document.
Hello,
You may consider using the really wonderful (open source) cross-platform PDF viewer “Sioyek” (https://sioyek.info/). It supports inline previews of internal links in PDF documents (does a much better job than Evince).
The usual previews offered by the preview-ref package work in the exported PDF in the above viewer. In addition, I have created the following macro titled \kwd, basically the standard \equation-lab macro to create arbitrary references.

The following few frames hopefully illustrate how I use the above.
Kind regards,
Murali
Dear @murali,
Thanks for posting this — the animated preview looked great, so I tried adapting the \kwd macro from your screenshot into my own document (TeXmacs 2.1.5). I ran into a persistent issue and wanted to check whether it’s a version difference or something else in your setup.
The macro I transcribed:
<assign|kwd-color|dark cyan>
<assign|kwd|<macro|lab|body|<surround|<with|font-series|bold|color|<kwd-color>|<lab>>|<label|<lab>>|<datoms|<macro|x|<x>>|<body>>>>>>
No matter how I simplify it, any call to <label|...> where the operand is derived from a macro argument (e.g. <label|<lab>> , or even <label|prefix-<lab>> ) throws:
<error|bad set binding>
A hand-typed literal string like <label|test-123> works fine on its own — it’s specifically label combined with a macro-argument-substituted value that fails, consistently, across every variant I tried (with/without surround , with , color , datoms , with or without a literal prefix).
Two questions:
- What TeXmacs version was the animated GIF made with? I’m wondering if
label's handling of macro-argument content changed at some point. - Does your setup rely on any personal init file, style package, or redefinition of
label(or something shadowing it) that isn’t visible in the screenshot?
For now I’m going to sidestep the issue by implementing the label-generation in Scheme (via tm-define ) instead of pure style-sheet primitives, so I can force the argument through tree->string explicitly before it reaches label . But I’d still love to know what’s different on your end, in case it’s a genuine regression worth reporting.
Thanks again for sharing the original idea — really like the preview-on-hover effect and would like to get it working.
Cheers, Tilda
I copy-pasted your macros and the pasted macros do not correspond to what @murali wrote.
Please try
<assign|kwd-color|dark cyan>\
<assign|kwd|<macro|lab|body|<surround|<with|font-series|bold|color|<kwd-color>|<arg|lab>>|<set-binding|<arg|lab>>|<datoms|<macro|x|<arg|x>>|<arg|body>>>>>
Dear Giovanni, your code
fixed the issue
. Thanks for that.
Cheers, Tilda
Hi Tilda,
Yes, Thanks to Giovanni (@pireddag), that does work. I am using 2.14 – have not moved yet to 2.15.
Kind regards,
Murali

