# How do I draw a B+ tree with tikz in latex with more than 4 Key value pair in a node

I'm using

child {node {1 \nodepart{two} 2 \nodepart{three} 3 \nodepart{four} 4 \nodepart{five} 5 \nodepart{six} 7}}


to create a node in btree. However it seems that \nodepart{five} and \nodepart{six} get ignored and the rest gets cut off (KVP 5 and 6 do not show up).

How do I draw more than 4 KVPs?

-
Can you turn your code into a complete compilable example? – Alan Munn Jun 15 '11 at 0:57

When using multi-part nodes with the shapes.multipart library, the shape can be split into a maximum of twenty parts. However, only four boxes are allocated by default. To use the rectangle split shape with more than four boxes, the extra boxes must be allocated manually, and this can be done using the key rectangle split allocate boxes=<number>. A little example (a modification of an example in Section 48.6 Shapes with Multiple Text Parts of the pgfmanual):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}

\begin{document}

\begin{tikzpicture}[my shape/.style={
rectangle split, rectangle split parts=#1, draw, anchor=center}]
\node [my shape=5] at (0,1)
{a\nodepart{two}b\nodepart{three}c\nodepart{four}d\nodepart{five}e};
\node [my shape=10, rectangle split horizontal] at (3,2)
{1\nodepart{two}2\nodepart{three}3\nodepart{four}4\nodepart{five}5
\nodepart{six}6\nodepart{seven}7\nodepart{eight}8\nodepart{nine}9\nodepart{ten}10};
\end{tikzpicture}

\end{document}


-