答案1
钛钾Z解决方案:
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[align=center,fill=black,circle] (o) at (0,0) {\color{yellow}P:10\\\color{blue!50}N:10};
\draw (0,0) circle (1.25cm) circle (2cm);
\path[fill=red,draw=black] (90:1.25) circle (1.5mm);
\path[fill=red,draw=black] (-90:1.25) circle (1.5mm);
\path[fill=red,draw=black] (85:2) circle (1.5mm);
\path[fill=red,draw=black] (95:2) circle (1.5mm);
\path[fill=red,draw=black] (-85:2) circle (1.5mm);
\path[fill=red,draw=black] (-95:2) circle (1.5mm);
\path[fill=red,draw=black] (5:2) circle (1.5mm);
\path[fill=red,draw=black] (-5:2) circle (1.5mm);
\path[fill=red,draw=black] (175:2) circle (1.5mm);
\path[fill=red,draw=black] (-175:2) circle (1.5mm);
\end{tikzpicture}
\end{document}
编辑1
我们只需定义一个新命令。我可以使用\newcommand
但我更喜欢,\def
因为我可以以 Ti 的形式使用该命令钾Z 命令:
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\def\pairelec[fill=#1,draw=#2,radius=#3] (#4:#5); {
\path[fill=#1,draw=#2] ({#4-5}:#5) circle (#3);
\path[fill=#1,draw=#2] ({#4+5}:#5) circle (#3);
}
\node[align=center,fill=black,circle] (o) at (0,0) {\color{yellow}P:10\\\color{blue!50}N:10};
\draw (0,0) circle (1.25cm) circle (2cm);
\path[fill=red,draw=black] (90:1.25) circle (1.5mm);
\path[fill=red,draw=black] (-90:1.25) circle (1.5mm);
\pairelec[fill=red,draw=black,radius=1.5mm] (0:2);
% Remember fill -> draw -> radius - you must have all three options!
\pairelec[fill=green,draw=blue,radius=1.5mm] (180:2);
\pairelec[fill=white,draw=red,radius=1.5mm] (90:2);
\pairelec[fill=yellow,draw=blue,radius=1.5mm] (-90:2);
\end{tikzpicture}
\end{document}
您可以选择fill
颜色以及draw
颜色和半径。
编辑2
代碼真实的电子对:
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\def\pairelec[fill=#1,draw=#2,radius=#3] (#4:#5); {
\path[name path=cir] (0,0) circle (#5cm);
\path[name path=smallcir] (#4:#5) circle (#3);
\path[name intersections={of=cir and smallcir},fill=#1,draw=#2] (intersection-1) circle (#3) (intersection-2) circle (#3);
}
\node[align=center,fill=black,circle] (o) at (0,0) {\color{yellow}P:10\\\color{blue!50}N:10};
\draw (0,0) circle (1.25cm) circle (2cm);
\path[fill=red,draw=black] (90:1.25) circle (1.5mm);
\path[fill=red,draw=black] (-90:1.25) circle (1.5mm);
\pairelec[fill=red,draw=black,radius=1.5mm] (-8:2);
% Remember fill -> draw -> radius - you must have all three options!
\pairelec[fill=green,draw=blue,radius=3mm] (150:2.5);
\pairelec[fill=white,draw=red,radius=1mm] (78:3);
\pairelec[fill=yellow,draw=blue,radius=1.5mm] (-111:3.5);
\end{tikzpicture}
\end{document}
您可能会看到电子脱离了轨道。这仅用于测试目的!