Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support headlabel and taillabel under tikzedgelabels #76

Open
bharath-ravindranath opened this issue Dec 26, 2019 · 0 comments
Open

support headlabel and taillabel under tikzedgelabels #76

bharath-ravindranath opened this issue Dec 26, 2019 · 0 comments

Comments

@bharath-ravindranath
Copy link

As documented in https://dot2tex.readthedocs.io/en/latest/customization_guide.html#customizing-edges

The headlabel and taillabel attributes are currently not affected by the tikzedgelabels option.

Can this support be added? While creating network diagrams, I am trying to add both ends of the interface as head/tail label. The Graphviz does not support rotating any label. But dot2tex can support this (and fairly easily)

Possible Solution:

Currently the generated Latex file will have the following if lblstyle='above, sloped' is configured in dot Graph file.

  \draw [] (53.916bp,143.83bp) .. controls (48.5bp,133.0bp) and (41.644bp,119.29bp)  .. (36.207bp,108.41bp);
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \draw (44.195bp,136.83bp) node[above, sloped] {Et2};
  \draw (26.486bp,115.41bp) node[above, sloped] {Et1};

based on the co-ordinates used to draw the line i.e (53.916bp,143.83bp) and (36.207bp,108.41bp), we can calculate the angle of the line using: math.degrees(math.atan2((53.916,143.83),(36.207,108.41)) using this angle, we can update the above Latex to include the angle (rotate=<degrees calculated>):

  \draw [] (53.916bp,143.83bp) .. controls (48.5bp,133.0bp) and (41.644bp,119.29bp)  .. (36.207bp,108.41bp);
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \draw (44.195bp,136.83bp) node[rotate=63.43] {Et2};
  \draw (26.486bp,115.41bp) node[rotate=63.43] {Et1};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant