topnush
I have the following MWE:
```
\documentclass[]{beamer}
\usepackage{tikz}
\tikzset{
% Set distances between levels and siblings
level distance=1.5cm, % Adjusted for potentially shallow trees
level 1/.style={sibling distance=3cm}, % Adjusted sibling distance
level 2/.style={level distance=1.5cm, sibling distance=1.8cm},
% Default node style
every node/.style={font=\Large\bfseries},
% Basic style for text inside nodes
tnode/.style={text=blue!80!black, align=center}, % align=center can help
% Node styles based on number of keys (no split)
onenode/.style={tnode, circle, draw, thick, minimum size=2.5em, inner sep=1pt},
multinode/.style={tnode, shape=rectangle, draw, thick, rounded corners, inner sep=4pt, minimum height=1.8em}, % Common style for 2/3 nodes
twonode/.style={multinode, minimum width=4.2em}, % Adjusted width for two numbers
threenode/.style={multinode, minimum width=6em}, % Adjusted width for three numbers
% Default edge style
edge from parent/.style={draw, thick},
% Style for dummy leaves
dummy/.style={circle, fill=black, inner sep=0pt, minimum size=6pt},
% Style for the dummy leaf level (short edges)
dummy level/.style={level distance=0.6cm, sibling distance=0.6cm}, % Short level distance, close siblings
dummy edge/.style={draw, thin} % Thinner edge for dummy connections
}
\begin{document}
\begin{frame}[plain]
\begin{tikzpicture}
\node[onenode] {2}
child { node[onenode] {1} % Leaf node
child[dummy level] { node[dummy] {} edge from parent[dummy edge] }
child[dummy level] { node[dummy] {} edge from parent[dummy edge] }
}
child { node[twonode] {3\ 4} % Leaf node
child[dummy level] { node[dummy] {} edge from parent[dummy edge] }
child[dummy level] { node[dummy] {} edge from parent[dummy edge] }
child[dummy level] { node[dummy] {} edge from parent[dummy edge] }
};
\end{tikzpicture}
\end{frame}
\end{document}
```
This gives:

I would like the rightmost edges of the "3 4" node to start to the right of the 4 and the edge going into the "3 4" leaf from "2" to touch the "3 4" node exactly in the middle between the 3 and the 4. Similarly I would like the leftmost edge from that node to start to the left of the 3.
Along the same vein, I would like the leftmost edge from the "1" node to be seen as an extension of the edge from "2" to "1".
I have drawn an image of what I mean. For the "1" node I have drawn a straight line through it to show where its left child should be.

Cross-posted to https://tex.stackexchange.com/q/742082/5283
Top Answer
samcarter
- To get the edge below `1` in line with the edge above, you could add an invisible (`missing`) child
- to get fine control over the exact place where the edge meeds the `3 4` node, you can use the `edge from parent path={(\tikzparentnode) -- (\tikzchildnode.north)}` option. Replace `north` with the exact anchor where the edge should meet the node. This can also be an angle, e.g. `\tikzchildnode.60`.
```
\documentclass[]{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}
\tikzset{
% Set distances between levels and siblings
level distance=1.5cm, % Adjusted for potentially shallow trees
level 1/.style={sibling distance=3cm}, % Adjusted sibling distance
level 2/.style={level distance=0.6cm, sibling distance=0.6cm},
% Default node style
every node/.style={font=\Large\bfseries},
% Basic style for text inside nodes
tnode/.style={text=blue!80!black, align=center}, % align=center can help
% Node styles based on number of keys (no split)
onenode/.style={tnode, circle, draw, thick, minimum size=2.5em, inner sep=1pt},
multinode/.style={tnode, shape=rectangle, draw, thick, rounded corners, inner sep=4pt, minimum height=1.8em}, % Common style for 2/3 nodes
twonode/.style={multinode, minimum width=4.2em}, % Adjusted width for two numbers
}
\begin{document}
\begin{frame}[plain]
\begin{tikzpicture}
\node[onenode] {2}
child { node[onenode] {1} % Leaf node
child {[fill] circle (2pt)}
child[missing] { }
child {[fill] circle (2pt)}
}
child[
edge from parent path={(\tikzparentnode) -- (\tikzchildnode.north)}
] { node[twonode] {3\ 4}
child {[fill] circle (2pt)}
child {[fill] circle (2pt)}
child {[fill] circle (2pt)} edge from parent [black]
};
\end{tikzpicture}
\end{frame}
\end{document}
```
