8

I can't seem to vertically align text in different nodeparts of the same node.

This MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}

\begin{tikzpicture}
\tikzstyle{bplus}=[rectangle split, rectangle split horizontal, rectangle split ignore empty parts,draw]
\tikzstyle{every node}=[bplus]
\node {\huge{I} \nodepart {two} \huge{h} \nodepart {three} \huge{g} \nodepart {four} \huge{x} } ;
\end{tikzpicture}

\end{document}

gives:

enter image description here

I'd like to have the text aligned on some baseline, preferably centred as if a complete word.

I tried

\begin{tikzpicture}[every node/.style = {anchor = base}] ...

amongst other things, but it didn't work.

badroit
  • 7,557
  • ...trying to adapt an example from here:
    http://tex.stackexchange.com/questions/17331/how-do-i-draw-a-b-tree-in-latex.  
    
    

    ...when I use variable height letters, it causes the above problems.

    – badroit Nov 24 '11 at 18:35

1 Answers1

8

Add the option rectangle split part align=base:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
\tikzstyle{bplus}=[rectangle split, rectangle split horizontal,
    rectangle split ignore empty parts, rectangle split part align=base,draw]
\tikzstyle{every node}=[bplus]
\node {\huge{I} \nodepart {two} \huge{h} \nodepart {three}
    \huge{g} \nodepart {four} \huge{x} } ;
\end{tikzpicture}
\end{document}

node parts with base alignment

Stefan Kottwitz
  • 231,401