1

I am trying to program in TeX the following decision tree but I am facing some difficulties, especially with diagonal arrows.

Some suggestions or help is extremely appreciated!

enter image description here

3
  • 2
    Welcome to TeX.SE! What you try so far? – Zarko Aug 25 '20 at 12:26
  • Welcome to TeX.SX! Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – TobiBS Aug 25 '20 at 12:45
  • would this interest you -- tex.stackexchange.com/a/558838/197451 – js bibra Aug 25 '20 at 13:15
0

I would suggest using a vector graphics program such as: Inkscape (open source) or Adobe Illustrator (paid). Create there your desired drawing and then include it into LaTeX.

Maybe this can help you: Exporting from Inkscape to LaTeX - via TikZ

1
  • 1
    Thanks a lot for the help! – Anisa Vrenozi Aug 25 '20 at 13:17
0

Well, using forest package this can be drawn simple:

\documentclass[border=3mm]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta,
                quotes}

\begin{document}
    \begin{forest}
for tree = {
% nodes
    draw,
    minimum width=3em,
    math content,
% tree
    grow'=0,
%    parent anchor=east,
%    child  
    anchor=west,
    s sep = 12mm,
    l sep = 12mm,
%
if level = 0{circle,fill, minimum size=0pt, inner sep=2pt}
            {parent anchor=east, child anchor=west},
% edge
    edge = {semithick,-Stealth},
% edge labels
ELA/.style= {edge label={node [pos=0.5, inner sep=2pt,
                              font=\scriptsize\sffamily, sloped,
                              above] {$#1$}}
            },
ELB/.style= {edge label={node [pos=0.5, inner sep=2pt,
                              font=\scriptsize, sloped,
                              below] {$#1$}}
           },
tier/.option=level,     % for aligning nodes to levels
            }% end for tree
[,
    [II, ELA=a
        [A
            [IP, name=a1
                [S_H, name=a2, ELA=p_I
                    [R_H, name=a3, ELA=\lambda+\delta]
                ]
            ]
        ]
        [NA]
    ]
    [NI, ELB=1-a,
        [NA
            [CP, name=b1
                [S_L, name=b2, ELB=1-p_c
                    [R_L, name=b3]
                ]
            ]
        ]
    ]
]
\tikzset{every edge/.style = {draw, -Stealth, semithick},
         every edge quotes/.style = {pos=0.7, auto, sloped, font=\scriptsize}
         }
\draw   (b1) edge ["$p_c$"]     (a2)
        (b2) edge ["$\delta$"]  (a3)
        (a1) edge ["$1-p_I$"]     (b2)
        (a2) edge ["$1-\lambda-\delta$"]  (b3);
   \end{forest}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.