7 t
=c
.insert(tex
.latex())
8 t
.text(0, 0, "Hello, world!")
9 print "width:", t
.textwd("Hello, world!")
10 print "height:", t
.textht("Hello, world!")
11 print "depth:", t
.textdp("Hello, world!")
12 t
.text(0, -0.5, "Hello, world!", tex
.fontsize
.large
)
14 r
"\sum_{n=1}^{\infty} {1\over{n^2}} = {{\pi^2}\over 6}",
17 c
.stroke(path
.line(5, -0.5, 9, -0.5))
18 c
.stroke(path
.line(5, -1, 9, -1))
19 c
.stroke(path
.line(5, -1.5, 9, -1.5))
20 c
.stroke(path
.line(7, -1.5, 7, 0))
21 t
.text(7, -0.5, "left aligned") # default is tex.halign.left
22 t
.text(7, -1, "center aligned", tex
.halign
.center
)
23 t
.text(7, -1.5, "right aligned", tex
.halign
.right
)
25 c
.stroke(path
.line(0, -4, 2, -4))
26 c
.stroke(path
.line(0, -2.5, 0, -5.5))
27 c
.stroke(path
.line(2, -2.5, 2, -5.5))
29 "a b c d e f g h i j k l m n o p q r s t u v w x y z",
31 c
.stroke(path
.line(2.5, -4, 4.5, -4))
32 c
.stroke(path
.line(2.5, -2.5, 2.5, -5.5))
33 c
.stroke(path
.line(4.5, -2.5, 4.5, -5.5))
35 "a b c d e f g h i j k l m n o p q r s t u v w x y z",
38 c
.stroke(path
.line(5, -4, 9, -4))
39 c
.stroke(path
.line(7, -5.5, 7, -2.5))
40 t
.text(7, -4, "horizontal")
41 t
.text(7, -4, "vertical", tex
.direction
.vertical
)
42 t
.text(7, -4, "rvertical", tex
.direction
.rvertical
)
43 t
.text(7, -4, "upsidedown", tex
.direction
.upsidedown
)
44 t
.text(7.5, -3.5, "45", tex
.direction(45))
45 t
.text(6.5, -3.5, "135", tex
.direction(135))
46 t
.text(6.5, -4.5, "225", tex
.direction(225))
47 t
.text(7.5, -4.5, "315", tex
.direction(315))
49 t
.text(0, -6, "red", color
.rgb
.red
)
50 t
.text(3, -6, "green", color
.rgb
.green
)
51 t
.text(6, -6, "blue", color
.rgb
.blue
)
53 t
.text(0, -6.5, "example1", tex
.valign
.bottom(0.5))
54 t
.text(4, -6.5, "example2", tex
.valign
.bottom(0.5), tex
.msghandler
.hidebuterror
)
55 c
.writetofile("test_latex", paperformat
="a4")