PyX — Example: text/

0.4 KB
6.8 KB
22.2 KB
12.3 KB

Using markers

from pyx import *

c = canvas.canvas()
t = c.text(0, 0, r"Here\PyXMarker{id} is a marker.")
center = t.marker("id")
c.stroke([0], center[1], 1), [])
c.stroke(path.line(center[0]-1, center[1], center[0]+1, center[1]), [])
c.stroke(path.line(center[0], center[1]-1, center[0], center[1]+1), [])


The example shows how to obtain specific coordinates in a (La)TeX text. This allows to mark specific portions of text, setting arrows, braces and many more. A marker can be set with the command \PyXMarker which takes the name of the marker as an argument (id in the example code). The position of the marker can then be obtained from the textbox, which is returned by the canvas.text method.