With TikZ, is it possible to split a node horizontally and vertically?
As far as I know, this is not possible out of the box. But you can draw the individual node
s and then draw the lines. Even better, as per JLDiaz's idea, you can put it as a pic
.
\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{shapes,fit}
\tikzset{
pics/vhsplit/.style n args = {3}{
code = {
\node[text width=2cm] (A) at (0,0) {#1};
\node[anchor=south west,text width=2cm] (B) at (A.east) {#2};
\node[anchor=north west,text width=2cm] (C) at (A.east){#3};
\node[inner sep=0pt,draw,rounded corners,fit=(A)(B)(C)] {};
\draw (B.north west) -- (C.south west)
(B.south west) -- (C.north east);
}
}
}
\begin{document}
\begin{tikzpicture}%[every node/.append style={draw, rounded corners, inner sep=10pt}]
\path pic (a) {vhsplit={Some}{Text}{comes here}};
\end{tikzpicture}
\end{document}
I am posting this as a matter of record. I had to solve a very similar problem which allowed for text of arbitrary length in all three fields, particularly on the left. There are some extras in this code merely to show the possibilities.
\documentclass{article}
\usepackage{tikz}
\usepackage[papersize={5.5in,8.5in},margin=0.6in,bottom=0.7in]{geometry}
\usepackage{xparse}
\newsavebox{\linetmp}
\usetikzlibrary{fit,shapes.multipart,positioning}
\NewDocumentCommand{\threepart}{mmm}{%
\begin{tikzpicture}
\node (L) {%
\sbox{\linetmp}{#1}%
\ifdim\wd\linetmp<2in%% Fit on one line?
\bfseries\centering#1
\else
\parbox{2in}{\rightskip0pt plus 3em\strut#1\strut}
\fi
};
\node[rounded corners,
rectangle split,
rectangle split parts=2,
text width=2in,
align=center,
right= 0pt of L.east] (R) {%
\bfseries\strut#2\strut
\nodepart{two}\itshape\strut#3\strut};
\draw[thick] (R.text split east) -- (R.text split west);
\node[inner sep=0pt,
draw,
thick,
rounded corners,
fit=(L)(R)] (W) {};
\draw[thick] (W.south west -| R.west) -- (W.north west -| R.west);
\end{tikzpicture}%
}
\begin{document}
\noindent
\threepart{Services}{Event Driven Framework}{OS Adapter Layer}
\bigskip
\noindent
\threepart{Some very long text in the left field}{Some very long text in the upper right field}{Some very long text in the lower right field}
\end{document}