[NTG-pdftex] A naive idea about forward-inverse search (not synctex)

Yih-Dar Shieh chiapas at gmail.com
Tue Jan 10 12:54:50 CET 2012

I used synctex to get the forward-inverse search between tex source and pdf
file. It created a .synctex file which record the coordinate
correspondences between .tex and .pdf. I have the following naive idea:
during compilation, each time we get some "output", we put an "extra
information". This "extra information" should be contents of the output
pdf, which is invisible, and do not affect the layout (using this feature
or not).
For example, it is similar to "hypperef", which has an "extra information"
so we can go to another location on the .pdf. The "extra information" for
this forward-inverse search could be "(line,column)" of the .tex source.
The following example may make this clear:

Tex Source: .....This is an example.

And the output PDF: ...T(1,1)h(1,2)i(1,3)s(1,4) (1,5)i(1,6)s(1,7)
(1,8)a(1,9)n(1,10) (1,11)e(1,12)x(1,13)a(1,14)m(

The (x,y) should be invisible on PDF, and the location should be at the
same location of their corresponding "output letter" and the space it takes
is the size of a single letter. This means that:
(the above example): when we click "T", we get an information (1,1) , just
similar to hyperref. Similarly, when we click "h", we get (1,2). If this is
done, then it is easy to do the inverse search (from pdf to tex), since the
information is on the pdf file. For forward search, it is easy also: when
we click on tex source, of course the editor knows the (line,column), and
it sends this information to pdf viewer and finally the viewer "go to the
location of this (line, column)". (Suppose the viewer could "Find" where is
(line,column), this need to be implemented.)

Of course, the size of the output pdf with this sync option will be large.
But we can do this by using "word" instead of "letter" for text and using
"each symbol" for math formula.

The advantage of this feature (to synctex) is: We get  very precise
locations when we do forward-inverse search. And the implemention should
not be difficult, since it just do "something extra" which are easy: get
the (x,y) on the source--OK ; Produce invisible output--Don't know if this
is possible. Compare to synctex method, we don't have to calculate the
coordinate correspondence between source and output. Also, the time needed
to compile is (about) double at most.

The disadvantage is that the output pdf has large size. Of course, after we
finish the work of typping, and want to publish the .pdf file, we can
compile it without sync option.

Although I say this would be easy, I mean this would be easy for developers
of pdftex. The ability to do this is far beyond my programming ability. I
would like to know from you that if this naive idea is doable. If not, what
are the difficulities? Do you think this is a good idea? And of course, if
we agree this is a good idea, I hope the developers could implement it.

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-pdftex/attachments/20120110/a034238c/attachment.html>

More information about the ntg-pdftex mailing list