[Tex/LaTex] How to 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?

Best Answer

When using multi-part rectangular 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 first, and this can be done using the key rectangle split parts=<number>.

A little example: on the left the wrong result (only the default four parts are shown and the last two are lost); on the right, the correct output (after using rectangle split parts=6):



\node[draw,rectangle split] 
  at (0,0)
\node[draw,rectangle split,rectangle split parts=6] 
  at (2,0)


enter image description here