What would be a way to create a table with the diagonal elements highlighted as such.
I used the example found here to get the above figure with this (not great) code
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\tikzset{
table/.style={
matrix of nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={
rectangle,
draw=black,
align=center
},
minimum height=1.5em,
text depth=0.5ex,
text height=2ex,
nodes in empty cells,
row 1 column 1/.style={
nodes={fill=gray!30}
},
row 2 column 2/.style={
nodes={fill=gray!30}
},
row 2 column 3/.style={
nodes={fill=gray!15}
},
row 3 column 2/.style={
nodes={fill=gray!15}
},
row 4 column 5/.style={
nodes={fill=gray!15}
},
row 5 column 4/.style={
nodes={fill=gray!15}
},
row 6 column 7/.style={
nodes={fill=gray!15}
},
row 7 column 6/.style={
nodes={fill=gray!15}
},
row 3 column 3/.style={
nodes={fill=gray!30}
},
row 4 column 4/.style={
nodes={fill=gray!30}
},
row 5 column 5/.style={
nodes={fill=gray!30}
},
row 6 column 6/.style={
nodes={fill=gray!30}
},
row 7 column 7/.style={
nodes={fill=gray!30}
}
}
}
\begin{tikzpicture}
\matrix (first) [table,text width=6em]
{
SO & $f(x,y,z)$ & & & & &\\
& AS & B
& C & D & & \\
2 & F & 3D & H & J&& \\
3 & A & B & DS & D&& \\
4 & F & G & H & 4D &&\\
5 & F & G & H & I & PS& \\
6 & F & G & H & I & & 4D\\
};
\end{tikzpicture}
\end{document}
But when I try and input more data into the cells, for example, like
I would like it resize(height) to fit the text, and adjust all the cells to have the same height and width. How should I go about that?
Also, Is there a way to have a small arrow going from AS -> B and from B -| 3D?