I have the following code
\documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture}[cell/.style={rectangle,draw=black}, nodes in empty cells] \matrix[ matrix of math nodes, row sep =-\pgflinewidth, column sep = -\pgflinewidth, nodes={anchor=center, minimum width=2cm, cell}, column 1/.style = {nodes={minimum width=2cm}}, row 1/.style = {nodes={text height=1.3ex, text depth=0}}, row 2/.style = {text height=1.3ex, text depth=0}, row 3/.style = {text height=1.3ex, text depth=0}, row 4/.style = {text height=1.3ex, text depth=0}, row 5/.style = {text height=1.3ex, text depth=0}, row 6/.style = {text height=1.3ex, text depth=0}, ] (m) { \\ \\ \\ i \mapsto 5 \\ \\ \\ }; \end{tikzpicture} It produces this matrix:
Does anyone know how to remove all the inner row separators (or color them white to do not change the height)? I just want to keep the text surrounded by the big rectangle.
Edit 1:
I followed the first solution of the first comment (remove draw from the cell style options and use it for the \matrix), and tried to fill it with color by changing to column 1/.style = {nodes={minimum width=2cm, fill=purple}},, it shows the follows. However, I would like the background color to fill the entire rectangle.
The reason why I insist using matrix for this, is because this tikz picture will be aligned with other pictures having matrix (6 rows, height=1.3ex). I want them to have the same height. That's why I think maybe changing the color of row separators to white may be a good solution...
Edit 2:
I think I need to make my need clearer... Here is the code which produces 2 matrixes side by side. The matrix on the left side is a reference matrix; the one on the right side follows the solution of the first comment. I just want to make them to have the same height: one has inner row separates, the other does not have them and is filled by purple.
\begin{frame} \begin{tikzpicture}[cell/.style={rectangle,draw=black}, nodes in empty cells] \matrix[ matrix of math nodes, row sep =-\pgflinewidth, column sep = -\pgflinewidth, nodes={anchor=center, minimum width=2cm, cell}, column 1/.style = {nodes={minimum width=1.5cm}}, row 1/.style = {nodes={text height=1.3ex, text depth=0}}, row 2/.style = {text height=1.3ex, text depth=0}, row 3/.style = {text height=1.3ex, text depth=0}, row 4/.style = {text height=1.3ex, text depth=0}, row 5/.style = {text height=1.3ex, text depth=0}, ] (m) { \\ \\ i \mapsto 5 \\ \\ \\ }; \end{tikzpicture} \begin{tikzpicture}[cell/.style={rectangle}, nodes in empty cells] \matrix[ matrix, fill=purple, matrix of math nodes, row sep =-\pgflinewidth, column sep = -\pgflinewidth, nodes={anchor=center, minimum width=2cm, cell}, column 1/.style = {nodes={minimum width=1.5cm}}, row 1/.style = {nodes={text height=1.3ex, text depth=0}}, row 2/.style = {text height=1.3ex, text depth=0}, row 3/.style = {text height=1.3ex, text depth=0}, row 4/.style = {text height=1.3ex, text depth=0}, row 5/.style = {text height=1.3ex, text depth=0}, ] (m) { \\ \\ i \mapsto 5 \\ \\ \\ }; \end{tikzpicture} \end{frame} 



