12

I produce automatically generated LaTeX-files with nodes and links.

Is it possible to put the label of the node outside of the node and it is automatically positioned somewhere, such that there is no line crossing it?

I know I can position the label by hand:

\node[label= above right: N-1](N-1) at (0.0,2.0){ };

But this it not what I want, since sometimes there could be a line right there.

Does anyone have any idea?

Jake
  • 232,450
Jana
  • 2,254
  • 6
  • 21
  • 32

1 Answers1

7

No, in the general case it's not possible to automatically place a label in a way so that it doesn't overlap anything. TikZ is simply just not smart enough to check for collisions. Programming something like this with TeX would be very complicated for the general case. It might be possible to have something for a very limited case.

If you produce your LaTeX pictures automatically using some script then I would do the collision checks using the scripting language, which is better suited for this. However, even with that it is absolutely not trivial.

Martin Scharrer
  • 262,582