
\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,
%%
every even row/.style={
nodes={fill=gray!20}
},
column 1/.style={
nodes={text width=2em,font=\bfseries}
},
row 1/.style={
nodes={
fill=black,
text=white,
font=\bfseries
}
}
}
}
\begin{tikzpicture}
\matrix (first) [table,text width=6em]
{
& Monday & Tuesday & Wednesday & Thursday & Friday\\
1 & A & B & C & D & E \\
2 & F & G & H & J & K \\
3 & A & B & C & D & E \\
4 & F & G & H & J & K \\
};
\end{tikzpicture}
\end{document}
What if I write to the first cell 'Monday is the first day of the day' instead of just monday?
I want the cell to adapt vertically, increasing the height of the whole row, to accomodate the text
How to do that?
minimum height=1.5em,and addrow 1 column 2/.style={nodes={text width=6em}}. But note that the options are parsed before the content so the height must be given anyhow. Or at least I don't see right away how to circumvent that. – percusse Mar 5 at 14:40