0

I would like to draw a circle with white inner circle like below:

enter image description here

Below code can do it but I would like to use one command just like:

\node[mycircle] (A) {};

Current code:

\documentclass{standalone}
\usepackage{tikz}

\begin{document} 
\begin{tikzpicture}
  \node[circle,fill=black,minimum size=2.2cm,inner sep=0] {};
  \draw[white,line width=2] circle[radius=1cm];
\end{tikzpicture}
\end{document}

0

1 Answer 1

1

One can use https://tex.stackexchange.com/a/36858/36296 :

\documentclass[border=4mm] {standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\tikzset{
    old inner xsep/.estore in=\oldinnerxsep,
    old inner ysep/.estore in=\oldinnerysep,
    double circle/.style 2 args={
        circle,
        old inner xsep=\pgfkeysvalueof{/pgf/inner xsep},
        old inner ysep=\pgfkeysvalueof{/pgf/inner ysep},
        /pgf/inner xsep=\oldinnerxsep+#1,
        /pgf/inner ysep=\oldinnerysep+#1,
        alias=sourcenode,
        append after command={
        let     \p1 = (sourcenode.center),
                \p2 = (sourcenode.east),
                \n1 = {\x2-\x1-#1-0.5*\pgflinewidth}
        in
            node [inner sep=0pt, draw, circle, minimum width=2*\n1,at=(\p1),#2,line width=1.5pt] {}
        }
    },
    double circle/.default={3pt}{white}
}


\begin{tikzpicture}
\node (A) [double circle, fill=black,minimum size=2.2cm] {b};
\end{tikzpicture}%
%
\end{document}

enter image description here

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