Periodic Pool Table
Autor
Senan Sekhon
Last Updated
hace 4 años
License
Creative Commons CC BY 4.0
Resumen
A billiards-themed periodic table, made with TikZ
A billiards-themed periodic table, made with TikZ
\documentclass{article}
\usepackage[a4paper,landscape,top=0in,bottom=0in,left=0in,right=0in]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,pgf}
%Colors for table cloth and cushions
\definecolor{tablecol}{HTML}{067345}
\definecolor{cushcol}{HTML}{00AD2B}
%Colors for each type of element
\definecolor{alk}{HTML}{960500}
\definecolor{alke}{HTML}{7A0064}
\definecolor{trans}{HTML}{A69D00}
\definecolor{lan}{HTML}{118274}
\definecolor{act}{HTML}{182CAD}
\definecolor{post}{HTML}{00C0D1}
\definecolor{semi}{HTML}{646464}
\definecolor{non}{HTML}{6100C9}
\definecolor{noble}{HTML}{050066}
%Created by Senan Sekhon
%Created March 6, 2021
%Conditional commands for different argument values. From https://tex.stackexchange.com/questions/179333/new-command-with-cases
\def\eqifcase #1#2#3{\eqifcaseA #1#2#1{#3}\end }
\def\eqifcaseA #1#2#3{\ifx #1#2\eqifcaseDo{#3}\fi \eqifcaseA #1}
\def\eqifcaseDo #1\fi #2\end{\fi #1}
\newcommand{\stripecode}[1]{\eqifcase{#1}{%Defines stripe pattern based on period
{1} %stripe pattern for period 1
{(-0.5,-0.5) rectangle (0.5,0.5)
(0,0) circle (0.25)}
{2} %stripe pattern for period 2
{(-0.5,-0.35) rectangle (0.5,0.35)
(0,0) circle (0.25)}
{3} %stripe pattern for period 3, stripe width 0.03
{(-0.5,-0.35) rectangle (0.5,0.35)
(-0.5,-0.32) rectangle (0.5,0.32)
(-0.5,-0.29) rectangle (0.5,0.29)
(0,0) circle (0.25)}
{4} %stripe pattern for period 4, stripe width 0.03
{(-0.5,-0.41) rectangle (0.5,0.41)
(-0.5,-0.38) rectangle (0.5,0.38)
(-0.5,-0.35) rectangle (0.5,0.35)
(-0.5,-0.32) rectangle (0.5,0.32)
(-0.5,-0.29) rectangle (0.5,0.29)
(0,0) circle (0.25)}
{5} %stripe pattern for period 5, stripe width 0.025
{(-0.5,-0.44) rectangle (0.5,0.44)
(-0.5,-0.415) rectangle (0.5,0.415)
(-0.5,-0.39) rectangle (0.5,0.39)
(-0.5,-0.365) rectangle (0.5,0.365)
(-0.5,-0.34) rectangle (0.5,0.34)
(-0.5,-0.315) rectangle (0.5,0.315)
(-0.5,-0.29) rectangle (0.5,0.29)
(0,0) circle (0.25)}
{6} %stripe pattern for period 6, stripe width 0.022
{(-0.5,-0.456) rectangle (0.5,0.456)
(-0.5,-0.434) rectangle (0.5,0.434)
(-0.5,-0.412) rectangle (0.5,0.412)
(-0.5,-0.39) rectangle (0.5,0.39)
(-0.5,-0.368) rectangle (0.5,0.368)
(-0.5,-0.346) rectangle (0.5,0.346)
(-0.5,-0.324) rectangle (0.5,0.324)
(-0.5,-0.302) rectangle (0.5,0.302)
(-0.5,-0.28) rectangle (0.5,0.28)
(0,0) circle (0.25)}
{7} %stripe pattern for period 7, stripe width 0.02
{(-0.5,-0.48) rectangle (0.5,0.48)
(-0.5,-0.46) rectangle (0.5,0.46)
(-0.5,-0.44) rectangle (0.5,0.44)
(-0.5,-0.42) rectangle (0.5,0.42)
(-0.5,-0.4) rectangle (0.5,0.4)
(-0.5,-0.38) rectangle (0.5,0.38)
(-0.5,-0.36) rectangle (0.5,0.36)
(-0.5,-0.34) rectangle (0.5,0.34)
(-0.5,-0.32) rectangle (0.5,0.32)
(-0.5,-0.3) rectangle (0.5,0.3)
(-0.5,-0.28) rectangle (0.5,0.28)
(0,0) circle (0.25)}
}{not found}}
\newcommand{\ball}[4][0,0]{%Ball template for element
\begin{scope}[shift={(#1)}]
\shade[ball color=white] (0,0) circle (0.5);
\begin{scope}[even odd rule]
\clip \stripecode{#2};
\shade[ball color=#4] (0,0) circle (0.5);
\end{scope}
\node[font=\sffamily\bfseries\selectfont] at (0,0) {#3};
\end{scope}}
\begin{document}
\thispagestyle{empty}
\hspace{0pt}
\vfill %For vertical centering on page
\centering
\begin{tikzpicture}[scale=1.15,every node/.style={transform shape},font=\sffamily\bfseries\selectfont]
\begin{scope} %Pool Table
\def\pd{11.4} %Distance between centers of adjacent pockets
\def\wd{1} %Vertical/horizontal distance from center of pocket to edge of frame
\def\pc{0.5} %Radius of pocket
\pgfmathsetmacro\pv{\pc/sqrt(2)}
\def\bt{0.3} %Width of cushion
\fill[tablecol,rounded corners=6mm] (-\pd-\wd,-\pd/2-\wd) rectangle (\pd+\wd,\pd/2+\wd); %table cloth
\begin{scope} %wooden frame and corner plates
\clip [rounded corners=6mm] (-\pd-\wd,-\pd/2-\wd) rectangle (\pd+\wd,\pd/2+\wd) %Outer boundary
[sharp corners] (-\pd,-\pd/2+2*\pv)--(-\pd-\pv,-\pd/2+\pv) arc(-225:-45:\pc)--(-\pd+2*\pv,-\pd/2)--(-2*\pv,-\pd/2)--(-\pv,-\pd/2-\pv) arc(-135:-45:\pc)--(2*\pv,-\pd/2)--(\pd-2*\pv,-\pd/2)--(\pd-\pv,-\pd/2-\pv) arc(-135:45:\pc)--(\pd,-\pd/2+2*\pv)--(\pd,\pd/2-2*\pv)--(\pd+\pv,\pd/2-\pv) arc(-45:135:\pc)--(\pd-2*\pv,\pd/2)--(2*\pv,\pd/2)--(\pv,\pd/2+\pv) arc(45:135:\pc)--(-2*\pv,\pd/2)--(-\pd+2*\pv,\pd/2)--(-\pd+\pv,\pd/2+\pv) arc(45:225:\pc)--(-\pd,\pd/2-2*\pv)--cycle; %Inner boundary
% Alternative inner boundary: (-\pd,-\pd/2+\pc) arc(-270:0:\pc)--(-\pc,-\pd/2) arc(-180:0:\pc)--(\pd-\pc,-\pd/2) arc(-180:90:\pc)--(\pd,\pd/2-\pc) arc(-90:180:\pc)--(\pc,\pd/2) arc(0:180:\pc)--(-\pd+\pc,\pd/2) arc(0:270:\pc)--cycle;
\fill[Brown] (-\pd-\wd,-\pd/2-\wd) rectangle (\pd+\wd,\pd/2+\wd); %wooden frame
\foreach \sa in {-1,1}
\foreach \sb in {-1,1}
\fill[gray!80] ({\sa*\pd},{\sb*\pd/2}) rectangle ({\sa*(\pd+\wd)},{\sb*(\pd/2+\wd)}); %corner plates
\end{scope}
\foreach \sh/\ro in {{(-\pd/2,-\pd/2)}/0,{(\pd/2,-\pd/2)}/0,{(\pd,0)}/90,{(\pd/2,\pd/2)}/180,{(-\pd/2,\pd/2)}/180,{(-\pd,0)}/270}
\fill[cushcol,shift=\sh,rotate=\ro] (-\pd/2+2*\pv,0)--(\pd/2-2*\pv,0) [rounded corners=2mm]--(\pd/2-2*\pv-\bt,\bt) --(-\pd/2+2*\pv+\bt,\bt) [sharp corners]--cycle; %cushions
\foreach \pocket in {(-\pd,-\pd/2),(0,-\pd/2),(\pd,-\pd/2),(-\pd,\pd/2),(0,\pd/2),(\pd,\pd/2)}
\fill[black] \pocket circle (0.5); %pockets
%Diamond finishing on frame
\foreach \q in {-3,-2,-1,1,2,3}
\foreach \r in {-1,1}
{\begin{scope}[shift={({\q*\pd/4},{\r*(\pd/2+\wd/2)})},xscale=0.16,yscale=0.28]
\clip (1,0) arc(-90:-180:1) arc(0:-90:1) arc(90:0:1) arc(180:90:1)--cycle;
\fill[gray!60] (0,0) circle (1); %finishes on long edge
\end{scope}}
\foreach \q in {-1,1}
\foreach \r in {-1,0,1}
{\begin{scope}[shift={({\q*(\pd+\wd/2)},{\r*\pd/4)})},xscale=0.28,yscale=0.16]
\clip (1,0) arc(-90:-180:1) arc(0:-90:1) arc(90:0:1) arc(180:90:1)--cycle;
\fill[gray!60] (0,0) circle (1); %finishes on short edge
\end{scope}}
\end{scope}
\begin{scope}[shift={(-8.5,-1.5)}] %Periodic Table
%Some elements have the prefix \small in front of their atomic symbols, as the symbols are too large to fit nicely into the white circles designated for them
\ball[0,6]{1}{H}{white} %Hydrogen
\ball[17,6]{1}{He}{noble} %Helium
\begin{scope}[shift={(0,0)}] %Alkali Metals and Alkaline-Earth Metals
\ball[0,5]{2}{Li}{alk} %Lithium
\ball[0,4]{3}{Na}{alk} %Sodium
\ball[0,3]{4}{K}{alk} %Potassium
\ball[0,2]{5}{Rb}{alk} %Rubidium
\ball[0,1]{6}{Cs}{alk} %Cesium
\ball[0,0]{7}{Fr}{alk} %Francium
\ball[1,5]{2}{Be}{alke} %Beryllium
\ball[1,4]{3}{\small Mg}{alke} %Magnesium
\ball[1,3]{4}{Ca}{alke} %Calcium
\ball[1,2]{5}{Sr}{alke} %Strontium
\ball[1,1]{6}{Ba}{alke} %Barium
\ball[1,0]{7}{Ra}{alke} %Radium
\end{scope}
\begin{scope}[shift={(2,0)}] %Transition Metals
\ball[0,3]{4}{Sc}{trans} %Scandium
\ball[1,3]{4}{Ti}{trans} %Titanium
\ball[2,3]{4}{V}{trans} %Vanadium
\ball[3,3]{4}{Cr}{trans} %Chromium
\ball[4,3]{4}{\small Mn}{trans} %Manganese
\ball[5,3]{4}{Fe}{trans} %Iron
\ball[6,3]{4}{Co}{trans} %Cobalt
\ball[7,3]{4}{Ni}{trans} %Nickel
\ball[8,3]{4}{Cu}{trans} %Copper
\ball[9,3]{4}{Zn}{trans} %Zinc
\ball[0,2]{5}{Y}{trans} %Yttrium
\ball[1,2]{5}{Zr}{trans} %Zirconium
\ball[2,2]{5}{Nb}{trans} %Niobium
\ball[3,2]{5}{\small Mo}{trans} %Molybdenum
\ball[4,2]{5}{Tc}{trans} %Technetium
\ball[5,2]{5}{Ru}{trans} %Ruthenium
\ball[6,2]{5}{Rh}{trans} %Rhodium
\ball[7,2]{5}{Pd}{trans} %Palladium
\ball[8,2]{5}{Ag}{trans} %Silver
\ball[9,2]{5}{Cd}{trans} %Cadmium
\ball[1,1]{6}{Hf}{trans} %Hafnium
\ball[2,1]{6}{Ta}{trans} %Tantalum
\ball[3,1]{6}{W}{trans} %Tungsten
\ball[4,1]{6}{Re}{trans} %Rhenium
\ball[5,1]{6}{Os}{trans} %Osmium
\ball[6,1]{6}{Ir}{trans} %Iridium
\ball[7,1]{6}{Pt}{trans} %Platinum
\ball[8,1]{6}{Au}{trans} %Gold
\ball[9,1]{6}{\small Hg}{trans} %Mercury
\ball[1,0]{7}{Rf}{trans} %Rutherfordium
\ball[2,0]{7}{Db}{trans} %Dubnium
\ball[3,0]{7}{Sg}{trans} %Seaborgium
\ball[4,0]{7}{Bh}{trans} %Bohrium
\ball[5,0]{7}{Hs}{trans} %Hassium
\ball[6,0]{7}{\small Mt}{trans} %Meitnerium
\ball[7,0]{7}{Ds}{trans} %Darmstadtium
\ball[8,0]{7}{\small Rg}{trans} %Roentgenium
\ball[9,0]{7}{Cn}{trans} %Copernicium
\end{scope}
\begin{scope}[shift={(2,-3)}] %Lanthanides and Actinides
\ball[0,1]{6}{La}{lan} %Lanthanum
\ball[1,1]{6}{Ce}{lan} %Cerium
\ball[2,1]{6}{Pr}{lan} %Praseodymium
\ball[3,1]{6}{\small Nd}{lan} %Neodymium
\ball[4,1]{6}{\small Pm}{lan} %Promethium
\ball[5,1]{6}{\small Sm}{lan} %Samarium
\ball[6,1]{6}{Eu}{lan} %Europium
\ball[7,1]{6}{Gd}{lan} %Gadolinium
\ball[8,1]{6}{Tb}{lan} %Terbium
\ball[9,1]{6}{Dy}{lan} %Dysprosium
\ball[10,1]{6}{Ho}{lan} %Holmium
\ball[11,1]{6}{Er}{lan} %Erbium
\ball[12,1]{6}{\small Tm}{lan} %Thulium
\ball[13,1]{6}{Yb}{lan} %Ytterbium
\ball[14,1]{6}{Lu}{lan} %Lutetium
\ball[0,0]{7}{Ac}{act} %Actinium
\ball[1,0]{7}{Th}{act} %Thorium
\ball[2,0]{7}{Pa}{act} %Protactinium
\ball[3,0]{7}{U}{act} %Uranium
\ball[4,0]{7}{\small Np}{act} %Neptunium
\ball[5,0]{7}{Pu}{act} %Plutonium
\ball[6,0]{7}{\small Am}{act} %Americium
\ball[7,0]{7}{\small Cm}{act} %Curium
\ball[8,0]{7}{Bk}{act} %Berkelium
\ball[9,0]{7}{Cf}{act} %Californium
\ball[10,0]{7}{Es}{act} %Einsteinium
\ball[11,0]{7}{\small Fm}{act} %Fermium
\ball[12,0]{7}{\small Md}{act} %Mendelevium
\ball[13,0]{7}{No}{act} %Nobelium
\ball[14,0]{7}{Lr}{act} %Lawrencium
\end{scope}
\begin{scope}[shift={(12,0)}] %Post-transition Metals, Metalloids, Non-metals and Noble Gases
\ball[0,5]{2}{B}{semi} %Boron
\ball[1,5]{2}{C}{non} %Carbon
\ball[2,5]{2}{N}{non} %Nitrogen
\ball[3,5]{2}{O}{non} %Oxygen
\ball[4,5]{2}{F}{non} %Fluorine
\ball[0,4]{3}{Al}{post} %Aluminum
\ball[1,4]{3}{Si}{semi} %Silicon
\ball[2,4]{3}{P}{non} %Phosphorus
\ball[3,4]{3}{S}{non} %Sulfur
\ball[4,4]{3}{Cl}{non} %Chlorine
\ball[0,3]{4}{Ga}{post} %Gallium
\ball[1,3]{4}{Ge}{semi} %Germanium
\ball[2,3]{4}{As}{semi} %Arsenic
\ball[3,3]{4}{Se}{non} %Selenium
\ball[4,3]{4}{Br}{non} %Bromine
\ball[0,2]{5}{In}{post} %Indium
\ball[1,2]{5}{Sn}{post} %Tin
\ball[2,2]{5}{Sb}{semi} %Antimony
\ball[3,2]{5}{Te}{semi} %Tellurium
\ball[4,2]{5}{I}{non} %Iodine
\ball[0,1]{6}{Tl}{post} %Thallium
\ball[1,1]{6}{Pb}{post} %Lead
\ball[2,1]{6}{Bi}{post} %Bismuth
\ball[3,1]{6}{Po}{post} %Polonium
\ball[4,1]{6}{At}{non} %Astatine
\ball[0,0]{7}{\small Nh}{post} %Nihonium
\ball[1,0]{7}{Fl}{post} %Flerovium
\ball[2,0]{7}{\small Mc}{post} %Moscovium
\ball[3,0]{7}{Lv}{post} %Livermorium
\ball[4,0]{7}{Ts}{non} %Tennessine
\ball[5,5]{2}{Ne}{noble} %Neon
\ball[5,4]{3}{Ar}{noble} %Argon
\ball[5,3]{4}{Kr}{noble} %Krypton
\ball[5,2]{5}{Xe}{noble} %Xenon
\ball[5,1]{6}{Rn}{noble} %Radon
\ball[5,0]{7}{\small Og}{noble} %Oganesson
\end{scope}
\end{scope}
\begin{scope}[scale=0.9,shift={(-11,-8.5)},every node/.style={shift={(\b,0)},right}] %Legend for Types of Elements
\def\a{0.8}
\def\b{0.4}
\shade[ball color=alk] (0,0) circle (0.3) node{Alkali Metals};
\shade[ball color=alke] (0,-\a) circle (0.3) node{Alkaline-Earth Metals};
\shade[ball color=trans] (0,-2*\a) circle (0.3) node{Transition Metals};
\shade[ball color=lan] (0,-3*\a) circle (0.3) node{Lanthanides};
\shade[ball color=act] (0,-4*\a) circle (0.3) node{Actinides};
\shade[ball color=post] (5,0) circle (0.3) node{Post-transition Metals};
\shade[ball color=semi] (5,-\a) circle (0.3) node{Metalloids};
\shade[ball color=non] (5,-2*\a) circle (0.3) node{Non-metals};
\shade[ball color=noble] (5,-3*\a) circle (0.3) node{Noble Gases};
\end{scope}
\begin{scope}[scale=0.9,shift={(6.8,-9.5)}] %Legend for Periods
\def\sp{1.2}
\ball[-3*\sp,0]{1}{1}{black}
\ball[-2*\sp,0]{2}{2}{black}
\ball[-\sp,0]{3}{3}{black}
\ball[0,0]{4}{4}{black}
\ball[\sp,0]{5}{5}{black}
\ball[2*\sp,0]{6}{6}{black}
\ball[3*\sp,0]{7}{7}{black}
\node at (0,1) {Stripes denote period (number of shells)};
\end{scope}
\begin{scope}[shift={(-7,4.7)}] %Pool cue Title Label
\def\cl{14} %Length of cue
\def\tr{0.2} %Half-width of tip of cue
\def\br{0.3} %Half-width of base of cue
\shade[bottom color=white,top color=black!40] (0,\tr)--(\cl,\br)--(\cl,-\br)--(0,-\tr)--cycle;
\shade[left color=Sepia!20,right color=Sepia] (\cl,\br) arc(15:-15:{(2+sqrt(3))*\br})--(\cl,-\br)--({2*\cl/3},{-(\tr+2*\br)/3})--({5*\cl/6},{-(\tr+5*\br)/12})--({2*\cl/3},0)--({5*\cl/6},{(\tr+5*\br)/12})--({2*\cl/3},{(\tr+2*\br)/3})--cycle;
\fill[gray!10] (0,\tr)--({\cl/12},{(11*\tr+\br)/12}) arc(15:-15:{(2+sqrt(3))*(11*\tr+\br)/12})--({\cl/12},{-(11*\tr+\br)/12})--(0,-\tr)--cycle;
\shade[ball color=Cerulean!50] (0,0) ellipse (2*\tr/5 and \tr);
\node[xshift=0mm] at (\cl/2,0) {PERIODIC POOL TABLE};
\end{scope}
\node[scale=1.5] at (6,-10) {Designed in {\normalfont\LaTeX} and {\normalfont Ti\textit{k}Z} by Senan Sekhon};
\end{tikzpicture}
\vfill %For vertical centering on page
\hspace{0pt}
\end{document}