When reading a LaTeX document on an iPad with iTeX, I need to know the position of every word on the page. (I also need to know the positions of images, URLs, footnotes, etc., but they are all manageable by adding \special- s to the appropriate macros.) This could be used for searching, dictionary lookups, etc.
What I would love to do is insert a \special with some attribute before each word. This would need some automatic per-word processing, because I want it for the whole document, and damn the expense! A new program, dvigrid, would emit lines needed containing the word's rectangle and other, specifiable information.
It needs to be a general solution, something that can live with the popular document classes.
A related need is the word ordinal in the output. This would be a new answer to the old word-count question (which use external programs), except here TeX could count the words.
There are examples of commands that do this for every word in a parameter, like putting the words in a box. But none seem appropriate for doing an entire document this way. I can't find an appropriate hook or hack, even deep inside the double danger parts of TeX.
Does anyone have a suggestion? Can this even be done without modifying TeX?
Bill Cheswick email@example.com