summaryrefslogtreecommitdiff
path: root/Master/texmf/asymptote/labelpath.asy
blob: 39c1908efd3897ad1f28dfac23eb94b8c7a2581d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
usepackage("pstricks");
usepackage("pst-text");

string LeftJustified="l";
string RightJustified="r";
string Centered="c";

void labelpath(frame f, Label L, path g, string justify=Centered,
               pen p=currentpen)
{
  if(latex() && !pdf()) {
    _labelpath(f,L.s,L.size,g,justify,(L.T.x,L.T.y+0.5linewidth(p)),p);
    return;
  }
  warning("labelpathlatex","labelpath requires -tex latex");
}

void labelpath(picture pic=currentpicture, Label L, path g,
               string justify=Centered, pen p=currentpen)
{
  pic.add(new void(frame f, transform t) {
      labelpath(f,L,t*g,justify,p);
    });
  frame f;
  label(f,Label(L.s,L.size));
  real w=size(f).y+L.T.y+0.5linewidth(p);
  pic.addBox(min(g),max(g),-w,w);
}