答案1
请注意,我认为我不应该回答“替我做”。即使其他人已经回答了。
这变成恩里科·玛丽亚·德安吉利斯的代码变成pic
,element
然后使用几个循环错误构建元素周期表的前三位行。
评论中的链接提供了一个不那么亵渎化学的版本。然而,该版本使用了弃用的代码。
\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}
答案2
这只是一块瓷砖。
\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}
应该很容易复制、粘贴和多次修改。将它们组合在一起,命令\pgftransformshift{\pgfpoint{1cm}{1cm}}
就足够了。