2

I can't seem to find an example online that adds text in between two nodes. I can find a few examples that add annotation to the left or right, but I'd like to add text along the connection between the concept and the child nodes. Example here:

\documentclass[12pt,letter,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{mindmap,backgrounds}
\begin{document}

\begin{figure}[t]
\begin{tikzpicture}[mindmap,
  level 1 concept/.append style={level distance=130,sibling angle=30},
  extra concept/.append style={color=blue!50,text=black}]
  \begin{scope}[mindmap, concept color=orange, text=white]
    \node [concept] {di}[clockwise from=-5] 
     child [level distance=150] {node [concept] (di3) {di3}}
      child [level distance=100] {node [concept] {di4}      
child [level distance=80, concept color=blue!50] {node [concept] (di1) {di1}}
 child [level distance=140, concept color=blue!50] {node [concept] (di2) {di2}}};
 \end{scope}
\end{tikzpicture}
\end{figure}
\end{document}

How do I add text between the concept node {di} and each child node?

0

1 Answer 1

3

Something likes this! Since it is a node structure, the proposal is to assign a internal label and use

\path (a)--node[sloped, <pos>, <above,below>]{<text>}(b);

enter image description here

Code

\documentclass[12pt,letter,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows}
\usetikzlibrary{mindmap,backgrounds,positioning}
\begin{document}

\begin{figure}[t]
\begin{tikzpicture}[mindmap,
  level 1 concept/.append style={level distance=130,sibling angle=30},
  extra concept/.append style={color=blue!50,text=black}]
  \begin{scope}[mindmap, concept color=orange, text=white]
    \node [concept](di) {di}[clockwise from=-5] 
     child [level distance=150] {node [concept] (di3) {di3}}
      child [level distance=150] {node [concept](di4) {di4}      
 child [level distance=80, concept color=blue!50] {node [concept] (di1) {di1}}
 child [level distance=140, concept color=blue!50] {node [concept] (di2) {di2}}};
 \path (di)--node[above=-1.5cm,black,sloped]{text}(di4);
 \path (di)--node[black,sloped]{text}(di3);
 \end{scope}
\end{tikzpicture}
\end{figure}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .