Given the following code:

\setbox0=\hbox{hello \fbox{other [.] text} world.}

I can use zref-savepos to determine the location of the dot inside the box:

\setbox0=\hbox{\zsavepos{leftmostpoint}hello \fbox{other [.\zsavepos{dotpoint}] text} world.}


  • It requires the box to be shipped out
  • It needs another compilation pass

Question: is there a way to compute the location of the dot in the box, without shipout?

I know that there is \wd, \ht and \dp for boxes, but nothing more.

Motivation: I want to be able to implement something similar to tikzmark for Asymptote (How can I make arrow from parts of a formula in Asymptote? (or: measure the width of a label, get anchor around a label)). For that, Asymptote uses a bidirectional pipe to measure the width, height and depth of the boxes, but I also want custom anchor inside the box.

  • I cannot answer, but am interested in replies. Might make a difference if you use lualatex? Also might make a difference if the box does not contain anything that might flow to the next page.
    – rallg
    Jan 29 at 17:25
  • Possible resource: tex.stackexchange.com/questions/642642/…. (\predisplaysize can be abused to interesting effect, but if the boxes are nested then it's not useful.)
    – user202729
    Feb 2 at 9:02


You must log in to answer this question.

Browse other questions tagged .