您能建议一种绘制这些原子的简单方法吗?
\documentclass{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{shadings}
\usetikzlibrary{decorations.markings}
\definecolor{myyellow}{RGB}{254,241,24}
\definecolor{myorange}{RGB}{234,125,1}
\begin{document}
\begin{tikzpicture}
\def\proton(#1,#2){%
\fill[shade=ball,ball color=myyellow] (#1,#2) circle (10pt);
\node at (#1,#2) {\texttt{+}};
}
\def\neutron(#1,#2){%
\fill[shade=ball,ball color=myorange] (#1,#2) circle (10pt);
}
\def\electron{%
\fill[shade=ball,ball color=gray!30] (0,0) circle (5pt);
\node at (0,0) {\texttt{-}};
}
\def\sorbit(#1,#2){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (1.5 and 3.5);
}
\def\porbit(#1,#2){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (4 and 6);
}
%%Nucleons
\neutron(0.8,0.2)
\proton(0.5,-0.5)
\neutron(-0.25,-0.5)
\neutron(0.55,0.8)
\proton(-0.5,0.2)
\proton(-0.1,0.8)
\proton(0.5,0)
\proton(0.12,0.6)
\proton(0.12,-0.6)
\neutron(-0.25,0)
\neutron(-0.5,0.6)
\neutron(0.5,-0.3)
%%orbits
\porbit(-20,.15)
\porbit(15,.45)
\sorbit(40,.9)
\porbit(65,.6)
\sorbit(100,.3)
\porbit(125,.75)
\end{tikzpicture}
\end{document}
答案1
答案在 TeX 中绘制带有电子壳层的玻尔原子模型?有一些示例可以作为起点。那里的一些示例代码在最近的 TeX 发行版上无法编译。您必须在几行中替换shade=ball
为shading=ball
。我猜这是因为 TikZ 语法随着时间的推移而发生了变化。