jlaurens / synctex

Synchronization for TeX
MIT License
64 stars 19 forks source link

Page number boxes incorrectly correlated to contents on the next page #47

Open ma-chengyuan opened 2 years ago

ma-chengyuan commented 2 years ago

I am writing a program where I use synctex to determine where a piece of LaTeX code end up in the PDF. During testing I noticed that the handling of page number boxes seem to be incorrect. As I understand it, synctex determines the source location of a box by looking at TeX's the internal buffer location when that box is created. Given that the page breaker and the output routines are invoked after TeX starts looking at items on the next page, the problem seems to be expected. Nevertheless, I would like to know if there's anyway internally to distinguish these boxes created by the page breaker from those actually created by the source file -- perhaps by looking at the type of the nodes?

jlaurens commented 2 years ago

With standard TeX we cannot distinguish between nodes of the same kind. With LuaTeX we do have far more control but it may not be that easy. In particular, SyncTeX has been reimplemented and partly exposed to the user, but it may not be as promising for the moment. I would really like LuaTeX to allow extensions to SyncTeX but it is not actually on top of the list due to the problems LuaTeX developers are facing.