You could use the option midway
, like so:
\edge node[midway,left] {$[b]$};
Code
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[every tree node/.style={draw,circle},
level distance=1.25cm,sibling distance=1cm,
edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}]
\Tree
[.a
\edge node[auto=right] {$[a]$};
[.b
\edge node[midway,left] {$[b]$};
[.1 ]
\edge node[midway,right] {$[b]$};
[.2 ]
]
\edge node[auto=left] {$[a]$};
[.c
\edge node[midway,left] {$[c]$};
[.3 ]
\edge node[midway,right] {$[c]$};
[.4 ]
]
]
\end{tikzpicture}
\end{document}
Result
This is a variant of Ignasi's answer. It uses a new package based on forest
. The advantage is that the lines are automatically numbered, the justifications are added as annotations with their nodes using the key just
(no need for a separate tree) and the vertical spacing between lines which should be grouped together (as when listing assumptions) is corrected automatically. In addition, styles are provided to move nodes (move by
) to lower lines in the tree without the need to set special tier
names or enter empty nodes. Cross-referencing support is provided in justifications and closure annotations (using either named nodes or relative node names), so that line numbers need not be hard-coded. Further options and details are explained in the package documentation.
\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage{prooftrees,amsmath,turnstile}
\newcommand*{\tnot}{\ensuremath{\mathord{\sim}}}
\begin{document}
\begin{prooftree} % uses Ignasi's code for the main tree (https://tex.stackexchange.com/a/233576/)
{
to prove={(\exists x)Fx \supset (\forall x)Fx \sststile{}{} (\forall x) (Fx \supset (\forall y) Fy)}
}
[(\exists x) Fx \supset (\forall x) Fx, checked, just=SM, name=pr
[\tnot (\forall x) (Fx \supset (\forall y) Fy), checked, grouped, just=SM
[(\exists x) \tnot (Fx \supset (\forall y) Fy), checked=a, just={$\tnot\forall$D:!u}
[\tnot (Fa \supset (\forall y) Fy), checked, just={$\exists$D:!u}
[Fa, just={$\tnot\supset$D:!u}, name=fa
[\tnot (\forall y) Fy, checked, grouped, just={$\tnot\supset$D:!uu}
[(\exists y) \tnot Fy, checked=b, just={$\tnot\forall$D:!u}
[\tnot Fb, just={$\exists$D:!u}, name=nofb
[\tnot (\exists x) Fx, checked, just={$\supset$D:pr}
[(\forall x) \tnot Fx, subs=a, just={$\tnot\exists$D:!u}
[\tnot Fa, close={:fa,!c}, just={$\forall$D:!u}
]
]
]
[(\forall x) Fx, subs=b
[Fb, close={:nofb,!c}, just={$\forall$D:!u}, move by=2
]
]
]
]
]
]
]
]
]
]
\end{prooftree}
\end{document}
Best Answer
You can use the
edge from parent
style. A compete example:The result:
Changing to
latex
arrow tips and adding red color: