答案1
您可以使用矩阵来创建表格,对于箭头,有shapes.symbols
。并且fit
,backgrounds
并calc
允许您动态调整这些内容。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,fit,backgrounds,calc,shapes.symbols}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\matrix[matrix of nodes,row sep=-\pgflinewidth,column sep=-\pgflinewidth,
standard size/.style={minimum height=6mm,text width=pi*1cm,anchor=center},
nodes={draw,standard size,fill=white},
row 1/.style={nodes={standard size,fill=purple,text=white}},]
(mat)
{ aaa & bbb & ccc \\
aaa & bbb & ccc \\
|[fill=red,text=white]| aaa & bbb & ccc \\
aaa & bbb & ccc \\
|[fill=red,text=white]| aaa & |[fill=blue,text=white]| bbb & |[fill=red,text=white]| ccc \\
aaa & bbb & ccc \\
};
\begin{scope}[on background layer]
\node[fit=(mat),inner sep=8mm,fill=cyan!50!gray,rounded corners=8pt](fit){};
\end{scope}
\foreach \X/\Y [count=\Z] in {AAA/orange,BBB/green!80!gray,CCC/cyan!50!gray}
{\path let \p1=($(mat-1-\Z.north east)-(mat-1-\Z.north west)$),
\p2=($(fit.north)-(mat-1-\Z.north west)$)
in node[shape=signal,signal to=east,signal from=west,
anchor=south west,fill=\Y,
minimum width=\x1+\y2/2-\pgflinewidth,minimum height=\y2-2*\pgflinewidth]
at (mat-1-\Z.north west) {\X};}
\end{tikzpicture}
\end{document}
当然,它可以与“开箱即用”的参考/链接一起使用。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,fit,backgrounds,calc,shapes.symbols}
\usepackage{hyperref}
\begin{document}
\begin{figure}[htb]
\begin{tikzpicture}[font=\sffamily]
\matrix[matrix of nodes,row sep=-\pgflinewidth,column sep=-\pgflinewidth,
standard size/.style={minimum height=6mm,text width=pi*1cm,anchor=center},
nodes={draw,standard size,fill=white},
row 1/.style={nodes={standard size,fill=purple,text=white}},]
(mat)
{ aaa \cite{Einstein} & bbb & ccc \\
aaa \cite{Witten:1982fp} & bbb & ccc \\
|[fill=red,text=white]| aaa \cite{AlvarezGaume:1983ig} & bbb & ccc \\
aaa & bbb & ccc \\
|[fill=red,text=white]| aaa & |[fill=blue,text=white]| bbb & |[fill=red,text=white]| ccc \\
aaa & bbb & ccc \\
};
\begin{scope}[on background layer]
\node[fit=(mat),inner sep=8mm,fill=cyan!50!gray,rounded corners=8pt](fit){};
\end{scope}
\foreach \X/\Y [count=\Z] in {AAA/orange,BBB/green!80!gray,CCC/cyan!50!gray}
{\path let \p1=($(mat-1-\Z.north east)-(mat-1-\Z.north west)$),
\p2=($(fit.north)-(mat-1-\Z.north west)$)
in node[shape=signal,signal to=east,signal from=west,
anchor=south west,fill=\Y,
minimum width=\x1+\y2/2-\pgflinewidth,minimum height=\y2-2*\pgflinewidth]
at (mat-1-\Z.north west) {\X};}
\end{tikzpicture}
\caption{A Ti\emph{k}Zy table.}
\label{tab:TikZy}
\end{figure}
\begin{thebibliography}{9}
\bibitem{Einstein}
A.~Einstein, \textit{Zur Elektrodynamik bewegter K{\"o}rper},
Annalen der Physik, 322(10):891--921, 1905.
\bibitem{Witten:1982fp}
E.~Witten, \textit{An SU(2) Anomaly},
Phys.\ Lett.\ B \textbf{117}, 324 (1982).
\bibitem{AlvarezGaume:1983ig}
L.~Alvarez--Gaum\'{e} and E.~Witten,
\textit{Gravitational Anomalies},
Nucl.\ Phys.\ B \textbf{234}, 269 (1984).
\end{thebibliography}
\end{document}