[metapost] Align boxes

Ryan Van Wagoner whiteviz at gmail.com
Mon Jan 26 15:10:46 CET 2009


>>>>> "luis" == Luis Useche <luis at cs.fiu.edu> writes:

 luis> I am new with metapost and metaobj. I am using metaobj to do my figure and I
 luis> am trying to draw a sequence of boxes horizontally aligned but with the same
 luis> height.

Hi Luis,

Does the following achieve the effect that you want?

input metaobj;

beginfig(1)
  newBox.a(btex a \strut etex);
  newBox.b(btex g \strut etex);
  a.se = b.sw;
  a.c = (0, 0);
  drawObj(a,b);
endfig;

end.

Note that you only need one equation relating the box positions to one
another. Metapost does not like redundant equations, especially if they
are inconsistent. Also, note the \strut which is there to make sure that
both boxes have the same height while still allowing baseline alignment
of the glyphs. Metaobj boxes adapt themselves to the size of their
contents, though there are some boxes that allow you to set width and
height I believe.

Regards,

-- 

Ryan Van Wagoner


More information about the metapost mailing list