0

I have been using TeX for almost 10 years, but only very recently decided to learn more about what TeX really does under the hood. This is because I want to display LaTeX-rendered text and mathematics in a visualisation tool that I am writing in C++. I plan to remotely invoke LuaTex from my code and then read in the rendered text as images. However, in order to have fine-grain control over the animation of individual words (and maybe even characters), I need to extract the spatial metadata (reference point location, height, depth, width, horizontal/vertical glue width, etc.) of the hierarchy of \hboxs and \vboxs so that I can manipulate individual boxes as per the use-case requirements.

I read the first half of The TeX Book recently, and have now been reading through a number of Overleaf articles on the inner workings of TeX. This one in particular mentions how Lua can extract the metadata and create a node graph of the hierarchy of \hboxs and \vboxs from the \hlists and \vlist. So this seems like a viable option to write a recursive Lua script to extract the necessary metadata (although I'm yet to figure out how to write a Lua script that does so, so any recommendations on open-source parser scripts would be much appreciated). The other option, based on a recommendation in my previous post, is to extract the data directly from the .dvi file.

Can anyone advise me on which of the above options is a more tractable solution for my use case? Also, any resources for learning more about the recommended solution would be much appreciated!

niran90
  • 204

0 Answers0