# Multi-parts nodes in a matrix with tikz

Good evening (or morning, as you wish) everyone

I am using tikz and I encounter some little annoyance while using multi-parts nodes in a matrix. It may be trivial but I cannot find out why using multi-parts nodes in a matrix gets me some additionnal row :

\documentclass{standalone}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\usepackage{lmodern}
\usetikzlibrary{positioning,shapes.multipart, fit,backgrounds}

\begin{document}
\begin{tikzpicture}[every node/.style = {
shape=rectangle split, rectangle split parts=2}]

\node[matrix,draw,align=center]
{\node{
\nodepart{one}coucou
\nodepart{two}double coucou};&\node{recoucou};\\};

\end{tikzpicture}
\end{document}


Thanks for any explanation

• You defined, that ęvery node is multi part node. Your image show exactly what you define. – Zarko Oct 5 '15 at 19:40

The problem here is caused by your matrix-shaped node being, well, another node, so your every node/.style also applies to it. Either define a style for the multipart nodes and apply it to them or redefine the shape for the matrix, or use the nodes option for the matrix:

\documentclass{standalone}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{lmodern}
\usetikzlibrary{positioning,shapes.multipart, fit,backgrounds}

\begin{document}
\begin{tikzpicture}[every node/.style = {
shape=rectangle split, rectangle split parts=2}]
\node[matrix,draw,align=center,shape=rectangle,]
{\node{\nodepart{one}coucou\nodepart{two}double coucou};&\node{recoucou};\\
};
\begin{tikzpicture}[mynode/.style = {
shape=rectangle split, rectangle split parts=2}]
\node[matrix,draw,align=center]
{\node[mynode]{\nodepart{one}coucou\nodepart{two}double coucou};&\node[mynode]{recoucou};\\
};