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.

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

  • 3
    pgfmanual 2.10 cvs 52.6 Shapes with Multiple Text Parts page 497 ! – Alain Matthes Nov 24 '11 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.