7

We are all familiar with MetaPost labels:

label.top(btex $a_t$ etex, z0);

The problem with the above is that the positioning is based on the entire label, including the subscript.

How do I calculate the positioning based on the baseline of the text, i.e. only the "a" part, and not the "t" subscript?

1 Answers1

3

Smash the box:

label.top(btex \setbox0=\hbox{$a_t$}\dp0=0pt \box0 etex, z0);

However this will ignore the depth when computing the bounding box, so you may have to add something to it if the label is near the bottom of the image.

egreg
  • 1,121,712