0

I have a tikz picture with two nodes and bidirectional arrows between them (two separate arrows - one in each direction). I want to enclose these arrows using a ellipse, something as shown in the figure below, and then use an arrow to point to some text. enter image description here I know it can be done using the fit package but since I dont have markers for these arrows, I cant figure out exactly what to do. The existing figure code is shown below:

\begin{tikzpicture}[every node/.style={minimum height={1cm},thin,align=center},>={LaTeX[width=2.5mm]},proc/.style={shape=ellipse, draw},node distance = 1.5cm]
\node[draw] (A) {a};
\node[draw, below= of A] (B) {b};
\draw[->](A) to[bend right] (B);
\draw[->](B) to[bend right] (A);
\end{tikzpicture}

It would be great if someone could guide me to creating this red ellipse around the two arrows! TIA

3
  • Your code doesn't give the result in your image, is that intentional?
    – Alenanno
    Commented Feb 29, 2016 at 14:57
  • Yes, the code will only draw the nodes and the arrows. I want to draw the red ellipse too, but I cant figure out the way.
    – BajajG
    Commented Feb 29, 2016 at 15:56
  • If you load the calc library, the center is at ($(A.south)!.5!(B.north)$) Getting the radii will be trickier. Commented Feb 29, 2016 at 16:07

1 Answer 1

0

Your MWE didnt compile out of the box for me. Also, I changed the minimum size option so that the fitted circle touched the south and north anchors of the nodes A and B. You could instead retain your minimum size option; but increase the distance between node A and B so that the fitted circle is larger than 1cm and hence fits the south and north anchors correctly.

(also, I am using tikz/PGF version 3.0.1)

\documentclass[tikz]{standalone}
\usetikzlibrary{fit,calc}
\begin{document}

\begin{tikzpicture}[
every node/.style={minimum height={0.5cm},
                   thin,align=center},
>=latex,
proc/.style={shape=ellipse, draw},
node distance = 1.5cm]
\node[draw] (A) {a};
\node[draw, below of=A] (B) {b};
\coordinate (C);
\draw[-latex](A.south) to[bend right] (B.north);
\draw[-latex](B.north) to[bend right] (A.south);

\node[red,
      draw,circle,
      outer sep =0pt,
      inner sep=0pt,      
      fit=(A.south) (B.north)] (mycircle){};
\node[right of=mycircle] (mytext) {Text};
\draw [-latex] (mycircle) -- (mytext);
\end{tikzpicture}

\end{document}

fit library

You must log in to answer this question.

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