Text Formatting ⇒ tikz-qtree | Label midway between Nodes
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
tikz-qtree | Label midway between Nodes
Is it possible to label an arrow from one node to another, so that text appears midway?
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
tikz-qtree | Label midway between Nodes
Generally, I would use an edge with a node which contains the text. How it could be made, depends on your code. Perhaps post a
minimal working example.
Stefan

Stefan
LaTeX.org admin
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
tikz-qtree | Label midway between Nodes
Isn't it difficult to get o n e curved line with your solution?
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\noindent\makebox[\textwidth]{
\begin{tikzpicture}
%\tikzset{every tree node/.style={align=center,anchor=north}}
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}}}
\tikzset{every tree node/.style={font=\greekfont,align=center,anchor=north}}
\tikzset{level distance=45pt}%,sibling distance=0pt}
\XeTeXinterchartokenstate=0
\baselineskip=0pt
\Tree [ .{ψυχή} [ .{ἄλογον} {θρεπτικόν,\\φυτικόν} [ .{(ἔχον (2))\\ὀρεκτικόν} [ .{παρά} {ἐπιθυμητικόν} {θυμητικόν} ] [ .{ἔχον (2)\\\scil ἀκουστικόν} {βουλητικόν} \node(pr){προαιρεκτικόν}; ] ] ] [ .{ἔχον} \node(lgst){λογιστικόν,\\βουλευτικόν}; {ἐπιστημονικόν} ] ]
\draw[<-] (pr)..controls +(south east:3) and +(south:1) .. (lgst);
\end{tikzpicture}}
\end{document}
- Attachments
-
- example.jpg (22.46 KiB) Viewed 7233 times
Last edited by Stefan Kottwitz on Mon Apr 16, 2012 8:27 pm, edited 1 time in total.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
tikz-qtree | Label midway between Nodes
What do you mean? I don't understand.Laurentius wrote:Isn't it difficult to get o n e curved line with your solution?
Regarding labels, you could explicitly place an edge command in your tree, such as
Code: Select all
\edge node[auto=right]{1}; text
Stefan
LaTeX.org admin
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
tikz-qtree | Label midway between Nodes
Sorry! here is a more minimal example:
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\noindent\makebox[\textwidth]{
\begin{tikzpicture}
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}}}
\tikzset{every tree node/.style={align=center,anchor=north}}
\tikzset{level distance=40pt}%,sibling distance=0pt}
\baselineskip=0pt
\Tree [ .{a} [ .{x} {b,\\c} [ .{d\\f} [ .{d} {d} {f} ] [ .{g} {d} \node(pr){gs}; ] ] ] [ .{dsfg} \node(lgst){asdf}; {sdg} ] ]
\draw[<-] (pr)..controls +(east:1) and +(south:1) .. (lgst);
\end{tikzpicture}}
\end{document}
Last edited by Stefan Kottwitz on Tue Apr 17, 2012 12:04 am, edited 1 time in total.
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
Re: tikz-qtree | Label midway between Nodes
What I mean is that I want text by the edge of the drawn, curved line from node to node.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
tikz-qtree | Label midway between Nodes
Just insert a node in the path:
Stefan
Code: Select all
\draw[<-] (pr)..controls +(east:1) and +(south:1) .. (lgst)
node[midway,right] {\scriptsize here};
LaTeX.org admin
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
Re: tikz-qtree | Label midway between Nodes
Danke, Stefan!