1

I am trying to draw a "not allowed" (big X) or "crossed out" (circle with slash) sign on some of the leaves as shown below:

Code:

\documentclass[12pt]{article}
\usepackage{istgame}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows.meta, positioning}

\begin{document}
    \begin{center}
        \begin{istgame}
            \setistNewNodeStyle{max}
            [regular polygon, regular polygon sides = 3]{1.5cm}
            \setistNewNodeStyle{min}
            [regular polygon, regular polygon sides = 3, shape border rotate = 180]{1.5cm}
            \setistNewNodeStyle{chance}
            [circle]{1.2cm}
            %\xtShowTerminalNodes[box node, minimum size = 1cm]
            \def\distFactor{20};
            \xtdistance{\distFactor mm}{4*\distFactor mm}
            \setxtarrowtips[blue, thick]
            \istroot(0)[max]<center, blue>{1.5}
            \istb[blue, ->-] \istb \endist
            \xtdistance{\distFactor mm}{2*\distFactor mm}
            \istroot(1)(0-1)[chance]<center, purple>{1.5}
            \istb{0.5}[al] \istb{0.5}[ar] \endist
            \istroot(2)(0-2)[chance]<center, purple>{$\leq 1$}
            \istb{0.5}[al] \istb{0.5}[ar] \endist
            \xtdistance{\distFactor mm}{\distFactor mm}
            \istroot(3)(1-1)[min]<center, red>{2}
            \istb{}{2} \istb{}{2} \endist
            \istroot(4)(1-2)[min]<center, red>{1}
            \istb{}{1} \istb{}{2} \endist
            \istroot(5)(2-1)[min]<center, red>{0}
            \istb{}{0} \istb{}{2} \endist
            \istroot(6)(2-2)[min]
            \istb{}{-1} \istb{}{0} \endist
            \draw ([yshift = -5pt]5-2) circle (3mm);
        \end{istgame}
    \end{center}
\end{document}

Output: enter image description here

Is there a way to draw either the X or the not allowed circular sign such that it is centered with the number on the leaf?

4

You can add a circle by telling istgame that this is to be circle node. And you can define a style for a crossed out circle. (A path picture would draw these on the background, which does not look good for colored texts, so I use append after command.) To make this work you then only have to say

\istb{}{2}[[ccross]below]

instead of

\istb{}{2}

Result:

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{istgame}
\tikzset{ccross/.style={circle,draw,yshift=2pt,
append after command={
(\tikzlastnode.south west) edge[thick] (\tikzlastnode.north east)
(\tikzlastnode.south east) edge[thick] (\tikzlastnode.north west)
}}}
\begin{document}
    \begin{center}
        \begin{istgame}
            \setistNewNodeStyle{max}
            [regular polygon, regular polygon sides = 3]{1.5cm}
            \setistNewNodeStyle{min}
            [regular polygon, regular polygon sides = 3, shape border rotate = 180]{1.5cm}
            \setistNewNodeStyle{chance}
            [circle]{1.2cm}
            %\xtShowTerminalNodes[box node, minimum size = 1cm]
            \def\distFactor{20};
            \xtdistance{\distFactor mm}{4*\distFactor mm}
            \setxtarrowtips[blue, thick]
            \istroot(0)[max]<center, blue>{1.5}
            \istb[blue, ->-] \istb \endist
            \xtdistance{\distFactor mm}{2*\distFactor mm}
            \istroot(1)(0-1)[chance]<center, purple>{1.5}
            \istb{0.5}[al] \istb{0.5}[ar] \endist
            \istroot(2)(0-2)[chance]<center, purple>{$\leq 1$}
            \istb{0.5}[al] \istb{0.5}[ar] \endist
            \xtdistance{\distFactor mm}{\distFactor mm}
            \istroot(3)(1-1)[min]<center, red>{2}
            \istb{}{2} \istb{}{2} \endist
            \istroot(4)(1-2)[min]<center, red>{1}
            \istb{}{1} \istb{}{2} \endist
            \istroot(5)(2-1)[min]<center, red>{0}
            \istb{}{0} \istb{}{2}[[ccross]below] \endist
            \istroot(6)(2-2)[min]
            \istb{}{-1} \istb{}{0} \endist
        \end{istgame}
    \end{center}
\end{document}

enter image description here

2
  • Got it. Actually, is there a way that this circle can be drawn such that it iss both centered across the 2 and that the circle’s edge touches the line? – Superman Apr 26 '20 at 4:05
  • 1
    @Superman Sure, changed that. – user194703 Apr 26 '20 at 4:08

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.