3

I have found multiple explanations of how to position two nodes at a certain angel, such as How can you position a node relatively to another in TikZ.

My question now is:

How can position the second node relative to the first such that both touch without knowing their sizes a priori?

As this is inside a macro, I really do not know the size of the nodes a priori. Following the example in the above link, I would like

\node (A) at (2,4) {<content1>};
\node (B) at ($ (A) + (60:???) $) {<content2>};

to make the two nodes A and B touch at a 60° angle without knowing what content1 and content2 is.

1 Answer 1

5

Position B at A.60, and set anchor=240?

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\node [circle,draw,outer sep=0pt] (A) {foo bar baz};
\node [circle,draw,anchor=240,outer sep=0pt] (B) at (A.60)  {foobaz};
\end{tikzpicture}
\end{document}

enter image description here

1
  • @ChristianStump No, 240 = 60 + 180. You The anchor of the B node, should be on the opposite side of the circle compared to the position on the A node. Apr 19, 2017 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .