2

I'm using TikZ for the first time and wanted to draw something that has a structure like this figure I created with drawio. my diagram

I looked up the templates at texample but didn't find anything suitable, can anyone give me like the basic instructions for this.

1
  • Welcome to TeX.SE! This is simple tree. What you try so far?
    – Zarko
    May 31, 2019 at 17:41

1 Answer 1

5

with pure tikz:

\documentclass[border=3mm,tikz,preview]{standalone}

\begin{document}
    \begin{tikzpicture}[
               box/.style = {draw, text width=24mm, align=center},
every label/.append style = {align=center},
sibling distance=28mm]
\node[box] {root node with two line text}
    child {node[box,label=left:{bla bla\\(1,1) and (12,12)}] {bla bla}
        child {node[box]  {bla bla\\ bla bla\\ bla}
        edge from parent node[left] {map}
              }
          }
    child {node[box] {bla bla}
        child {node[box] {bla bla\\ bla bla\\ bla}}
          };
    \end{tikzpicture}
\end{document}

enter image description here

with forest package:

\documentclass[border=3mm,preview]{standalone}
\usepackage{forest}

\begin{document}
    \begin{forest}
for tree={draw,
    text width = 24mm, text centered,
% style of tree (edges, distances, direction)
          grow = south,
         s sep = 4mm,
         }    
[root node with two line text
    [bla bla, label={[align=center]left:{bla bla\\(1,1) and (12,12)}},
        [bla bla\\ bla bla\\ bla\\ bla,
         edge label={node[midway,left,font=\scriptsize] {map}}]
    ]
    [bla bla
        [bla bla\\ bla bla\\ bla]
    ]
]
    \end{forest}
\end{document}

result is similar as before.

2
  • May I ask how to add text at the left of the arrows/lines.
    – Vajk
    May 31, 2019 at 18:06
  • I see some text beside your drawing, however it was no clear what this should be (labels of node? ). I will edit answer asap.
    – Zarko
    May 31, 2019 at 19:47

You must log in to answer this question.

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