电子配置

电子配置

我看过一些有关相关电子配置的其他帖子,但没有一个符合我的要求。我想创建以下图像:

在此处输入图片描述

答案1

完成此类事情的众多方法之一。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,intersections,calc}
\begin{document}
\begin{tikzpicture}[font=\sffamily] 
\matrix (mat) [matrix of nodes,column sep=0.2cm,row sep=2mm,
 nodes={align=left},nodes in empty cells,
 row 1/.append style={nodes={font=\footnotesize\sffamily}},
 ]{
 & 1 & 6 & 10 & 14 \\
 & 1s & & & \\
 & 2s & 2p & & \\
 & 3s & 3p & 3d & \\
 & 4s & 4p & 4d & 4f\\
 & 5s & 5p & 5d & 5f\\
 & 6s & 6p & 6d & \\
 & 7s & 7p & 7d & \\
 };
 \path[name path=boundary] (mat-1-1.south) -- (mat-1-3.south)
 to[bend right] (mat-2-4.south) -- ([xshift=15mm]mat-5-5.south)
  -- (mat.south east);
 \foreach \X [remember=\X as \LastX] in {2,...,10}
 {\ifnum\X<8
    \path[overlay,name path=\X-line] (mat-\X-1.south west) coordinate(\X-start) 
    -- ++ ($5*($(mat-2-5.south west)- (mat-6-1.south west)$)$);
  \else
    \pgfmathtruncatemacro{\Xprime}{\X-7}
    \path[overlay,name path=\X-line] 
    ([xshift={-ifthenelse(\X==10,2,1)*1mm}]mat-8-\Xprime.south east) 
    coordinate(\X-start) -- ++ ($5*($(mat-2-5.south west)- (mat-6-1.south west)$)$);
  \fi   
  \draw[blue!50,latex-,shorten <=2pt,name intersections={of=\X-line and boundary,by=i-\X}]
  (\X-start)--(i-\X);
  \ifnum\X>2
   \draw[blue!50,dashed] (i-\X) to[out=160+3*\X,in=5] (\LastX-start);
  \fi
  }
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者使用更引人注目的箭头。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,intersections,calc}
\begin{document}
\begin{tikzpicture}[font=\sffamily] 
\matrix (mat) [matrix of nodes,column sep=0.2cm,row sep=2mm,
 nodes={align=left},nodes in empty cells,
 row 1/.append style={nodes={font=\footnotesize\sffamily}},
 ]{
 & 1 & 6 & 10 & 14 \\
 & 1s & & & \\
 & 2s & 2p & & \\
 & 3s & 3p & 3d & \\
 & 4s & 4p & 4d & 4f\\
 & 5s & 5p & 5d & 5f\\
 & 6s & 6p & 6d & \\
 & 7s & 7p & 7d & \\
 };
 \path[name path=boundary] (mat-1-1.south) -- (mat-1-3.south)
 to[bend right] (mat-2-4.south) to[bend left] ([xshift=6mm]mat-5-5.south)
  -- (mat.south east);
 \foreach \X [remember=\X as \LastX] in {2,...,10}
 {\ifnum\X<8
    \path[overlay,name path=\X-line] 
    ($(mat-\X-2.south west)-0.1*($(mat-2-5.south west)- (mat-6-1.south west)$)$) coordinate(\X-start) 
    -- ++ ($5*($(mat-2-5.south west)- (mat-6-1.south west)$)$);
  \else
    \pgfmathtruncatemacro{\Xprime}{\X-6}
    \path[overlay,name path=\X-line] 
    ($(mat-8-\Xprime.south west)-0.1*($(mat-2-5.south west)- (mat-6-1.south west)$)$) 
    coordinate(\X-start) -- ++ ($5*($(mat-2-5.south west)- (mat-6-1.south west)$)$);
  \fi   
  \draw[blue!50,latex-,shorten <=2pt,name intersections={of=\X-line and boundary,by=i-\X}]
  (\X-start)--(i-\X);
  \ifnum\X>2
   \draw[blue!50,dashed,overlay] 
   let \p1=($(mat-2-5.south west)- (mat-6-1.south west)$),\n1={atan2(\y1,\x1)} in
   (i-\X) to[out=\n1,in=180+\n1] (\LastX-start);
  \fi
  }
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容