9 t
.define(r
"\def\sayhello{Hello}")
10 t
.text(0, 0, r
"\sayhello, world!")
11 print "width:", t
.textwd("Hello, world!")
12 print "height:", t
.textht("Hello, world!")
13 print "depth:", t
.textdp("Hello, world!")
14 t
.text(0, -0.5, "Hello, world!", tex
.fontsize
.large
)
16 r
"\sum_{n=1}^{\infty} {1\over{n^2}} = {{\pi^2}\over 6}",
19 c
.stroke(path
.line(5, -0.5, 9, -0.5))
20 c
.stroke(path
.line(5, -1, 9, -1))
21 c
.stroke(path
.line(5, -1.5, 9, -1.5))
22 c
.stroke(path
.line(7, -1.5, 7, 0))
23 t
.text(7, -0.5, "left aligned") # default is tex.halign.left
24 t
.text(7, -1, "center aligned", tex
.halign
.center
)
25 t
.text(7, -1.5, "right aligned", tex
.halign
.right
)
27 c
.stroke(path
.line(0, -4, 2, -4))
28 c
.stroke(path
.line(0, -2.5, 0, -5.5))
29 c
.stroke(path
.line(2, -2.5, 2, -5.5))
31 "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",
33 c
.stroke(path
.line(2.5, -4, 4.5, -4))
34 c
.stroke(path
.line(2.5, -2.5, 2.5, -5.5))
35 c
.stroke(path
.line(4.5, -2.5, 4.5, -5.5))
37 "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",
40 c
.stroke(path
.line(5, -4, 9, -4))
41 c
.stroke(path
.line(7, -5.5, 7, -2.5))
42 t
.text(7, -4, "horizontal")
43 t
.text(7, -4, "vertical", tex
.direction
.vertical
)
44 t
.text(7, -4, "rvertical", tex
.direction
.rvertical
)
45 t
.text(7, -4, "upsidedown", tex
.direction
.upsidedown
)
46 t
.text(7.5, -3.5, "45", tex
.direction(45))
47 t
.text(6.5, -3.5, "135", tex
.direction(135))
48 t
.text(6.5, -4.5, "225", tex
.direction(225))
49 t
.text(7.5, -4.5, "315", tex
.direction(315))
51 t
.text(0, -6, "red", color
.rgb
.red
)
52 t
.text(3, -6, "green", color
.rgb
.green
)
53 t
.text(6, -6, "blue", color
.rgb
.blue
)
55 t
.text(0, -6.5, "example1", tex
.valign
.bottom(0.5))
56 t
.text(4, -6.5, "example2", tex
.valign
.bottom(0.5), tex
.msghandler
.hidebuterror
)
57 c
.writetofile("test_tex", paperformat
="a4")