I want to produce documents where every paragraph, equation, and other visually distinct part of the document is highlighted with its own background color (e.g. equations are highlighted in blue, tables in red, headers in green, etc.)
To add to the challenge, I want to apply this technique to thousands of pre-existing latex documents; solutions that require complex changes to existing latex may not be practical.
I posed this question as a paragraph coloring question because I suspect that might be an easy way to do what I want. But any method of recovering the bounding boxes associated with each command that produces page content would work. For instance, there may be a way to recover the page locations of content generated from latex commands from the DVI files or the latex log.
My ultimate goal is to create a data set to support research into automated document processing: I want to create algorithms that can parse an image of a page into its structural components without the need for the original mark-up. I require a mapping between latex mark-up and the locations of the resulting content on the page to train and evaluate algorithms.
pdflatex -jobname=myfile \RequirePackage{color}\everydisplay{blue}\input{\jobname}
equations in your file will be highlighted in blue.