Anybody knows how to reproduce this table in latex?
Thanks in advance for your time and advice.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityNote that in my view I ought not answer do-it-for-mes. Even if somebody else already has.
This turns Enrico Maria De Angelis's code into a pic
, element
and then uses a couple of loops to mis-construct the first three-and-a-bit rows of the periodic table.
A less chemically blasphemous version was provided in a link in the comments. However, that version uses deprecated code.
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning}
\newcounter{atomicnumber}
\setcounter{atomicnumber}{0}
\tikzset{%
element/.pic={%
\tikzset{%
elements/.cd,
#1,
/tikz/.cd,
}%
\stepcounter{atomicnumber}%
% addaswyd o gôd Enrico Maria De Angelis:
% https://tex.stackexchange.com/a/339005/
\node (\elementsymbol) [font=\huge\elementfont, text=\elementtext, inner sep=.5*\elementsep, anchor=mid, fill=\elementfill, rounded corners=2pt, minimum size=\elementsize] {\strut\elementsymbol};
\node [font=\tiny\elementfont, text=\elementtext, inner sep=2pt, anchor=north west] at (\elementsymbol.north west) {\theatomicnumber};
\node [font=\tiny\elementfont, text=\elementtext, inner sep=2pt, anchor=south] at (\elementsymbol.south) {\elementname};
},
elements/.search also={/tikz},
elements/.cd,
name/.store in=\elementname,
font/.store in=\elementfont,
text/.store in=\elementtext,
fill/.store in=\elementfill,
symbol/.store in=\elementsymbol,
size/.store in=\elementsize,
sep/.store in=\elementsep,
name=Full Name,
font=\sffamily,
text=white,
fill=black,
symbol=Sy,
size=35pt,
sep=2.5pt,
}
\begin{document}
\begin{tikzpicture}[node distance=\elementsize]
\coordinate (o);
\foreach \k/\m [count=\elementrow, evaluate=\elementrow as \elementshift using {-\elementrow*(\elementsize+\elementsep)}] in {%
magenta/{H/Hydrogen,He/Helium},
cyan/{%
Li/Lithium,Be/Beryllium,B/Boron,C/Carbon,Ny/Nitrogen,
O/Oxygen,F/Fluorine,Ne/Neon%
},
blue!50!cyan/{%
Na/Sodium,Mg/Magnesium,Al/Aluminium,Si/Silicon,P/Phosphorous,
S/Sulphur,Cl/Chlorine,Ar/Argon%
},
blue/{K/Potassium,Ca/Calcium}%
}{%
\coordinate (o\elementrow) at (0,\elementshift pt);
\begin{scope}
\foreach \i/\j [remember=\i as \ilast (initially o\elementrow)] in \m
\pic [right=\elementsize+\elementsep of \ilast.mid] {element={name=\j, symbol=\i, fill=\k}};
\end{scope}
}
\end{tikzpicture}
\end{document}
\foreach
are better grouped by adding some linebreaks? If you don't want to do it, I'll be happy to do it myself, if you are ok with this.
Nov 14, 2016 at 17:29
\foreach
is veeeeeeery long and so -- at least for me -- hard to read. I just wanted to insert some linebreaks to the code and not change the content ...
Nov 14, 2016 at 17:47
This is just one tile.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Dv
\coordinate (dv) at (0,0);
\coordinate (base) at (35pt,0pt);
\coordinate (height) at (0pt,35pt);
\coordinate (diag) at ($(base)+(height)$);
\fill[rounded corners=2pt, magenta] ($(dv)-.5*(diag)$) rectangle +(diag);
\node[white] at (dv) {\sffamily\huge Dv};
\node[white, inner sep=2pt] (dvtext) at ($(dv)-.5*(height)$) [anchor=south] {\sffamily\tiny Diversification};
\node[white, inner sep=2pt] (dvnum) at ($(dv)+.5*(height)-.5*(base)$) [anchor=north west] {\sffamily\tiny 01};
\end{tikzpicture}
\end{document}
It should be easy to copy, paste and modify a lot of times. To put them together the commands \pgftransformshift{\pgfpoint{1cm}{1cm}}
should be enough.