I'm making a macro to generate a tikzpicture
depending on the arguments passed into the macro. I want to be able to draw a \node
only if it won't intersect with a specified x coordinate.
So say my blacklisted x coordinate is 1 and I want to place my node at (0.8, 0)
. The node will have some width depending on the text I put inside it, so it has a chance of intersecting with my x coordinate of 1 (that text is from the macro's arguments, so I won't have one static width I can use each time). I want to be able to control whether the node will be placed depending on if its width will pass over x=1 (if it does, I don't want it to be placed).
My thought was to place an invisible version of the node, get its x coordinate, and place the visible version if it doesn't exceed 1. I just don't know how to actually do that: get the x coordinate (both the left and right sides of the node), and use it as a condition for whether to place a second node.
Is this possible, maybe with some sort of library I'm not aware of? Thanks in advance.