KWLib has a mechanism to print structured string.
To write fractional, the program code looks like below:
s="";
KPIC_BEGIN(s,"FRC");
s<<"x";
KPIC_SEP(s);
s<<"y";
KPIC_END(s);
s<<"xyzText";
PrintEx(kdc,KPoint(x,y),s,kpi);
To write complicated fractional, the program code is like:
s="a";
KPIC_BEGIN(s,"FRC");
KPIC_BEGIN(s,"FRC");
s<<"a";
KPIC_SEP(s);
s<<"b";
KPIC_END(s);
KPIC_SEP(s);
s<<"a+";
KPIC_BEGIN(s,"FRC");
s<<"x";
KPIC_SEP(s);
s<<"y";
KPIC_END(s);
KPIC_END(s);
s<<"b";
PrintEx(kdc,KPoint(x,y),s,kpi);
Other samples