Tuesday, 10 April 2012

LaTeX fun with periodic tables

For a while now I've wanted to generate a simple periodic table of elements in LaTeX. I've googled around a bit without too much joy. So I've made a simple one myself.

Here is the code:

\documentclass[a4paper,12pt]{article}
\pagestyle{empty}
\usepackage{rotating}
\linespread{1.2}

\begin{document}

\begin{sidewaystable}
 {
  \renewcommand{\arraystretch}{1.5}
  \bfseries
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\cline{1-1} \cline{18-18}
H &       \multicolumn{16}{|c|}{}                                                  & He \\
\cline{1-2} \cline{13-18}
Li & Be & \multicolumn{10}{|c|}{}                         & Bo & C  & N  & O  & Fl & Ne \\
\cline{1-2} \cline{13-18}
Na & Mg & \multicolumn{10}{|c|}{}                         & Al & Si & P  & S  & Cl & Ar \\
\hline
K  & Ca & Sc & Ti & V  & Cr & Mn & Fe & Co & Ni & Cu & Zn & Ga & Ge & As & Se & Br & Kr \\
\hline
Rb & Sr & Y  & Zr & Nb & Mo & Tc & Ru & Rh & Pd & Ag & Cd & In & Sn & Sb & Te & I  & Xe \\
\hline
Cs & Ba & *  & Hf & Ta & W  & Re & Os & Ir & Pt & Au & Hg & Tl & Pb & Bi & Po & At & Rn \\
\hline
Fr & Ra & ** & Rf & Db & Sg & Bh & Hs & Mt & Ds & Rg & Cn & Uut & Uuq & Uup & Uuh & Uus & Uuo \\
\hline
\end{tabular}
}
\end{sidewaystable}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


And here is the resulting table:

1 comment: