jlaurens / synctex

Synchronization for TeX
MIT License
57 stars 19 forks source link

Kern nodes are corrupted in luatex output #82

Open dpantele opened 2 months ago

dpantele commented 2 months ago

When compiling a trivial doc

\documentclass{article}
\begin{document}

a\kern3pt b

\end{document}

we get the following synctex kern nodes in the .synctex file:

x1,4:10110238,8865054
k0,0:8799518,8865054:196608
x1,6:10671226,8865054
g1,5:31409438,8865054

kTAG,LINE:H,V:WIDTH

compare to pdflatex:

x1,4:10670937,8865054
k1,5:31409438,8865054:20738501
g1,5:31409438,8865054

pdflatex seems accurate, but luatex often produces huge numbers as tags and other attributes on longer files, as if there is some memory corruption.

dpantele commented 2 months ago

I guess it is present even in the reference test files: https://github.com/jlaurens/synctex/blob/9bc51bb1824aecef45791b8683ffd44c06cdc37a/synctex%20test%20files/test%20files/luatex/sample.synctex#L174

jlaurens commented 2 months ago

Thanks for reporting.

I will report to the luatex developers in some near future, when enhancements to synctex are ready for the other engines. FYI, it concerns support of math surround space, more accurate line numbers for math nodes and box nodes, and a new \synctexmark feature to retrieve some information from the synctex file.

dpantele commented 2 months ago

Thanks! Another report about the same: https://tex.stackexchange.com/q/709094

New features looks promising.

Would it be feasible to actually enable tracking characters as well? Sycntex format supports that, but that is not implemented in any engine AFAIK. I am happy to open another issue if needed.

jlaurens commented 2 months ago

Tracking characters must be properly defined. There are difficulties when compound characters come into play. Moreover, this leads to heavy calculation/storage.