TikZ¶
- Author
 Marcel Simader
- Date
 30.06.2021
New in version v0.1.0.
Point¶
- class Point(x, y, *, unit='', relative=False)¶
 Pointrepresented a 2 dimensional coordinate of form \((x, y)\). The class additionally holds information on the unit used for both of the values. Various arithmetic operations upon two points are supported, but only if they share the same unit.To perform the vector dot product on two points, use the “matrix-mul” operator
@.- Parameters
 x (_N0) – the x-coordinate
y (_N1) – the y-coordinate
unit (AnyStr) – keyword-only argument, denotes the unit to suffix at the end of the
Pointinstance, is automatically converted to all lower case, for instancePoint(3, 4, unit="CM")will produce the output( 3.000cm, 4.000cm)relative (bool) – whether or not this coordinate should be considered relative in the used path or not
- POINT_TEMPLATE: ClassVar[str] = '{}({: .7f}{unit}, {: .7f}{unit})'¶
 The format string to use when formatting a coordinate to a string.
- property x: SEPTeX.TikZ._N0¶
 - Returns
 the x coordinate
- property y: SEPTeX.TikZ._N1¶
 - Returns
 the y coordinate
- property angle: float¶
 - Returns
 the angle of this coordinate in polar coordinates in degrees
- property radius: float¶
 - Returns
 the radius of this coordinate in polar coordinates
- property coordinate: Tuple[SEPTeX.TikZ._N0, SEPTeX.TikZ._N1]¶
 - Returns
 the tuple \((x, y)\)
- property polar_coordinate: Tuple[float, float]¶
 - Returns
 the tuple \((\theta, r)\)
- property point: SEPTeX.TikZ.Point[SEPTeX.TikZ._N0, SEPTeX.TikZ._N1]¶
 - Returns
 self
- property unit: AnyStr¶
 - Returns
 the all lower-case unit suffix
- property relative: bool¶
 - Returns
 whether or not this coordinate is relative
- as_int()¶
 - Returns
 a new coordinate \((\text{int}(x), \text{int}(y))\)
- Return type
 SEPTeX.TikZ.Point[int, int]
- as_float()¶
 - Returns
 a new coordinate \((\text{float}(x), \text{float}(y))\)
- Return type
 SEPTeX.TikZ.Point[float, float]
- geometric_length()¶
 - Returns
 the geometric length of this coordinate to the origin \(\vec 0\)
- Return type
 float
- to_tikz()¶
 Converts this object to a TikZ string.
PolarPoint¶
- class PolarPoint(angle, radius, *, unit='', relative=False)¶
 PolarPointrepresents a coordinate in polar coordinates. It slightly modifies the functionality ofPointbut has largely the same methods.- Parameters
 angle (_N0) – the angle component in degrees
radius (_N1) – the radial component
unit (AnyStr) – keyword-only argument, denotes the unit to suffix at the end of the
Pointinstance, is automatically converted to all lower case, for instancePolarPoint(314, 4, unit="CM")will produce the output( 314.000: 4.000cm)relative (bool) – whether or not this coordinate should be considered relative in the used path or not
- POINT_TEMPLATE: ClassVar[str] = '{}({: .7f}:{: .7f}{unit})'¶
 The format string to use when formatting a coordinate to a string.
- property x: float¶
 - Returns
 the x coordinate
- property y: float¶
 - Returns
 the y coordinate
- property angle: SEPTeX.TikZ._N0¶
 - Returns
 the angle of this coordinate in polar coordinates in degrees
- property radius: SEPTeX.TikZ._N1¶
 - Returns
 the radius of this coordinate in polar coordinates
- as_int()¶
 - Returns
 a new coordinate \((\text{int}(\text{angle}), \text{int}(\text{radius}))\)
- Return type
 SEPTeX.TikZ.PolarPoint[int, int]
- as_float()¶
 - Returns
 a new coordinate \((\text{float}(\text{angle}), \text{float}(\text{radius}))\)
- Return type
 SEPTeX.TikZ.PolarPoint[float, float]
- to_tikz()¶
 Converts this object to a TikZ string.
RelPoint¶
- class RelPoint(x, y, *, unit='')¶
 RelPointis an alias ofPointwith therelativeoption set toTrueby default.- Parameters
 x (_N0) – the x-coordinate
y (_N1) – the y-coordinate
unit (AnyStr) – keyword-only argument, denotes the unit to suffix at the end of the
Pointinstance, is automatically converted to all lower case, for instancePoint(3, 4, unit="CM")will produce the output( 3.000cm, 4.000cm)
See also
Pointfor more details.
TikZNode¶
- class TikZNode(coordinate=Point(x=0, y=0, relative=False), name='', label='', relative_to=None, style=TikZStyle(draw=True))¶
 TikZNoderepresents a standard TikZ node. It holds information about its coordinate, name, label and style. A node must first be registered with aTikZPictureinstance by writing it, which happens implicitly if not stated explicitly.- Parameters
 coordinate (Point[_N0, _N1]) – the coordinate at which this node should be placed
