期望
我想用 LaTeX 制作自己的元素周期表。它应该 (...)
- 轨道组 (s, p, d, f) 之间有间隙
- 每个组都应该有圆角
- 不同的“类别”(土碱金属等)应该用颜色表示
每个元素都应该有此信息
- 原子重量
- 原子数
- 化学符号
- 化学名称
- 轨道中的电子数
这是我认为应该是什么样子的图像
这里有一张图,代表我所指的轨道电子数
源代码 我自己也尝试过一些东西。我想我可以“借用”一些代码这里。链接中的一些信息是错误的。所以我想到用所有需要的信息列表来制作一个新代码。天狼星3在德国 Python 论坛上帮助了我:
\documentclass{article}
\usepackage{tikz}
\newcommand{\CommonElementTextFormat}[4]
{
\begin{minipage}{2.2cm}
\centering
{\textbf{#1} \hfill #2}%
\linebreak \linebreak
{\textbf{#3}}%
\linebreak \linebreak
{{#4}}
\end{minipage}
}
\newcommand{\NaturalElementTextFormat}[4]
{
\CommonElementTextFormat{#1}{#2}{\LARGE {#3}}{#4}
}
\newread\linereader
\def\foreachline#1#2{\openin\linereader=#1\nextline#2}
\def\nextline#1{\read\linereader to \line\ifeof\linereader\closein\linereader\else\expandafter#1\line\end\expandafter\nextline\expandafter#1\fi}
\def\element#1 #2 #3 #4 #5\end{\node[name=#2, Element]{\NaturalElementTextFormat{#1}{#4}{#2}{#3}};}
\begin{document}
\section{Elemente}
\begin{tikzpicture}[font=\sffamily, scale=0.45, transform shape]
\tikzstyle{ElementFill} = [fill=yellow!15]
\tikzstyle{Element} = [draw=black, ElementFill,
minimum width=2.75cm, minimum height=2.75cm, node distance=2.75cm]
\foreachline{elements.txt}\element
\end{tikzpicture}
\end{document}
以下是 elements.txt 数据:
AN Symb Name AU Notes
1 H Hydrogen 1.008 3, 6
2 He Helium 4.002602(2) 1, 2
3 Li Lithium 6.94 3, 6
4 Be Beryllium 9.0121831(5)
5 B Boron 10.81 3, 6
6 C Carbon 12.011 6
7 N Nitrogen 14.007 6
8 O Oxygen 15.999 6
9 F Fluorine 18.998403163(6)
10 Ne Neon 20.1797(6) 1, 3
11 Na Sodium 22.98976928(2)
12 Mg Magnesium 24.305 6
13 Al Aluminium 26.9815385(7)
14 Si Silicon 28.085 6
15 P Phosphorus 30.973761998(5)
16 S Sulfur 32.06 6
17 Cl Chlorine 35.45 3, 6
18 Ar Argon 39.948(1) 1, 2
19 K Potassium 39.0983(1)
20 Ca Calcium 40.078(4)
21 Sc Scandium 44.955908(5)
22 Ti Titanium 47.867(1)
23 V Vanadium 50.9415(1)
24 Cr Chromium 51.9961(6)
25 Mn Manganese 54.938044(3)
26 Fe Iron 55.845(2)
27 Co Cobalt 58.933194(4)
28 Ni Nickel 58.6934(4) 2
29 Cu Copper 63.546(3) 2
30 Zn Zinc 65.38(2) 2
31 Ga Gallium 69.723(1)
32 Ge Germanium 72.630(8)
33 As Arsenic 74.921595(6)
34 Se Selenium 78.971(8)
35 Br Bromine 79.904 6
36 Kr Krypton 83.798(2) 1, 3
37 Rb Rubidium 85.4678(3) 1
38 Sr Strontium 87.62(1) 1, 2
39 Y Yttrium 88.90584(2)
40 Zr Zirconium 91.224(2) 1
41 Nb Niobium 92.90637(2)
42 Mo Molybdenum 95.95(1) 1
43 Tc Technetium 97 4
44 Ru Ruthenium 101.07(2) 1
45 Rh Rhodium 102.90550(2)
46 Pd Palladium 106.42(1) 1
47 Ag Silver 107.8682(2) 1
48 Cd Cadmium 112.414(4) 1
49 In Indium 114.818(1)
50 Sn Tin 118.710(7) 1
51 Sb Antimony 121.760(1) 1
52 Te Tellurium 127.60(3) 1
53 I Iodine 126.90447(3)
54 Xe Xenon 131.293(6) 1, 3
55 Cs Caesium 132.90545196(6)
56 Ba Barium 137.327(7)
57 La Lanthanum 138.90547(7) 1
58 Ce Cerium 140.116(1) 1
59 Pr Praseodymium 140.90766(2)
60 Nd Neodymium 144.242(3) 1
61 Pm Promethium 145 5
62 Sm Samarium 150.36(2) 1
63 Eu Europium 151.964(1) 1
64 Gd Gadolinium 157.25(3) 1
65 Tb Terbium 158.92535(2)
66 Dy Dysprosium 162.500(1) 1
67 Ho Holmium 164.93033(2)
68 Er Erbium 167.259(3) 1
69 Tm Thulium 168.93422(2)
70 Yb Ytterbium 173.054(5) 1
71 Lu Lutetium 174.9668(1) 1
72 Hf Hafnium 178.49(2)
73 Ta Tantalum 180.94788(2)
74 W Tungsten 183.84(1)
75 Re Rhenium 186.207(1)
76 Os Osmium 190.23(3) 1
77 Ir Iridium 192.217(3)
78 Pt Platinum 195.084(9)
79 Au Gold 196.966569(5)
80 Hg Mercury 200.592(3)
81 Tl Thallium 204.38 6
82 Pb Lead 207.2(1) 1, 2
83 Bi Bismuth 208.98040(1)
84 Po Polonium 209 4
85 At Astatine 210 4
86 Rn Radon 222 4
87 Fr Francium 223 4
88 Ra Radium 226 4
89 Ac Actinium 227 4
90 Th Thorium 232.0377(4) 1, 4
91 Pa Protactinium 231.03588(2) 4
92 U Uranium 238.02891(3) 1, 3, 4
93 Np Neptunium 237 4
94 Pu Plutonium 244 4
95 Am Americium 243 4
96 Cm Curium 247 4
97 Bk Berkelium 247 4
98 Cf Californium 251 4
99 Es Einsteinium 252 4
100 Fm Fermium 257 4
101 Md Mendelevium 258 4
102 No Nobelium 259 4
103 Lr Lawrencium 262 4
104 Rf Rutherfordium 267 4
105 Db Dubnium 270 4
106 Sg Seaborgium 271 4
107 Bh Bohrium 270 4
108 Hs Hassium 277 4
109 Mt Meitnerium 276 4
110 Ds Darmstadtium 281 4
111 Rg Roentgenium 282 4
112 Cn Copernicium 285 4
113 Uut Ununtrium 285 4, 5
114 Fl Flerovium 289 4, 5
115 Uup Ununpentium 289 4, 5
116 Lv Livermorium 293 4, 5
117 Uus Ununseptium 294 4, 5
118 Uuo Ununoctium 294 4, 5
问题
- 排列所有元素(所有 118 个元素均位于彼此的后面)
- 为每组轨道制作圆角
- 给每个组一种颜色(碱金属、碱土金属......)
- 根据 Aufbau 原理写出每个元素的电子数
- 写出每个周期/组的周期数/组数
我知道这很难,但如果你能再帮我一点忙就好了:-) ...我只是被困住了:/
提前谢谢您!问候!
答案1
到目前为止我得到了这个
- 您需要从中删除第一行
elements.txt
。 - 构建原则可能会失效。我没有处理过。
- 由于规则不同,所以颜色比较暗。
- 请自行添加标签。
- 有些序列是硬编码的,例如
1/30,34/24,66/24,98/14,130/14
和2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6,2
。也许它们是以最有效的方式编码的。
代码
\documentclass[tikz,border=9]{standalone}
\begin{document}
% Draw the Contour of Groups
\def\DrawGroup;{
\draw[rounded corners=10pt,fill=red!10 ](15in,0)|-+(-1in,1in)|-+(1in,-6in)|-cycle;
\draw[rounded corners=10pt,fill=yellow!50](17in,-2in)rectangle+(10in,-4in);
\draw[rounded corners=10pt,fill=green!10 ](17in,-7in)rectangle+(14in,-2in);
\draw[rounded corners=10pt,fill=blue!10 ](33in,-0in)-|+(-5in,-6in)-|+(1in,1in)-|cycle;
\clip[rounded corners=10pt] (15in,0)|-+(-1in,1in)|-+(1in,-6in)|-cycle
(17in,-2in)rectangle+(10in,-4in)
(17in,-7in)rectangle+(14in,-2in)
(33in,-0in)-|+(-5in,-6in)-|+(1in,1in)-|cycle;
}
% Atomic Number \PNn => Coordinate (\PNx,\PNy)
\def\PositionByNumber;{
\pgfmathtruncatemacro\PNn{\n}
\foreach\PNa/\PNb in{1/30,34/24,66/24,98/14,130/14}{
\ifnum\PNn>\PNa
\pgfmathtruncatemacro\PNn{\PNn+\PNb}\xdef\PNn{\PNn}
\fi
}
}
% Coordinate (\PNx,\PNy) => Move and Group
\def\GroupByPosition;{
\pgfmathtruncatemacro\PNx{mod(\PNn-.5,32)+.5}
\pgfmathtruncatemacro\PNy{(\PNn-\PNx)/32}
\ifnum\PNx>2\ifnum\PNx<17
\pgfmathtruncatemacro\PNy{\PNy+3}
\pgfmathtruncatemacro\PNx{\PNx+14}
\fi\fi
\ifnum\PNx<3
\pgfmathtruncatemacro\PNx{\PNx+13}
\fi
\ifnum\PNx>26\ifnum\PNy<8
\pgfmathtruncatemacro\PNx{\PNx+1}
\fi\fi
\pgftransformreset;\pgftransformxshift{\PNx in};\pgftransformyshift{-\PNy in};
}
% Atomic Number \APn => Electron Configuration \APe1 \APe2 \APe3 ...
\def\AufbauPrinciple;{
\pgfmathtruncatemacro\APn{\n}
\xdef\APi{0}
\foreach\APa in{2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6,2}{
\pgfmathtruncatemacro\APi{\APi+1}\xdef\APi{\APi}
\ifnum\APn>\APa
\expandafter\xdef\csname APe\APi\endcsname{$\bullet$}
\pgfmathtruncatemacro\APn{\APn-\APa}\xdef\APn{\APn}
\else\ifnum\APn>0
\expandafter\xdef\csname APe\APi\endcsname{\APn}
\pgfmathtruncatemacro\APn{\APn-\APn}\xdef\APn{\APn}
\else
\expandafter\xdef\csname APe\APi\endcsname{}
\fi\fi
}
}
% Print the Configuration
\def\DrawConfiguration;{
\xdef\DCi{0}
\foreach\DCa/\DCb in{1/1,1/2,2/2,1/3,2/3,1/4,3/3,2/4,1/5,3/4,2/5,1/6,4/4,3/5,2/6,1/7,4/5,3/6,2/7,1/8}{
\pgfmathtruncatemacro\DCi{\DCi+1}\xdef\DCi{\DCi}
\path[scale=.2](\DCa,\DCb)node{\csname APe\DCi\endcsname};
}
}
\newread\linereader
\def\foreachline#1#2{\openin\linereader=#1\nextline#2}
\def\nextline#1{\read\linereader to \line\ifeof\linereader\closein\linereader\else\expandafter#1\line\end\expandafter\nextline\expandafter#1\fi}
\def\element#1 #2 #3 #4 #5\end{
\xdef\n{#1}
\PositionByNumber;
\GroupByPosition;
\draw[black](0,0)rectangle(1in,1in)
(0,1in)node[below right]{#1}(1in,1in)node[below left]{#4}(.5in,.5in)node{\Large #2}(.5in,.1in)node{#3};
\AufbauPrinciple;
\DrawConfiguration;
\message{[\n]}
}
\scriptsize
\begin{tikzpicture}
\DrawGroup;
\foreachline{elements.txt}\element
\end{tikzpicture}
\end{document}
答案2
使用 Metapost + Context
\setuppapersize[A4,landscape][A4,landscape]
\setuplayout[
backspace=0.5in,
width=10in,
topspace=1.0in,
header=0in,
footer=0in,
height=16.5in]
\starttext
\startMPcode
numeric IMAP[], NSUBS[], IOCCM[], IOCC[], energy_level[];
string SHSYM[], SYMBAT[], subcamada[], ELEMENTSNAME[], MASS[];
numeric j; j:=1;
for i="H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K" ,"Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd","Pm","Sm","Ee","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr","Rf","Db","Sg","Bh","Hs","Mt","Ds","Rg","Cn","Uut","Fl","Uup","Lv","Uus","Uuo":
SYMBAT[j]:=i;
j:=j+1;
endfor;
j:=1;
for
i="1.008","4.002602(2)","6.94","9.0121831(5)","10.81","12.011","14.007","15.999","18.998403163(6)","20.1797(6)","22.98976928(2)","24.305","26.9815385(7)","28.085","30.973761998(5)","32.06","35.45","39.948(1)","39.0983(1)","40.078(4)","44.955908(5)","47.867(1)","50.9415(1)","51.9961(6)","54.938044(3)","55.845(2)","58.933194(4)","58.6934(4)","63.546(3)","65.38(2)","69.723(1)","72.630(8)","74.921595(6)","78.971(8)","79.904","83.798(2)","85.4678(3)","87.62(1)","88.90584(2)","91.224(2)","92.90637(2)","95.95(1)","97","101.07(2)","102.90550(2)","106.42(1)","107.8682(2)","112.414(4)","114.818(1)","118.710(7)","121.760(1)","127.60(3)","126.90447(3)","131.293(6)","132.90545196(6)","137.327(7)","138.90547(7)","140.116(1)","140.90766(2)","144.242(3)","145","150.36(2)","151.964(1)","157.25(3)","158.92535(2)","162.500(1)","164.93033(2)","167.259(3)",
"168.93422(2)","173.054(5)","174.9668(1)","178.49(2)","180.94788(2)","183.84(1)","186.207(1)","190.23(3)","192.217(3)","195.084(9)","196.966569(5)","200.592(3)","204.38","207.2(1)","208.98040(1)","209","210","222","223","226","227","232.0377(4)","231.03588(2)","238.02891(3)","237","244","243","247","247","251","252","257","258","259","262","267","270","271","270","277","276","281","282","285","285","289","289","293","294","294":
MASS[j]:=i;
j:=j+1;
endfor;
j:=1;
for
i="Hydrogen","Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon","Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium","Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc","Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttrium","Zirconium","Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin","Antimony","Tellurium","Iodine","Xenon","Caesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium","Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium","Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury","Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium","Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium","Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium","Roentgenium","Copernicium","Ununtrium","Flerovium","Ununpentium","Livermorium","Ununseptium","Ununocti":
ELEMENTSNAME[j]:=i;
j:=j+1;
endfor;
j:=1;
for i=1,2,3,4,5,7,6,8,11,9,12,15,10,13,16,18,14,17,19,20:
IMAP[j]:=i;
j:=j+1;
endfor;
j:=1;
for i=2,2,6,2,6,10,2,6,10,14,2,6,10,14,2,6,10,2,6,2:
NSUBS[j]:=i;
j:=j+1;
endfor;
j:=1;
for i="1s","2s","2p","3s","3p","3d","4s","4p","4d","4f","5s","5p","5d","5f","6s","6p","6d","7s","7p","8s":
SHSYM[j]:=i;
j:=j+1;
endfor;
j:=1;
for i="s","s","p","s","p","d","s","p","d","f","s","p","d","f","s","p","d","s","p","s":
subcamada[j]:=i;
j:=j+1;
endfor;
j:=1;
for i=1,2,2,3,3,3,4,4,4,4,5,5,5,5,6,6,6,7,7,8:
energy_level[j]:=i;
j:=j+1;
endfor;
vardef EletronConfiguration(expr Z) =
numeric IDUM;
IDUM:=Z;
for i=1 step 1 until 20:
IOCCM[IMAP[i]]:=min(NSUBS[IMAP[i]],IDUM);
IDUM:=max(IDUM-NSUBS[IMAP[i]],0);
IOCC[IMAP[i]]:=IOCCM[IMAP[i]];
endfor;
enddef;
vardef Aufbau(expr Z, u, maxi)=
EletronConfiguration(Z);
path q; numeric niv, sub, x_sca, y_sca; color cor;
image(
for i=1 step 1 until 20:
if (IOCCM[IMAP[i]]>0):
niv := energy_level[IMAP[i]];
sub := if (subcamada[IMAP[i]]=="s"): 0 elseif (subcamada[IMAP[i]]=="p"): 1 elseif (subcamada[IMAP[i]]=="d"): 2 elseif (subcamada[IMAP[i]]=="f"): 3 fi;
cor := if (subcamada[IMAP[i]]=="s"): red elseif (subcamada[IMAP[i]]=="p"): .5[green,white] elseif (subcamada[IMAP[i]]=="d"): .5[blue,white] elseif (subcamada[IMAP[i]]=="f"): .7[red,white] fi;
x_sca:= u/8; y_sca:=u/12;
q:= unitsquare xscaled x_sca yscaled y_sca shifted (sub*u/8, -niv*u/12);
if i==maxi:
fill q withcolor cor;
label(textext(IOCCM[IMAP[i]]) scaled 0.3, center q)
else:
label(textext(IOCCM[IMAP[i]]) scaled 0.2, center q)
fi;
draw q;
fi;
endfor;
)
enddef;
def element_localization(expr Z) =
EletronConfiguration(Z);
numeric el_valence, pt_period, maximo, energy_level, u; u:=1.5cm; el_valence:=0; energy_level:=0; path p;
for i=1 step 1 until 20:
if (IOCCM[IMAP[i]]>0):
energy_level := max(energy_level, energy_level[IMAP[i]]);
maximo := i;
fi
endfor;
if (subcamada[IMAP[max(1,maximo)]]=="d"):
pt_period := energy_level-1; elseif (subcamada[IMAP[max(1,maximo)]]=="f"): pt_period:=energy_level+3; else: pt_period:=energy_level;
fi;
for i=1 step 1 until 20:
if (energy_level[IMAP[i]]==energy_level) and (pt_period==energy_level):
el_valence := el_valence + IOCCM[IMAP[i]];
fi;
endfor;
if Z==2: el_valence:=8 fi;
if (pt_period<>energy_level): el_valence := IOCCM[IMAP[max(1,maximo)]]+2; fi
if (el_valence > 2) and (energy_level==pt_period): el_valence:=el_valence+10 fi;
if (energy_level==pt_period) or (energy_level==pt_period+1):
p:= unitsquare scaled u shifted (el_valence*u, -energy_level*u);
else:
p:= unitsquare scaled u shifted (el_valence*u, -pt_period*u);
fi
draw p;
label(textext("{\bf" & SYMBAT[Z] & "}") scaled 0.7, center p + (u/4,0));
label.lft(textext("{\bf" & ELEMENTSNAME[Z] & "}") scaled 0.2, lrcorner p + (0,u/8));
label.rt(textext(Z) scaled 0.5, center p + (-u/2,u/3));
label.lft(textext(MASS[Z]) scaled 0.2, center p + (u/2,u/3));
draw Aufbau(Z,u, maximo) shifted (llcorner p + (u/20,2*u/3));
enddef;
for i=1 step 1 until 118:
element_localization(i);
endfor;
\stopMPcode
\stoptext