0

Table with refrence inside the cells

I need to draw a table with the same arrows. The reason I do not want to use the graphics software is that I need to add dynamic references inside the cells using latex. I would appreciate if somebody cloud help me with this.

5

You could use a matrix to create the table and for the arrows there is the shapes.symbols. And fit, backgrounds and calc allow you to dynamically adjust these things.

\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}

enter image description here

And of course it works with references/links "out of the box".

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.