name (AnyStr) – the name which will be used to reference this node
label (AnyStr) – the label which will be displayed on the document for this node
relative_to (Optional[TikZNode]) – the node to consider
coordinateto be relative to, orNonestyle (TikZStyle) – the style to apply to this node
- property raw_coordinate: SEPTeX.TikZ.Point[SEPTeX.TikZ._N0, SEPTeX.TikZ._N1]¶
 - Returns
 the raw coordinate of this node, this does not include the offset caused by a relative node
- property coordinate: SEPTeX.TikZ.Point¶
 - Returns
 the true coordinate of this node, with the offset caused by the relative node
- property label: str¶
 - Returns
 the label of this node
- property relative_to: Optional[SEPTeX.TikZ.TikZNode]¶
 - Returns
 the node which this node’s position is considered relative to, or
None
- property style: SEPTeX.TikZBase.TikZStyle¶
 - Returns
 the style used by this node
- property raw_name: str¶
 - Returns
 the name of this node without the parentheses
- property name: str¶
 - Returns
 the name of this node, including parentheses
- property definition: str¶
 - Returns
 the definition string of this object
TikZLabel¶
- class TikZLabel(label='', style=TikZStyle(draw=False))¶
 TikZLabelrepresents a TikZ label. These labels can be put onTikZNodeobjects, or be used as labels for edges inTikZPathobjects.- Parameters
 label (AnyStr) – the label text of this label
style (TikZStyle) – the style of this label,
drawis set toFalseby default
- property label: AnyStr¶
 - Returns
 the label text of this label
- property style: SEPTeX.TikZBase.TikZStyle¶
 - Returns
 the style of this label
- to_tikz()¶
 Converts this object to a TikZ string.
TikZPath¶
- class TikZPath(coordinates, cycle=False, style=TikZStyle(draw=True))¶
 TikZPathrepresents a collection ofPoint,TikZNode, andTikZLabelobjects drawn using the\drawcommand of TikZ.- Parameters
 
- static find_node_relations(coordinates, arrow_type)¶
 Finds the relations between objects passed in through the
coordinatesargument. It essentially returns a tuple of tuples indicating whichTikZNodeobjects “point” to which other nodes. For instance, if in a path noden0points visually ton1, then the output of this function will be((n0, n1),).- Parameters
 coordinates (Sequence[Union[SEPTeX.TikZ.Point, SEPTeX.TikZ.TikZNode, SEPTeX.TikZ.TikZLabel]]) – a collection of
Point,TikZNode, orTikZLabelobjects for the patharrow_type (SEPTeX.TikZBase._TikZArrow) – the arrow type to consider when evaluating the node relations
- Returns
 a tuple of tuples containing the relations between the nodes passed in through the
coordinatesargument- Return type
 Tuple[Tuple[SEPTeX.TikZ.TikZNode, SEPTeX.TikZ.TikZNode], …]
- property arrow_type: Literal[TikZArrow(key='-')]¶
 - Returns
 the arrow type of a regular path is always
TikZArrow.LINE
- property coordinates_string: str¶
 Converts all of the coordinates of this instance to a string. If there are no coordinates then the empty string is returned.
- property coordinates: Tuple[Union[SEPTeX.TikZ.Point, SEPTeX.TikZ.TikZNode, SEPTeX.TikZ.TikZLabel]]¶
 - Returns
 the points, nodes, and labels along this path
- property cycle: bool¶
 - Returns
 whether or not to join the end of this path to its beginning
- property style: SEPTeX.TikZBase.TikZStyle¶
 - Returns
 the style used by this path for its edge
- property node_relations: Tuple[Tuple[SEPTeX.TikZ.TikZNode, SEPTeX.TikZ.TikZNode], ...]¶
 - Returns
 the node relations of this path, as described by
find_node_relations()
- to_tikz()¶
 Converts this object to a TikZ string.
TikZDirectedPath¶
- class TikZDirectedPath(coordinates, cycle=False, style=TikZStyle(draw=True), arrow_type=TikZArrow(key='-'))¶
 TikZDirectedPathrepresents a path similarly toTikZPathbut with additional information on the arrow type used to join up the coordinates.This class implicitly uses the
arrowsTikZ library.- Parameters
 coordinates (Sequence[Union[Point, TikZNode, TikZLabel]]) – a collection of
PointorTikZNodeobjects for the pathcycle (bool) – whether or not to end the final path string with
cycle, which will join the ending to the beginningstyle (TikZStyle) – the style to apply to this path
arrow_type (_TikZArrow) – the
_TikZArrowto use for the arrow tip of the edge
- property arrow_type: SEPTeX.TikZBase._TikZArrow¶
 - Returns
 which arrow head type is used by this path
- to_tikz()¶
 Converts this object to a TikZ string.
TikZCircle¶
- class TikZCircle(coordinate, radius, style=TikZStyle(draw=True))¶
 TikZCirclerepresents a standard TikZ circle, with a center coordinate, radius and style.- Parameters
 
- property coordinate: SEPTeX.TikZ.Point[SEPTeX.TikZ._N0, SEPTeX.TikZ._N1]¶
 - Returns
 the center coordinate of this circle
- property radius: TikZValue¶
 - Returns
 the radius of this circle
- property style: SEPTeX.TikZBase.TikZStyle¶
 - Returns
 the style used by this circle
- to_tikz()¶
 Converts this object to a TikZ string.