PyX — Example: text/marker.py
Using markers
from pyx import * unit.set(xscale=3) c = canvas.canvas() t = c.text(0, 0, r"Here\PyXMarker{id} is a marker.") center = t.marker("id") c.stroke(path.circle(center[0], center[1], 1), [color.rgb.red]) c.stroke(path.line(center[0]-1, center[1], center[0]+1, center[1]), [color.rgb.red]) c.stroke(path.line(center[0], center[1]-1, center[0], center[1]+1), [color.rgb.red]) c.writeEPSfile("marker") c.writePDFfile("marker") c.writeSVGfile("marker")
Description
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.