0

I want to align a black circle at the center of another bigger white circle (it must be look like to Activity Final Node of UML).

The most straightforward is to simply explicitly place the bigger circle nodes at certain coordinates and calculate the coordinates of black one by hand; but it is not possible to use that way for difficult graphics without wasting time.

I could do some thing like this:

\begin{tikzpicture}
  \node (close){Close};
  %defining "end process" node:
  \node [circle, below =of close, text width=2em, fill=none, draw=black] (stop-outer){};
  \node [circle, below =1.2 of close, text width=1em, fill=black] (stop-inner){};
  %end of defining "end process" node
  \draw [->] (close) -- (stop-outer);
\end{tikzpicture}

But also it has its disadvantages, for example I have to care in about text width of bigger circle and change the numerical part of below =1.2 of close to get best result.

Is there a way to do that without need to calculating by hands?

3

you have more possibilities:

  • define common anchor for circles and use different circle radius (if correct understand, you not liked this solution)
  • first draw inner circle and around it fit outer:

 \documentclass[tikz,margin=3mm]{standalone}

\usetikzlibrary{fit, positioning}

\begin{document}
\begin{tikzpicture}
  \node (close){Close};
  %defining "end process" node:
  \node [circle, draw, 
         fill=black, text width=1em, 
         below = of close] (stop) {};
  \node [circle, draw, inner sep =0.2em,
         fit = (stop) ] (stop-outer) {};
  %end of defining "end process" node
  \draw [->] (close) -- (stop-outer);
\end{tikzpicture}
\end{document}
  • use option double for draw one circle:

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{fit, positioning}

\begin{document}
\begin{tikzpicture}
  \node (close){Close};
  \node [circle, draw, double, double distance=0.2em,
         fill=black, text width=1em, outer sep=0.1em,
         below = of close] (stop) {};
 \draw [->] (close) -- (stop);
\end{tikzpicture}
\end{document}

in both later cases the result is the same:

enter image description here

2

Using positionning center and anchor :

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
  \node (close){Close};
  % defining "end process" node:
  \node [circle, below =of close, text width=2em, fill=none, draw=black] (stop-outer){};
  \node [circle, below=0mm of stop-outer.center, anchor=center, text width=1em, fill=black] (stop-inner){};
  % end of defining "end process" node
  \draw [->] (close) -- (stop-outer);
\end{tikzpicture}
\end{document}

enter image description here

1
  • Or just: \node [circle, text width=1em, fill=black] at (stop-outer) (stop-inner) {}; – Ignasi Sep 4 '17 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.