typo
[PyX/mjg.git] / manual / tex2.py
blob0c7019e4ec5b79c7f2dd8d98f4a66f8068157718
1 #!/usr/bin/env python
2 import sys
3 sys.path[:0] = [".."]
4 from pyx import *
6 c = canvas.canvas()
7 t = c.insert(tex.tex())
8 t.text(0, 0, "Hello, world!")
9 t.text(0, -0.5, "Hello, world!", tex.fontsize.large)
10 t.text(0, -1.5,
11 r"\sum_{n=1}^{\infty} {1\over{n^2}} = {{\pi^2}\over 6}",
12 tex.style.math)
14 c.stroke(path.line(5, -0.5, 9, -0.5))
15 c.stroke(path.line(5, -1, 9, -1))
16 c.stroke(path.line(5, -1.5, 9, -1.5))
17 c.stroke(path.line(7, -1.5, 7, 0))
18 t.text(7, -0.5, "left aligned") # default is tex.halign.left
19 t.text(7, -1, "center aligned", tex.halign.center)
20 t.text(7, -1.5, "right aligned", tex.halign.right)
22 c.stroke(path.line(0, -4, 2, -4))
23 c.stroke(path.line(0, -2.5, 0, -5.5))
24 c.stroke(path.line(2, -2.5, 2, -5.5))
25 t.text(0, -4,
26 "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",
27 tex.valign.top(2))
28 c.stroke(path.line(2.5, -4, 4.5, -4))
29 c.stroke(path.line(2.5, -2.5, 2.5, -5.5))
30 c.stroke(path.line(4.5, -2.5, 4.5, -5.5))
31 t.text(2.5, -4,
32 "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 tex.valign.bottom(2))
35 c.stroke(path.line(5, -4, 9, -4))
36 c.stroke(path.line(7, -5.5, 7, -2.5))
37 t.text(7, -4, "horizontal")
38 t.text(7, -4, "vertical", tex.direction.vertical)
39 t.text(7, -4, "rvertical", tex.direction.rvertical)
40 t.text(7, -4, "upsidedown", tex.direction.upsidedown)
41 t.text(7.5, -3.5, "45", tex.direction(45))
42 t.text(6.5, -3.5, "135", tex.direction(135))
43 t.text(6.5, -4.5, "225", tex.direction(225))
44 t.text(7.5, -4.5, "315", tex.direction(315))
46 t.text(0, -6, "red", color.rgb.red)
47 t.text(3, -6, "green", color.rgb.green)
48 t.text(6, -6, "blue", color.rgb.blue)
49 c.writetofile("tex2")