14

Expectations

I would like to make my own periodic table in LaTeX. It should (...)

  • have a space between the orbital groups (s, p, d, f)
  • every group should have rounded corners
  • the different "categories" (earth alkali metal and so on) should be colored

Each element should have this information

  • Atomic Weight
  • Atomic Number
  • Chemical Symbol
  • Chemical Name
  • Count of electrons in the orbitals

Here an image how I thought it should look like Sketch of periodic table design

And here an image what I meant with electron counts in orbitals Electron counts.

Source Code I have tried something myself. I thought I could "borrow" some of the code from here. Some of the information in the link is wrong. So I thought of making a new code using a list of all need information. Sirius3 helped me in a German Python Forum:

\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}

And here is the elements.txt data:

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

Problems

  • Arranging all elements (all 118 elements are behind each other)
  • Make round corners for each group of orbitals
  • Give every group a color (Alkali Metal, Alkali Earth Metal ...)
  • Writing the electron count from the Aufbau principle for each element
  • Writing the number of period/groups for each period/group

I know it is much, but it would be nice if you could help me a little further :-) ... I am just stuck :/

Thank you very much in advance! Kind regards!

  • "Arranging all elements (all 118 elements are behind each other)" -- since you're starting from the linked periodic table document, have you tried making your own \NaturalElementTextFormat macro? Once you start that way, I'd assume making round corners, group colors, and electron counts would be relatively straightforward. – Mike Renfro Mar 16 '15 at 15:08
  • 1
    Great Expectations, Charles Dickens would say (or write) ;-) – user31729 Mar 16 '15 at 15:22
  • What about the Lanthanids and actinides? Where do they go? Should the orbital boxes expand with increasing electron count or all possible 118 boxes are there, most of them empty in the case of the lighter elements? – user31729 Mar 16 '15 at 15:29
  • La/Ac: I thought of having one box for each, like on this photo - img4.fotos-hochladen.net/uploads/auswahl002rsl89i3y0t.png ... and then have the two rows with actenids and lanthanids beneath (like the box f on my sketch). But just two boxes like shown on the picture. Electron count: I thought of having all boxes each row need under each element in the row. So every element have the same size and height. But not all possible electron count boxes for each row. If that makes sense? :-) – Basilius Sapientia Mar 16 '15 at 16:00
  • Consider adding two columns to the elements.txt data table. THis would provide the row and column number to place the element. Then this data could be used to properly place the individual elements. I would choose this as the location of the elements in the table will not be changing. And you can use the row and column number dynamically when you scale the size of the table. – R. Schumacher Mar 16 '15 at 16:52
17

So far I got this

  • You need to delete the first line from your elements.txt.
  • Aufbau principle may fail. I did not handle it.
  • It is badly colored because the rules vary.
  • Please add labels yourself.
  • Some sequences are hard-coded such as 1/30,34/24,66/24,98/14,130/14 and 2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10,6,2. Perhaps they are encoded in a most efficient manner.

Code

\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}
13

With 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

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.