CSS

Tuesday, February 21, 2012

Metapost and Labels

This is just a quick note to myself. When I want to write a label with a smaller font, I should use \scriptstyle...but it is tricky since it requires math mode!

So an example, consider this diagram describing an experiment for gravitational redshift:

numeric u;
u = 1pc;
beginfig(0)
  path earth;
  pair clock[];

  earth = fullcircle scaled u;

  clock[0] = (0,2u);
  clock[1] = (0,4u);

  draw (0,0)--(0,5u) dashed evenly;

  for i=0 upto 1:
    label(btex $\bullet$ etex, clock[i]);
  endfor;

  fill earth withcolor 0.75white;
  draw earth;
  label.rt(btex ${\scriptstyle\rm Earth}$ etex, (.5u,0));
  label.rt(btex ${\scriptstyle\rm Satellite\ 1}$ etex, clock[0]);
  label.rt(btex ${\scriptstyle\rm Satellite\ 2}$ etex, clock[1]);
endfig;
end;

Just remember to use "\ " for spaces. Otherwise it will all run together horribly!

No comments:

Post a Comment