5 # apply global TeX setting
6 text
.preamble(r
"\parindent=0pt")
7 w
= 1.2 # an appropriate parbox width
9 # vertical alignments by margins
10 c
.stroke(path
.line(0, 4, 6, 4), [style
.linewidth
.THin
])
11 c
.text(0, 4, r
"spam \& eggs", [text
.parbox(w
), text
.valign
.top
])
12 c
.text(2, 4, r
"spam \& eggs", [text
.parbox(w
), text
.valign
.middle
])
13 c
.text(4, 4, r
"spam \& eggs", [text
.parbox(w
), text
.valign
.bottom
])
15 # vertical alignments by baselines
16 c
.stroke(path
.line(0, 2, 6, 2), [style
.linewidth
.THin
])
17 c
.text(0, 2, r
"spam \& eggs", [text
.parbox(w
, baseline
=text
.parbox
.top
)])
18 c
.text(2, 2, r
"spam \& eggs", [text
.parbox(w
, baseline
=text
.parbox
.middle
)])
19 c
.text(4, 2, r
"spam \& eggs", [text
.parbox(w
, baseline
=text
.parbox
.bottom
)])
22 c
.stroke(path
.line(0, 0, 8, 0), [style
.linewidth
.THin
])
23 c
.text(0, 0, r
"x=0", [text
.mathmode
, text
.vshift
.topzero
])
24 c
.text(2, 0, r
"x=0", [text
.mathmode
, text
.vshift
.middlezero
])
25 c
.text(4, 0, r
"x=0", [text
.mathmode
, text
.vshift
.bottomzero
])
26 c
.text(6, 0, r
"x=0", [text
.mathmode
, text
.vshift
.mathaxis
])
28 c
.writeEPSfile("valign")