Suppose I want to have a different format for the first column of a matrix of nodes compared to the rest of the nodes in the matrix. Using the column 1/.style=mycol
I can assign a style to that column, but no matter how I assign the styles, certain key settings for the column can't be overridden if they are set in the row.
For example, if I set rounded corners
or text depth
in the row, how can I subsequently make the column have sharp corners
other than setting it individually in each cell (as I did in row 2 in the example)?
I'm particularly interested in the text depth
key, since setting text depth
screws up the centring of text in the nodes, but I would like to have text depth
set in the rows but not in the first column. Is there a way to unset it?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\tikzset{
myrow/.style={align=center,minimum size=2cm,fill=#1,text width=2cm,anchor=center,
rounded corners,
% text depth=2cm
},
mycol/.style={sharp corners, align=center, minimum size=2cm,text width=2cm,anchor=center},
,column sep=.25cm,row sep=.25cm}
\begin{document}
\begin{tikzpicture}[
row 1/.style={nodes={myrow=red!80}},
row 2/.style={nodes={myrow=blue!60}},
column 1/.style={nodes={mycol}}]
\matrix[matrix of nodes]{
A title
& Some text
& More text
& Even more\\
|[sharp corners]|Another title
& Some text
& More text
& Even more\\
};
\end{tikzpicture}
\end{document}