3 Code to generate beams for TeX
11 #include "symtable.hh"
16 Lookup::beam_element(int sidx, int widx, Real slope)
18 Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
23 bs.tex = substitute_args(bs.tex,args);
25 Real width = convert_dimen(w,"pt");
26 bs.dim.x = Interval(0,width);
27 bs.dim.y = Interval(0,width*slope);
31 // ugh.. hard wired tex-code.
35 assert(ABS(s) < 0.45);
36 int i = int(rint(s * 20.0));
46 Lookup::rule_symbol(Real height, Real width)
48 Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");
50 args.add(print_dimen(height));
51 args.add(print_dimen(width));
52 bs.tex = substitute_args(bs.tex,args);
53 bs.dim.x = Interval(0,width);
54 bs.dim.y = Interval(0,height);
59 Lookup::beam(Real &slope, Real width)
61 int sidx = slope_index(slope);
63 return rule_symbol(convert_dimen(2,"pt"), width);
66 Real elemwidth = convert_dimen(64,"pt");
71 Real minwid =convert_dimen(2,"pt");
74 while (elemwidth > w) {
79 Atom a(beam_element(sidx, widx, slope));
80 a.translate(Offset(0, dy));
82 dy += elemwidth*slope;
87 Atom a(beam_element(sidx, widx, slope));
88 a.translate(Offset(width -minwid, (width-minwid) * slope));
92 ret.tex = m.TeXstring();
93 ret.dim.y = Interval(0,width*slope);
94 ret.dim.x = Interval(0,width);