I'm using the following code for the table. Currently it is set up so that I can change the width of all column (except the first one) to the same width. Can someone help me tweet it so that I can specify the column width every time I use it? Thank you.
\documentclass[twoside]{book}
\usepackage{tikz}
%%table
\usetikzlibrary{matrix}
\tikzset{
table/.style={
matrix of nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={
rectangle,
draw=gray!50,
align=center
},
minimum height=1.5em,
text depth=0.5ex,
text height=2ex,
nodes in empty cells,
%%
every odd row/.style={
nodes={fill=gray!05}
},
column 1/.style={
nodes={text width=5em,font=\bfseries}
},
row 1/.style={
nodes={
fill=gray!25,
text=black,
text height=2.5ex,
font=\bfseries, purple!75!black
}
}
}
}
\begin{document}
\begin{tikzpicture}
\matrix[table,text width=12em]
{
first & 2nd column & 3rd column\\
&A & B \\
& C & D \\
};
\end{tikzpicture}
\end{document}
I want to put this in the preamble, but that means I have to have the all the tables in the same document to the same width specified, as of now.
Thank you.
text width=4em
, the width of the table will be different. So what is the problem exactly?