2

I have this diagram from my previous question but I can not add one more circle into each of these circles. Is there any suggestion?

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}

\begin{document}

\begin{tikzpicture}[
    shorten < =  1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
state/.append style = {draw=pink!30!black, fill=pink!30, minimum size=8mm},
sx+/.style = {xshift=1 mm},
sy+/.style = {yshift=1 mm},
sx-/.style = {xshift=-1 mm},
sy-/.style = {yshift=-1 mm},
                    ]
\node[state] (A) {A};
\node[state] (B) [right=of A] {B};

\path[->]   ([sy+] A.east)  edge [] ([sy+] B.west)

            ([sy-] B.west)  edge []  ([sy-] A.east);
\end{tikzpicture}
\end{document}

More precisely I need each circle change in to

\begin{tikzpicture}[
 shorten < =  1mm, shorten > = 1mm,
node distance = 22mm, on grid, auto,
every path/.style = {-Latex},
]
\coordinate (O) at (0,0);
\begin{scope}[xshift=0cm,scale=1]
\coordinate (0) at (0,0);
\draw[fill=blue!40] (O) circle (1.80);
\draw[fill=pink!70] (O) circle (1.00);

\end{scope}    
\end{tikzpicture}

With "A" and "B" into each of them.

tarl
  • 147
  • 1
    What is the aim of putting another circle into an existing circle? Do you want to mark the state as a final/accepting one? Then add accepting to the node options. – gernot Nov 12 '16 at 11:16
  • 1
    Please explain in more detail what you want to achieve. I really have no clue what you mean by adding one more circle into each of these circles. Do you want to have a double circle as border? If you can't describe it verbally, add a picture of a manual drawing. – gernot Nov 12 '16 at 11:24

1 Answers1

2

Implementation using a double line:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}

\begin{document}

\begin{tikzpicture}[
    shorten < =  1mm, shorten > = 1mm,
    node distance = 22mm, on grid, auto,
    every path/.style = {-Latex},
    state/.append style = {
      % draw=pink!30!black,
      double=blue!40!white,
      double distance=3pt,
      fill=pink!30,
      minimum size=8mm,
    },
    sx+/.style = {xshift=1 mm},
    sy+/.style = {yshift=1 mm},
    sx-/.style = {xshift=-1 mm},
    sy-/.style = {yshift=-1 mm},
]
\node[state] (A) {A};
\node[state] (B) [right=of A] {B};

\path[->]   ([sy+] A.east)  edge [] ([sy+] B.west)

            ([sy-] B.west)  edge []  ([sy-] A.east);
\end{tikzpicture}
\end{document}

Result

With small (node font=\small) text with math in the circles:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}

\begin{document}

\begin{tikzpicture}[
    shorten < =  1mm, shorten > = 1mm,
    node distance = 22mm, on grid, auto,
    every path/.style = {-Latex},
    state/.append style = {
      % draw=pink!30!black,
      double=blue!40!white,
      double distance=3pt,
      fill=pink!30,
      minimum size=8mm,
      node font=\small,
    },
    sx+/.style = {xshift=1 mm},
    sy+/.style = {yshift=1 mm},
    sx-/.style = {xshift=-1 mm},
    sy-/.style = {yshift=-1 mm},
]
\node[state] (A) {Set $A$};
\node[state] (B) [right=of A] {Set $B$};

\path[->]   ([sy+] A.east)  edge [] ([sy+] B.west)

            ([sy-] B.west)  edge []  ([sy-] A.east);
\end{tikzpicture}
\end{document}

Result

With writing into the blue parts

IMHO, this is quite ugly, the same is the code for the implementation of the feature.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, calc, positioning, quotes}

\begin{document}

\begin{tikzpicture}[
    shorten < =  1mm, shorten > = 1mm,
    node distance = 22mm, on grid, auto,
    every path/.style = {-Latex},
    state/.append style = {
      % draw=pink!30!black,
      % double=blue!40!white,
      % double distance=3pt,
      % fill=pink!30,
      minimum size=8mm,
      node font=\small,
    },
    sx+/.style = {xshift=1 mm},
    sy+/.style = {yshift=1 mm},
    sx-/.style = {xshift=-1 mm},
    sy-/.style = {yshift=-1 mm},
]

\newcommand*{\StateNode}[3][]{%
  % Draw blue circle in the final size
  \node[state, fill=blue!40!white, #1] (#2) {\phantom{#3}};
  % Draw smaller pink circle
  \node[state, fill=pink!30, inner sep=-5pt] at (#2) {\phantom{#3}};
  % Put the text on top
  \node at (#2) {#3};
}
\StateNode{A}{Set $A$}
\StateNode[right=of A]{B}{Set $B$}

\path[->]   ([sy+] A.east)  edge [] ([sy+] B.west)

            ([sy-] B.west)  edge []  ([sy-] A.east);
\end{tikzpicture}
\end{document}

Result

Heiko Oberdiek
  • 271,626
  • But is there any way that I put A small math text into the blue parts? Suppose that the texts are are '' Set C" and '' Set B'' – tarl Nov 12 '16 at 12:02
  • Thanks but I had written in the "BLUE" parts. – tarl Nov 12 '16 at 14:21
  • @tarl Writing into the blue parts would look quite ugly IMHO. – Heiko Oberdiek Nov 12 '16 at 14:28
  • How about at the above of them, I found from somewhere that something like %\draw[decoration={text along path,reverse path,text align={align=center},text={\tiny ()}},decorate] (0.5,0) arc (0:180:0.5); works. But I do not know how to change the above number – tarl Nov 12 '16 at 14:31