How come the horizontal split seems not to work whereas the vertical one does ?
\documentclass[12pt,standalone]{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary {shapes.multipart}
\begin{tikzpicture}[my shape/.style={rectangle split horizontal , rectangle split parts=#1, draw}]
\node [my shape=2]
{a \nodepart{two} b };
\end{tikzpicture}
\begin{tikzpicture}[my shape/.style={ rectangle split , rectangle split parts=#1, draw}]
\node [my shape=2]
{a \nodepart{two} b };
\end{tikzpicture}
\end{document}
You are missing rectangle split
in your horizontal node:
\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary {shapes.multipart}
\begin{tikzpicture}[my shape/.style={
rectangle split,
rectangle split horizontal ,
rectangle split parts=#1,
draw
}]
\node [my shape=2]
{a \nodepart{two} b };
\end{tikzpicture}
\begin{tikzpicture}[my shape/.style={ rectangle split , rectangle split parts=#1, draw}]
\node [my shape=2]
{a \nodepart{two} b };
\end{tikzpicture}
\end{document}