Skip to main content
correct basement alignment
Source Link
someonr
  • 8.7k
  • 1
  • 38
  • 68

Update thx for Qrrbrbirlbel noting that the baseline alignment wasn't right. So I used base left and base right as suggested.

Now it was necessary to use a coordinate like (wAB.east |- AB) to get horizontal lines (uses the x coordinate of wAB.east and the y coordiante of AB).

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { %node abc node (AB) {AB} %node AB child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} %node AC child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} %node A child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; %relative to node AB \draw\node[base node[left=left=.5 of AB] (wAB) {\uwave{$A,b$}}; \draw (wAB.east |- AB) edge[<-] (AB); \draw node[right=node[base right=.5 of AB] {$C$} edge[<-] (AB); %relative to node AC \draw\node[base node[left=left=.5 of AC] (wAC) {\uwave{$A,C$}} ; \draw (wAC.east |- AC) edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); %relative to node A \draw node[left=node[base left=.5 of A] {$BC$} edge[<-] (A); \draw\node[base node[right=right=.5 of A] (wBC) {\uwave{$B,C$}}; \draw (wBC.west |- A) edge[<-] (A); %relative to node abc \node[left=of\node[base left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw\node[base node[right=right=.5 of abc] (wABACBC) {\uwave{$AB,AC,BC$}}; \draw (wABACBC.west |- abc) edge[<-] (abc); \end{tikzpicture} \end{document} 

resultresult

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { %node abc node (AB) {AB} %node AB child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} %node AC child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} %node A child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; %relative to node AB \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); %relative to node AC \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); %relative to node A \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); %relative to node abc \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

Update thx for Qrrbrbirlbel noting that the baseline alignment wasn't right. So I used base left and base right as suggested.

Now it was necessary to use a coordinate like (wAB.east |- AB) to get horizontal lines (uses the x coordinate of wAB.east and the y coordiante of AB).

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { %node abc node (AB) {AB} %node AB child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} %node AC child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} %node A child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; %relative to node AB \node[base left=.5 of AB] (wAB) {\uwave{$A,b$}}; \draw (wAB.east |- AB) edge[<-] (AB); \draw node[base right=.5 of AB] {$C$} edge[<-] (AB); %relative to node AC \node[base left=.5 of AC] (wAC) {\uwave{$A,C$}} ; \draw (wAC.east |- AC) edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); %relative to node A \draw node[base left=.5 of A] {$BC$} edge[<-] (A); \node[base right=.5 of A] (wBC) {\uwave{$B,C$}}; \draw (wBC.west |- A) edge[<-] (A); %relative to node abc \node[base left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \node[base right=.5 of abc] (wABACBC) {\uwave{$AB,AC,BC$}}; \draw (wABACBC.west |- abc) edge[<-] (abc); \end{tikzpicture} \end{document} 

result

added 76 characters in body
Source Link
someonr
  • 8.7k
  • 1
  • 38
  • 68

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name. To get any amount of children simply add or remove child{ ... }. For more information please take a look at the tikz manual (especially "18 Making Trees Grow" and "16.5.3 Advanced Placement Options")

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { %node abc node (AB) {AB} %node AB child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} %node AC child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} %node A child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; %relative to node AB \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); %relative to node AC \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); %relative to node A \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); %relative to node abc \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name. To get any amount of children simply add or remove child{ ... }. For more information please take a look at the tikz manual

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { node (AB) {AB} child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name. To get any amount of children simply add or remove child{ ... }. For more information please take a look at the tikz manual (especially "18 Making Trees Grow" and "16.5.3 Advanced Placement Options")

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { %node abc node (AB) {AB} %node AB child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} %node AC child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} %node A child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; %relative to node AB \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); %relative to node AC \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); %relative to node A \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); %relative to node abc \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

add normalem to ulem package option
Source Link
someonr
  • 8.7k
  • 1
  • 38
  • 68

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name and. To get any amount of children simply add or remove child{ ... }. For more information please take a look at the tikz manual

For an example, you can get something likelook at this: tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage\usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { node (AB) {AB} child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name and you can get something like this:

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { node (AB) {AB} child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

You can use the positioning library to place nodes relative to each other. Like \node[left=<dimen/factor> of <another node>] {}. Just give the nodes inside your tree a name. To get any amount of children simply add or remove child{ ... }. For more information please take a look at the tikz manual

For an example, you can look at this tree (I tried to recreate your tree)

\documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{positioning} \usepackage[normalem]{ulem} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=4cm}, level 2/.style={sibling distance=2cm}] \node (abc) {$ABC$} child { node (AB) {AB} child { node {$A\rightarrow BC$} } child { node {$B\rightarrow AC$} } } child { node (AC) {AC} child { node {$A\rightarrow BC$} } child { node {$C\rightarrow AB$} } } child { node (A) {A} child { node {$B\rightarrow AC$} } child { node {$C\rightarrow AB$} } }; \draw node[left=.5 of AB] {\uwave{$A,b$}} edge[<-] (AB); \draw node[right=.5 of AB] {$C$} edge[<-] (AB); \draw node[left=.5 of AC] {\uwave{$A,C$}} edge[<-] (AC); \draw node[right=.5 of AC] {$B$} edge[<-] (AC); \draw node[left=.5 of A] {$BC$} edge[<-] (A); \draw node[right=.5 of A] {\uwave{$B,C$}} edge[<-] (A); \node[left=of abc] {$\uwave{\hspace{3ex}}=(k-1)-\mathrm{Itemsets}$} ; \draw node[right=.5 of abc] {\uwave{$AB,AC,BC$}} edge[<-] (abc); \end{tikzpicture} \end{document} 

result

Source Link
someonr
  • 8.7k
  • 1
  • 38
  • 68
Loading