4 text
.preamble(r
"\usepackage{exscale}")
14 def label(x
, y
, width
, t
): # x == -1 -> left; x == 1 -> right
15 c
.stroke(path
.line(width
*(0.5*x
+0.5) + x
*arrowdist
, y
,
16 width
*(0.5*x
+0.5) + x
*(arrowdist
+ arrowlen
), y
),
18 c
.text(width
*(0.5*x
+0.5) + x
*(arrowdist
+ arrowlen
+ textdist
), y
,
19 t
, [text
.vshift
.mathaxis
, text
.boxhalign(0.5-0.5*x
)])
22 t
= c
.text(0, 0, r
"\noindent spam \& eggs", [text
.parbox(2.7), text
.size
.Huge
])
23 t2
= text
.text(0, 0, "eggs", [text
.size
.Huge
])
25 c
.stroke(t
.bbox().path(), [style
.linewidth
.THin
])
26 c
.stroke(path
.line(0, 0, 2.7, 0) +
27 path
.line(0, t2
.depth
-t
.depth
, 2.7, t2
.depth
-t
.depth
),
28 [style
.linestyle
.dashed
, style
.linewidth
.THin
])
30 label(-1, t
.height
, spameggswidth
, "valign.top")
31 label(-1, 0.5*(t
.height
-t
.depth
), spameggswidth
, "valign.middle")
32 label(-1, -t
.depth
, spameggswidth
, "valign.bottom")
33 label(1, 0, spameggswidth
, "parbox.top")
34 label(1, 0.5*(t2
.depth
-t
.depth
), spameggswidth
, "parbox.middle")
35 label(1, t2
.depth
-t
.depth
, spameggswidth
, "parbox.bottom")
38 mathstr
= r
"\sum_{i=0}^{\infty}\frac{1}{i^2}=\frac{1}{6}\pi^2"
40 t
= c
.text(0, mathypos
, mathstr
, [text
.mathmode
, text
.vshift
.mathaxis
, text
.size
.LARGE
])
41 t2
= text
.text(0, mathypos
, mathstr
, [text
.mathmode
, text
.size
.LARGE
])
43 c
.stroke(t
.bbox().path(), [style
.linewidth
.THin
])
44 c
.stroke(path
.line(0, mathypos
, t
.width
, mathypos
)+
45 path
.line(0, mathypos
+t
.height
-t2
.height
, t
.width
, mathypos
+t
.height
-t2
.height
),
46 [style
.linestyle
.dashed
, style
.linewidth
.THin
])
48 label(-1, mathypos
, t
.width
, "vshift.mathaxis")
49 label(1, mathypos
+t
.height
-t2
.height
, t
.width
, "baseline")
51 c
.writeEPSfile("valign")