나는 다음과 같은 게임 트리를 만들었습니다: 내 코드는 다음과 같습니다.
\documentclass[leqno, oneside, 12pt]{book}
\usepackage{amsmath}
\usepackage{istgame}
\usepackage{caption}
\usepackage{makecell}
\begin{document}
\begin{figure}[ht]
\centering
\begin{istgame}[font=\footnotesize]
\xtdistance{30mm}{90mm}
\setxtinfosetstyle{dashed}
\xtShowEndPoints
\istroot[right](0)<above>{0}
\istbA{0.95}[above,sloped]
\istbA{0.05}[above,sloped]
\endist
\xtdistance{30mm}{30mm}
\istroot[right](1)(0-2)<above>{1.1}
\istbA{g_1\quad(\beta)}[above,sloped]
\istbA{f_1\quad(1-\beta)}[above,sloped]{0,0}
\endist
\xtOwner(1){\makecell{$\langle\alpha\rangle$}}[below]
\istroot[right](2)(0-1)<above>{1.1}
\istbA(2){g_1\quad(\beta)}[above,sloped]
\istbA{f_1\quad(1-\beta)}[above,sloped]{0,0}
\endist
\xtOwner(2){\makecell{$\langle1-\alpha\rangle$}}[below]
\istroot[right](3)(1-1)<above>{2.2}
\istbA{g_2\quad(\gamma)}[above,sloped]
\istbA{f_2\quad(1-\gamma)}[above,sloped]{-1,5}
\endist
\xtOwner(3){\makecell{$\langle1\rangle$}}[below]
\istroot[right](4)(3-1)<above>{1.3}
\istbA{g_3\quad(\epsilon)}[above,sloped]
\istbA{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\endist
\xtOwner(4){\makecell{$\langle\delta\rangle$}}[below]
\istroot[right](5)(2-1)<above>{1.3}
\istbA(2){g_3\quad(\epsilon)}[above,sloped]{8,8}
\istbA{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\endist
\xtOwner(5){\makecell{$\langle1-\delta\rangle$}}[below]
\istroot[right](6)(4-1)<above>{2.4}
\istbA{g_4\quad(\zeta)}[above,sloped]{8,8}
\istbA{f_4\quad(1-\zeta)}[above,sloped]{3,9}
\endist
\xtOwner(6){\makecell{$\langle1\rangle$}}[below]
\xtInfosetO(1)(2)(1.2cm)
\xtInfosetO(3)(3)(1.2cm)
\xtInfosetO(4)(5)(1.2cm)
\xtInfosetO(6)(6)(1.2cm)
\end{istgame}
\caption{}
\end{figure}
\end{document}
나는 위로 가는 모든 가지가 서로 평행하게 만들고, 아래로 가는 모든 가지도 서로 평행하게 만들고 싶습니다. (보시다시피 현재 하향 선은 평행하지 않습니다.) 한편 두 개의 1.1 노드도 정렬되어야 하고 두 개의 1.3 노드도 정렬되어야 합니다. 어떻게 해야 하나요? 어떤 도움이라도 정말 감사드립니다!
답변1
저는 이 패키지에 대해 잘 알지 못하지만 문서를 살펴보니 대안(또는 호)의 각도를 지정할 수 있는 방법이 없는 것 같습니다 \istbA
. 당신이 한 것처럼, 아이들의 확산을 지정하는 방법은 오직 하나뿐입니다.
\documentclass[tikz,margin=10pt]{standalone}
\usepackage{istgame}
\usepackage{makecell}
\begin{document}
\begin{istgame}
\xtdistance{30mm}{90mm}
\setxtinfosetstyle{dashed}
\xtShowEndPoints
\setistgrowdirection'{east}
\istroot(0)<above>{0}
\istbA{to:0-1}[above,sloped]
\istbA{to:0-2}[above,sloped]
\endist
\xtdistance{30mm}{30mm}
\istroot(1)(0-1)<above>{1}
\istbA{to:1-1}[above,sloped]{end}
\istbA{to:1-2}[above,sloped]
\endist
\xtOwner(1){\makecell{1label}}[below]
\istroot(2)(0-2)<above>{2}
\istbA{to:2-1}[above,sloped]{end}
\istbA(2){to:2-2}[above,sloped]
\endist
\xtOwner(2){\makecell{2label}}[below]
\istroot(3)(1-2)<above>{3}
\istbA{to:3-1}[above,sloped]{end}
\istbA{to:3-2}[above,sloped]
\endist
\xtOwner(3){\makecell{3label}}[below]
\istroot(4)(3-2)<above>{4}
\istbA{to:4-1}[above,sloped]{end}
\istbA{to:4-2}[above,sloped]
\endist
\xtOwner(4){\makecell{4label}}[below]
\istroot(5)(2-2)<above>{5}
\istbA{to:5-1}[above,sloped]{end}
\istbA(2){to:5-2}[above,sloped]{end}
\endist
\xtOwner(5){\makecell{5label}}[below]
\istroot(6)(4-2)<above>{6}
\istbA{to:6-1}[above,sloped]{end}
\istbA{to:6-2}[above,sloped]{end}
\endist
\xtOwner(6){\makecell{6label}}[below]
\xtInfosetO(1)(2)(1.2cm)
\xtInfosetO(3)(3)(1.2cm)
\xtInfosetO(4)(5)(1.2cm)
\xtInfosetO(6)(6)(1.2cm)
\end{istgame}
\end{document}
줄여서 \istb<missing>
or 를 사용하여 '실종' 아동을 추가하는 방법이 있습니다 . \istbm
불행하게도 각도가 어떻게 \istbA(<level>)
계산되는지 알기 어렵기 때문에 이러한 누락된 하위 항목을 추가하여 맨 아래 행을 정렬하는 것은 이 간단한 모델에서도 너무 지루한 작업이었습니다.
대신 대칭성을 타협하려는 경우 다음 솔루션을 제안합니다.
\documentclass[tikz,margin=10pt]{standalone}
\usepackage{istgame}
\usepackage{makecell}
\begin{document}
\begin{istgame}
\xtdistance{30mm}{60mm}
\setxtinfosetstyle{dashed}
\xtShowEndPoints
\setistgrowdirection'{east}
\istroot(0)<above>{0}
\istbA{to:0-1}[above,sloped]
\istbA{to:0-2}[above,sloped]
\endist
\xtdistance{30mm}{30mm}
\istroot(1)(0-1)<above>{1}
\istbA{to:1-1}[above,sloped]{end}
\istbA{to:1-2}[above,sloped]
\istbm
\endist
\xtOwner(1){\makecell{1label}}[below]
\istroot(2)(0-2)<above>{2}
\istbA{to:2-1}[above,sloped]{end}
\istbA(2){to:2-2}[above,sloped]
\istbm
\endist
\xtOwner(2){\makecell{2label}}[below]
\istroot(3)(1-2)<above>{3}
\istbA{to:3-1}[above,sloped]{end}
\istbA{to:3-2}[above,sloped]
\istbm
\endist
\xtOwner(3){\makecell{3label}}[below]
\istroot(4)(3-2)<above>{4}
\istbA{to:4-1}[above,sloped]{end}
\istbA{to:4-2}[above,sloped]
\istbm
\endist
\xtOwner(4){\makecell{4label}}[below]
\istroot(5)(2-2)<above>{5}
\istbA{to:5-1}[above,sloped]{end}
\istbA(2){to:5-2}[above,sloped]{end}
\istbm
\endist
\xtOwner(5){\makecell{5label}}[below]
\istroot(6)(4-2)<above>{6}
\istbA{to:6-1}[above,sloped]{end}
\istbA{to:6-2}[above,sloped]{end}
\istbm
\endist
\xtOwner(6){\makecell{6label}}[below]
\xtInfosetO(1)(2)(1.2cm)
\xtInfosetO(3)(3)(1.2cm)
\xtInfosetO(4)(5)(1.2cm)
\xtInfosetO(6)(6)(1.2cm)
\end{istgame}
\end{document}
다시 말하지만, 이것은 이상적이지는 않습니다. 그러나 귀하의 목표가 어떤 대가를 치르더라도 평행하다면 이것이 가능합니다. 확장을 위해 추가하거나 [scale=1.2]
유사한 것을 권장 \begin{istgame}
하지만 이는 개인 취향입니다. 아래 MWE에서 [right]
태그를 제거하고 \setistgrowdirection'{east}
대신 추가한 것을 볼 수 있습니다. 이는 적어도 제 생각에는 코드에서 노드를 위에서 아래로 정렬하는 것이 합리적이라고 생각합니다.
이것이 조금 도움이 되기를 바랍니다!
MWE:
\documentclass[tikz,margin=10pt]{standalone}
\usepackage{istgame}
\usepackage{makecell}
\begin{document}
\begin{istgame}
\xtdistance{30mm}{60mm}
\setxtinfosetstyle{dashed}
\xtShowEndPoints
\setistgrowdirection'{east}
\istroot(0)<above>{0}
\istbA{0.05}[above,sloped]
\istbA{0.95}[above,sloped]
\endist
\xtdistance{30mm}{30mm}
\istroot(1)(0-1)<above>{1.1}
\istbA{f_1\quad(1-\beta)}[above,sloped]{0,0}
\istbA{g_1\quad(\beta)}[above,sloped]
\istbm
\endist
\xtOwner(1){\makecell{$\langle\alpha\rangle$}}[below]
\istroot(2)(0-2)<above>{1.1}
\istbA{f_1\quad(1-\beta)}[above,sloped]{0,0}
\istbA(2){g_1\quad(\beta)}[above,sloped]
\istbm
\endist
\xtOwner(2){\makecell{$\langle1-\alpha\rangle$}}[below]
\istroot(3)(1-2)<above>{2.2}
\istbA{f_2\quad(1-\gamma)}[above,sloped]{-1,5}
\istbA{g_2\quad(\gamma)}[above,sloped]
\istbm
\endist
\xtOwner(3){\makecell{$\langle1\rangle$}}[below]
\istroot(4)(3-2)<above>{1.3}
\istbA{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\istbA{g_3\quad(\epsilon)}[above,sloped]
\istbm
\endist
\xtOwner(4){\makecell{$\langle\delta\rangle$}}[below]
\istroot(5)(2-2)<above>{1.3}
\istbA{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\istbA(2){g_3\quad(\epsilon)}[above,sloped]{8,8}
\istbm
\endist
\xtOwner(5){\makecell{$\langle1-\delta\rangle$}}[below]
\istroot(6)(4-2)<above>{2.4}
\istbA{f_4\quad(1-\zeta)}[above,sloped]{3,9}
\istbA{g_4\quad(\zeta)}[above,sloped]{8,8}
\istbm
\endist
\xtOwner(6){\makecell{$\langle1\rangle$}}[below]
\xtInfosetO(1)(2)(1.2cm)
\xtInfosetO(3)(3)(1.2cm)
\xtInfosetO(4)(5)(1.2cm)
\xtInfosetO(6)(6)(1.2cm)
\end{istgame}
\end{document}
답변2
\istb
을 사용하는 대신 사용하고 싶습니다 \istbA
.
\istbA(2)
다음으로 교체할 수도 있습니다.
\istbA(2)<grow=-27,level distance=67mm>
아니면 그냥 사용하기 위해
\istb<grow=-27,level distance=67mm>
.
이 변경을 통해 원하는 (대략적인) 결과를 얻을 수 있습니다.
\documentclass[leqno, oneside, 12pt]{book}
\usepackage{amsmath}
\usepackage{istgame}
\usepackage{caption}
\usepackage{makecell}
\begin{document}
\begin{figure}[ht]
\centering
\begin{istgame}[font=\footnotesize]
%%% some calculation:
\pgfmathparse{90-atan(30/15)}
\node(0,0)[draw,yshift=10mm]{\pgfmathresult};
\pgfmathparse{sqrt(30^2+15^2)}
\node(0,0)[draw,yshift=15mm]{\pgfmathresult};
%%% tree direction
\setistgrowdirection{east} %%% instead of using [right] in \istroot
%\setistgrowdirection'{east} %%% (swap version) looks more convenient
%%% \istb (instead of \istbA)
\xtdistance{30mm}{90mm}
\setxtinfosetstyle{dashed}
\xtShowEndPoints
\istroot(0)<above>{0}
\istb{0.95}[above,sloped]
\istb{0.05}[above,sloped]
\endist
\xtdistance{30mm}{30mm}
\istroot(1)(0-2)<above>{1.1}
\istb{g_1\quad(\beta)}[above,sloped]
\istb{f_1\quad(1-\beta)}[above,sloped]{0,0}
\endist
\xtOwner(1){\makecell{$\langle\alpha\rangle$}}[below]
\istroot(2)(0-1)<above>{1.1}
\istb<grow=-27,level distance=67mm>[blue,thick] %%% CHANGED
{g_1\quad(\beta)}[above,sloped]
\istb{f_1\quad(1-\beta)}[above,sloped]{0,0}
\endist
\xtOwner(2){\makecell{$\langle1-\alpha\rangle$}}[below]
\istroot(3)(1-1)<above>{2.2}
\istb{g_2\quad(\gamma)}[above,sloped]
\istb{f_2\quad(1-\gamma)}[above,sloped]{-1,5}
\endist
\xtOwner(3){\makecell{$\langle1\rangle$}}[below]
\istroot(4)(3-1)<above>{1.3}
\istb{g_3\quad(\epsilon)}[above,sloped]
\istb{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\endist
\xtOwner(4){\makecell{$\langle\delta\rangle$}}[below]
\istroot(5)(2-1)<above>{1.3}
\istb<grow=-27,level distance=67mm>[blue,thick] %%% CHANGED
{g_3\quad(\epsilon)}[above,sloped]{8,8}
\istb{f_3\quad(1-\epsilon)}[above,sloped]{4,4}
\endist
\xtOwner(5){\makecell{$\langle1-\delta\rangle$}}[below]
\istroot(6)(4-1)<above>{2.4}
\istb{g_4\quad(\zeta)}[above,sloped]{8,8}
\istb{f_4\quad(1-\zeta)}[above,sloped]{3,9}
\endist
\xtOwner(6){\makecell{$\langle1\rangle$}}[below]
\xtInfosetO(1)(2)(1.2cm)
\xtInfosetO(3)(3)(1.2cm)
\xtInfosetO(4)(5)(1.2cm)
\xtInfosetO(6)(6)(1.2cm)
\end{istgame}
\caption{}
\end{figure}
\end{document}