如何将圆形节点置于终端支付值的中心?

如何将圆形节点置于终端支付值的中心?

我试图在一些叶子上画一个“不允许”(大 X)或“划掉”(带斜线的圆圈)的标志,如下所示:

代码:

\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}

输出: 在此处输入图片描述

有没有办法绘制 X 或不允许的圆形符号,使其位于叶子上的数字的中心?

答案1

istgame您可以通过指定这是圆形节点来添加圆形。您还可以定义划掉的圆形样式。(路径图片会在背景上绘制这些,这对于彩色文本来说看起来不太好,所以我使用append after command。)要使它工作,您只需说

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

代替

\istb{}{2}

结果:

\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}

在此处输入图片描述

相关内容