Suppose I typeset some text using an environment that places it in a box with a width that I specify. (I don't really care if this is a minipage, tabular, or something else.) I want to write the coordinates of the box to a file. (I will probably use xetex, because this involves Greek text, and that seems too painful in the other tex implementations I've tried.) In pdftex and its extensions such as xetex, I can use \pdfsavepos
at the beginning and end of the text, and use write18 to write the coordinates. But I think this won't really give me the coordinates of the upper-left and lower-right coordinates of the box. I imagine it will record the positions of a point on the baseline (?) just before the first character and just after the last character.
Is there a way to output the actual coordinates of the box, or do I have to somehow estimate this by doing arithmetic based on the width of the box, the ascender and descender height of the font, and possibly the box/environment's margins? If I have to do the arithmetic muself, is there some convenient, automated way to find out the relevant font dimensions for whatever font is being typeset?
\foo
you have available \ht\foo \dp\foo and \wd\foo, you do not need any font information.\foo
". Normally boxes are anonymous data structures, aren't they? Are these things like \ht, \dp, and \wd documented somewhere? Do they tell me the box's position on the page, or only its dimensions? Getting a precise position (what you call a reference point) on the page is one of the things I'm I'm asking about.\newbox
(\newsavebox` in latex). I'll post an answer. "reference point" is the tex terminoligy in the texbook (and sources) not mine.