I'm able to create a path with the edge with
p1=TikZCoordinate(0,0)
p2=TikZCoordinate(2,3)
mypath=TikZPathList()
mypath.append(p1)
mypath.append('--')
mypath.append(p2)
tikz_code=TikZDraw(mypath)
tikz_code.dumps_as_content()
fig=TikZ()
fig.append(tikz_code)
print(fig.dumps_as_content())
which produce
\begin{tikzpicture}%
\path[draw] (0.0,0.0) -- (2.0,3.0);%
\end{tikzpicture}
but I cannot add a node on the edge
mypath.append('node[midway,above] {$a$}')
is an invalid coordinate string (accepting only '--' etc.)
Creating a TikzNode
doesn't work either.
Any suggestion?
I would like to achieve
\begin{tikzpicture}%
\path[draw] (1.0,4.0) -- node[midway,above] {$a$} ++(4.0,-2.0);%
\end{tikzpicture}%
but I can't find a way to add the node[midway,above] {$a$}
in my path.