# split a node into 3 parts

I want to split a node into 3 parts: firstly split it vertically equally, then split the bottom one into 2 box horizontally and equally.

What's the best solution for such case in tikz? Maybe we can just draw 3 box and align it carefully but the align task seems difficult for me:)

Below is a test code but it seems B and C not align bottom of A and not split equally:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath,bm,times}

\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}

\begin{document}
\tikzstyle{box}=[draw, fill=pink!10, minimum width=5em,

\begin{tikzpicture}[node distance=0cm,outer sep = 0pt]
\node (A) [box,text width=10em] {A};
\node (B) [box,below= of A.south west,anchor=west] {B};
\node (C) [box,below= of A.south east,anchor=east] {C};
\end{tikzpicture}
\end{document}


The output picture looks like below:

• Welcome to TeX.sx! If you happen to need a circular node, see tex.stackexchange.com/questions/58993/… – Torbjørn T. Jan 3 '14 at 16:31
• Using anchor=north west for B and anchor=north east for C will move B and C down. But to fill the whole length you need to calculate how wide to make them, $0.5*(A.west) - 0.5*(A.east)$ – John Kormylo Jan 3 '14 at 17:23

Fixed with minimal modification:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath,bm,times}

\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}

\begin{document}
\tikzstyle{box}=[draw, fill=pink!10, minimum width=5em,

\begin{tikzpicture}[node distance=0cm,outer sep = 0pt]
\node (A) [box,minimum width=10em] {A};
\node (B) [box,anchor=north west,minimum width=5em] at (A.south west) {B};
\node (C) [box,anchor=north east,minimum width=5em] at (A.south east) {C};
\end{tikzpicture}
\end{document}


problem with your solution is that you want to control the size of the box which correspond to minimum width, but you instead use text width which controls the size of the content text rather than the box. Hence, the text width was padded by inner sep. Node (B) and (C) actually has the same size, but (C) was overlapping (B).

Perfect,great suggestion from all of you!

Below is a summarized version which correctly resolved my question:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath,bm,times}

\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}

\begin{document}
\tikzset{box/.style={draw, fill=pink!10, minimum width=5em,
text centered, minimum height=2.5em,inner sep=0pt}}

\newcommand{\trinode}[4] {%
\node (#1) [box,minimum width=#4] {#1};
\node (#2) [box,minimum width=0.5*#4,below=of #1.south west,
anchor=north west] {#2};
\node (#3) [box,minimum width=0.5*#4,below=of #1.south east,
anchor=north east] {#3};
}

\begin{tikzpicture}[node distance=0cm,outer sep = 0pt]
\trinode{A}{BBBB}{CCCC}{10em};
\def\dx{2cm}
\draw [red,shorten >=-\dx,shorten <=-.1*\dx] (A.south) -- (A.north);
\end{tikzpicture}
\end{document}


The final output looks like below: