| 1 |
%% file: istgame.sty |
| 2 |
%% |
| 3 |
%% Drawing Game Trees with TikZ |
| 4 |
%% |
| 5 |
%% (C) Copyright 2015-2026 In-Sung Cho <ischo at ktug.org> |
| 6 |
%% |
| 7 |
%% This work may be distributed and/or modified |
| 8 |
%% under the conditions of the LaTeX Project Public License, |
| 9 |
%% either version 1.3c of this license or (at your option) any later version. |
| 10 |
%% The latest version of this license is in |
| 11 |
%% http://www.latex-project.org/lppl.txt. |
| 12 |
%% |
| 13 |
%% ------------------------------------------------- |
| 14 |
\ProvidesPackage{istgame}[2026/05/26 v2.1.1 Draw Game Trees with TikZ] |
| 15 |
|
| 16 |
% expl3,xparse: LPPL |
| 17 |
% tikz: LPPL and/or GNU GPL |
| 18 |
\RequirePackage{expl3,xparse,tikz} |
| 19 |
\usetikzlibrary |
| 20 |
{ |
| 21 |
trees , calc , arrows , shapes , positioning , |
| 22 |
backgrounds , % for information sets and subgames |
| 23 |
fit , % for \xtSubgameBox(Oval) |
| 24 |
decorations.markings , % for \xtShowArrows and middle arrows |
| 25 |
patterns , intersections , % for additional use |
| 26 |
arrows.meta , bending % added in version 2.1 |
| 27 |
} |
| 28 |
|
| 29 |
% backgrounds |
| 30 |
\pgfdeclarelayer{background} |
| 31 |
\pgfdeclarelayer{behind} |
| 32 |
\pgfdeclarelayer{above} |
| 33 |
\pgfdeclarelayer{foreground} |
| 34 |
|
| 35 |
\pgfsetlayers{background,behind,main,above,foreground} |
| 36 |
|
| 37 |
|
| 38 |
%% prefixes for macros and defaults |
| 39 |
% \ist<...> stands for "an insung's simple tree" (or "it's a simple tree") |
| 40 |
% \xt<...> stands for "extensive tree" |
| 41 |
% \xtCI stands for "curved information set" |
| 42 |
% \cntm<...> stands for "continuum" |
| 43 |
% \cntmA<...> stands for "continuum arc" |
| 44 |
% \istdefault@<...> |
| 45 |
% \xtdefault@<...> |
| 46 |
% \xtCI@default@<...> |
| 47 |
% \cntm@default@<...> |
| 48 |
% \cntmA@default@<...> |
| 49 |
|
| 50 |
|
| 51 |
%% node styles |
| 52 |
|
| 53 |
\ExplSyntaxOn |
| 54 |
|
| 55 |
% basics (in node styles) |
| 56 |
\def\istdefault@node@innersep{1pt} %% default node inner sep |
| 57 |
\def\istdefault@node@outersep{0pt} %% default node outer sep |
| 58 |
\def\istdefault@node@drawcolor{black} %% default node color |
| 59 |
\def\istdefault@node@fillcolor{white} %% default node background color |
| 60 |
% (can be used in preamble) |
| 61 |
\newcommand*\setistdefaultnodeinnersep[1]{\renewcommand*\istdefault@node@innersep{#1}} |
| 62 |
\newcommand*\setistdefaultnodeoutersep[1]{\renewcommand*\istdefault@node@outersep{#1}} |
| 63 |
\newcommand*\setistdefaultnodefillcolor[1]{\renewcommand*\istdefault@node@fillcolor{#1}} |
| 64 |
\newcommand*\setistdefaultnodedrawcolor[1]{\renewcommand*\istdefault@node@drawcolor{#1}} |
| 65 |
|
| 66 |
% plain node: definition |
| 67 |
\newcommand*\istplainnodeinnersep { \istdefault@node@innersep } % 1pt by default |
| 68 |
\newcommand*\istplainnodeoutersep { \istdefault@node@outersep } % 0pt by default |
| 69 |
|
| 70 |
% {inner sep} {outer sep} |
| 71 |
\NewDocumentCommand \setistPlainNodeStyle |
| 72 |
{ G{\istdefault@node@innersep} G{\istdefault@node@outersep} } |
| 73 |
{ |
| 74 |
\renewcommand*\istplainnodeinnersep {#1} % 1pt by default |
| 75 |
\renewcommand*\istplainnodeoutersep {#2} % 0pt by default |
| 76 |
} |
| 77 |
\tikzset{ plain~node /.style = |
| 78 |
{ |
| 79 |
draw = none , |
| 80 |
inner~sep = \istplainnodeinnersep , outer~sep = \istplainnodeoutersep |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
% null node: definition |
| 85 |
\newcommand*\istnullnodedrawcolor { \istdefault@node@drawcolor } % (#1) black |
| 86 |
\def\istdefault@null@nodesize { .2pt } % default of (#2) |
| 87 |
\def\istdefault@null@node@fillcolor { \istnullnodedrawcolor } % fill color = draw color |
| 88 |
\newcommand*\istnullnodesize { \istdefault@null@nodesize } % (#2) |
| 89 |
\newcommand*\istnullnodefillcolor { \istdefault@node@drawcolor } % (#3) <= black (o.k.) |
| 90 |
\newcommand*\istnullnodefillopacity { 1 } % (#4) |
| 91 |
|
| 92 |
% [draw color] {minimum size} [fill color] [fill opacity] |
| 93 |
\NewDocumentCommand \setistNullNodeStyle |
| 94 |
{ O{\istdefault@node@drawcolor} G{\istdefault@null@nodesize} O{\istdefault@null@node@fillcolor} O{1} } |
| 95 |
{ |
| 96 |
\renewcommand*\istnullnodedrawcolor{#1} |
| 97 |
\renewcommand*\istnullnodesize{#2} % .2pt by default |
| 98 |
\IfNoValueTF {#3} |
| 99 |
{ |
| 100 |
\renewcommand*\istnullnodefillcolor{#1} % same as {#1} with default black |
| 101 |
} |
| 102 |
{ |
| 103 |
\renewcommand*\istnullnodefillcolor{#3} |
| 104 |
} |
| 105 |
\renewcommand*\istnullnodefillopacity{#4} |
| 106 |
} |
| 107 |
\tikzset{ null~node /.style = |
| 108 |
{ |
| 109 |
circle , draw , thin , solid , |
| 110 |
inner~sep = 0pt , outer~sep = \istdefault@node@outersep , |
| 111 |
minimum~size = \istnullnodesize , |
| 112 |
draw = \istnullnodedrawcolor , |
| 113 |
fill = \istnullnodedrawcolor , |
| 114 |
fill~opacity = \istnullnodefillopacity |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
% solid node: definition |
| 119 |
\newcommand*\istsolidnodedrawcolor { \istdefault@node@drawcolor } % (#1) black |
| 120 |
\def\istdefault@solid@node@size { 2.4pt } % default of (#2) |
| 121 |
\def\istdefault@solid@node@fillcolor { \istsolidnodedrawcolor } |
| 122 |
\newcommand*\istsolidnodesize { \istdefault@solid@node@size } % (#2) |
| 123 |
\newcommand*\istsolidnodefillcolor { \istdefault@solid@node@fillcolor } % (#3) <= black (o.k.) |
| 124 |
\newcommand*\istsolidnodefillopacity { 1 } % (#4) |
| 125 |
|
| 126 |
% [draw color] {minimum size} [fill color] [fill opacity] |
| 127 |
\NewDocumentCommand \setistSolidNodeStyle |
| 128 |
{ O{\istdefault@node@drawcolor} G{\istdefault@solid@node@size} O{\istdefault@solid@node@fillcolor} O{1} } |
| 129 |
{ |
| 130 |
\renewcommand*\istsolidnodedrawcolor{#1} |
| 131 |
\renewcommand*\istsolidnodesize{#2} |
| 132 |
\IfNoValueTF {#3} |
| 133 |
{ |
| 134 |
\renewcommand*\istsolidnodefillcolor{#1} % same as {#1} with default black |
| 135 |
} |
| 136 |
{ |
| 137 |
\renewcommand*\istsolidnodefillcolor{#3} |
| 138 |
} |
| 139 |
\renewcommand*\istsolidnodefillopacity{#4} |
| 140 |
} |
| 141 |
\tikzset{ solid~node /.style = |
| 142 |
{ |
| 143 |
circle , draw , thin , solid , |
| 144 |
inner~sep = 0pt , outer~sep = \istdefault@node@outersep , |
| 145 |
minimum~size = \istsolidnodesize , |
| 146 |
draw = \istsolidnodedrawcolor , |
| 147 |
fill = \istsolidnodefillcolor , |
| 148 |
fill~opacity = \istsolidnodefillopacity |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
% decision node & terminal node |
| 153 |
\let\setistDecisionNodeStyle\setistSolidNodeStyle |
| 154 |
\let\setistTerminalNodeStyle\setistSolidNodeStyle |
| 155 |
|
| 156 |
% hollow node: definition |
| 157 |
\newcommand*\isthollownodedrawcolor { \istdefault@node@drawcolor } % (#1) black |
| 158 |
\def\istdefault@hollow@node@size { 2.8pt } % default of (#2) |
| 159 |
\newcommand*\isthollownodesize { \istdefault@hollow@node@size } % (#2) |
| 160 |
\newcommand*\isthollownodefillcolor { \istdefault@node@fillcolor } % (#3) white |
| 161 |
\newcommand*\isthollownodefillopacity { 1 } % (#4) |
| 162 |
|
| 163 |
% [draw color] {minimum size} [fill color] [fill opacity] |
| 164 |
\NewDocumentCommand \setistHollowNodeStyle |
| 165 |
{ O{\istdefault@node@drawcolor} G{\istdefault@hollow@node@size} O{\istdefault@node@fillcolor} O{1} } |
| 166 |
{ |
| 167 |
\renewcommand*\isthollownodedrawcolor{#1} |
| 168 |
\renewcommand*\isthollownodesize{#2} |
| 169 |
\renewcommand*\isthollownodefillcolor{#3} |
| 170 |
\renewcommand*\isthollownodefillopacity{#4} |
| 171 |
} |
| 172 |
\tikzset{ hollow~node /.style = |
| 173 |
{ |
| 174 |
circle , draw , thin , solid , |
| 175 |
inner~sep = 0pt , outer~sep = \istdefault@node@outersep , |
| 176 |
minimum~size = \isthollownodesize , |
| 177 |
draw = \isthollownodedrawcolor , |
| 178 |
fill = \isthollownodefillcolor , |
| 179 |
fill~opacity = \isthollownodefillopacity |
| 180 |
} |
| 181 |
} |
| 182 |
|
| 183 |
% initial node & chance node |
| 184 |
\let\setistInitialNodeStyle\setistHollowNodeStyle |
| 185 |
\let\setistChanceNodeStyle\setistHollowNodeStyle |
| 186 |
|
| 187 |
% rectangle node: definition |
| 188 |
\newcommand*\istrectanglenodedrawcolor { \istdefault@node@drawcolor } %(#1) black |
| 189 |
\def\istdefault@rectangle@node@size { 4pt } % default of (#2) |
| 190 |
\newcommand*\istrectanglenodesize { \istdefault@rectangle@node@size } % (#2) |
| 191 |
\newcommand*\istrectanglenodefillcolor { \istdefault@node@fillcolor } % (#3) white |
| 192 |
\newcommand*\istrectanglenodefillopacity { 1 } % (#4) |
| 193 |
|
| 194 |
% [draw color] {minimum size} [fill color] [fill opacity] |
| 195 |
\NewDocumentCommand \setistRectangleNodeStyle |
| 196 |
{ O{\istdefault@node@drawcolor} G{\istdefault@rectangle@node@size} O{\istdefault@node@fillcolor} O{1} } |
| 197 |
{ |
| 198 |
\renewcommand*\istrectanglenodedrawcolor{#1} |
| 199 |
\renewcommand*\istrectanglenodesize{#2} |
| 200 |
\renewcommand*\istrectanglenodefillcolor{#3} |
| 201 |
\renewcommand*\istrectanglenodefillopacity{#4} |
| 202 |
} |
| 203 |
\tikzset{ rectangle~node /.style = |
| 204 |
{ |
| 205 |
rectangle , draw , thin , solid , |
| 206 |
inner~sep = 2pt , outer~sep = \istdefault@node@outersep , |
| 207 |
minimum~size = \istrectanglenodesize , |
| 208 |
draw = \istrectanglenodedrawcolor , |
| 209 |
fill = \istrectanglenodefillcolor , |
| 210 |
fill~opacity = \istrectanglenodefillopacity |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
% box node & square node |
| 215 |
\let\setistBoxNodeStyle\setistRectangleNodeStyle |
| 216 |
\let\setistSquareNodeStyle\setistRectangleNodeStyle |
| 217 |
|
| 218 |
% ellipse node: definition |
| 219 |
\newcommand*\istellipsenodedrawcolor { \istdefault@node@drawcolor } % (#1) black |
| 220 |
\def\istdefault@ellipse@node@size { 4.8pt } % default of (#2) |
| 221 |
\newcommand*\istellipsenodesize { \istdefault@ellipse@node@size } % (#2) |
| 222 |
\newcommand*\istellipsenodefillcolor { \istdefault@node@fillcolor } % (#3) white |
| 223 |
\newcommand*\istellipsenodefillopacity { 1 } % (#4) |
| 224 |
|
| 225 |
\NewDocumentCommand \setistEllipseNodeStyle |
| 226 |
{ O{\istdefault@node@drawcolor} G{\istdefault@ellipse@node@size} O{\istdefault@node@fillcolor} O{1} } |
| 227 |
{ |
| 228 |
\renewcommand*\istellipsenodedrawcolor{#1} |
| 229 |
\renewcommand*\istellipsenodesize{#2} |
| 230 |
\renewcommand*\istellipsenodefillcolor{#3} |
| 231 |
\renewcommand*\istellipsenodefillopacity{#4} |
| 232 |
} |
| 233 |
\tikzset{ ellipse~node /.style = |
| 234 |
{ |
| 235 |
ellipse , draw , thin , solid , |
| 236 |
inner~sep = 1.5pt , outer~sep = \istdefault@node@outersep , |
| 237 |
minimum~size = \istellipsenodesize , |
| 238 |
draw = \istellipsenodedrawcolor , |
| 239 |
fill = \istellipsenodefillcolor , |
| 240 |
fill~opacity = \istellipsenodefillopacity |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
% oval node |
| 245 |
\let\setistOvalNodeStyle\setistEllipseNodeStyle |
| 246 |
|
| 247 |
|
| 248 |
%% aliases: node styles |
| 249 |
\tikzset{ initial~node /.style = hollow~node } |
| 250 |
\tikzset{ chance~node /.style = hollow~node } |
| 251 |
\tikzset{ decision~node /.style = solid~node } % decision nodes |
| 252 |
\tikzset{ terminal~node /.style = solid~node } % terminal nodes |
| 253 |
\tikzset{ box~node /.style = rectangle~node } |
| 254 |
\tikzset{ square~node /.style = rectangle~node } |
| 255 |
\tikzset{ oval~node /.style = ellipse~node } |
| 256 |
|
| 257 |
|
| 258 |
% \setistNewNodeStyle |
| 259 |
% {node name} [node opt] {minimum size} |
| 260 |
\NewDocumentCommand \setistNewNodeStyle { m O{} G{6mm} } |
| 261 |
{ |
| 262 |
\tikzset |
| 263 |
{ #1 /.style = |
| 264 |
{ |
| 265 |
- , circle , thin , solid , |
| 266 |
inner~sep = \istdefault@node@innersep , |
| 267 |
minimum~size = #3 , |
| 268 |
draw = \istdefault@node@drawcolor , |
| 269 |
fill = \istdefault@node@fillcolor , |
| 270 |
#2 |
| 271 |
} |
| 272 |
} |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
%% input mode changer: (math mode True/False) - owner, action labels, payoff |
| 277 |
|
| 278 |
% owner: (default: mathfalse) |
| 279 |
|
| 280 |
\newcount\istmathflagowner |
| 281 |
\def\istownermathtrue { \istmathflagowner = 1 } |
| 282 |
\def\istownermathfalse { \istmathflagowner = 0 } |
| 283 |
\istownermathfalse % default declared : mathfalse |
| 284 |
|
| 285 |
% owner text font |
| 286 |
\newcommand*\istownertextfont [1] { \def\ist@owner@text@font {#1} } |
| 287 |
\istownertextfont { } |
| 288 |
|
| 289 |
% \istownerstyle |
| 290 |
\NewDocumentCommand \istownerstyle { m } |
| 291 |
{ |
| 292 |
\int_compare:nTF { \istmathflagowner == 1 } |
| 293 |
{ \ensuremath {#1} } |
| 294 |
{ |
| 295 |
\tl_if_empty:NF \ist@owner@text@font |
| 296 |
{ \exp_args:No \use:c { \ist@owner@text@font } } {#1} % owner text font |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
% action labels: (default: mathtrue) |
| 301 |
|
| 302 |
\newcount\istmathflagactionlabel |
| 303 |
\newcommand*\istactionlabelmathtrue { \istmathflagactionlabel = 1 } |
| 304 |
\newcommand*\istactionlabelmathfalse { \istmathflagactionlabel = 0 } |
| 305 |
\istactionlabelmathtrue % default declared : mathtrue |
| 306 |
|
| 307 |
% action labels text font |
| 308 |
% used for automatic "italics" for action labels (with \setistmathTF*001 -- second zero) |
| 309 |
\newcommand*\istactionlabeltextfont [1] { \def\ist@actionlabel@text@font {#1} } |
| 310 |
\istactionlabeltextfont { } |
| 311 |
|
| 312 |
% \istactionlabelstyle |
| 313 |
\NewDocumentCommand \istactionlabelstyle{m} |
| 314 |
{ |
| 315 |
\int_compare:nTF { \istmathflagactionlabel == 1 } |
| 316 |
{ \ensuremath {#1} } |
| 317 |
{ |
| 318 |
\tl_if_empty:NF \ist@actionlabel@text@font |
| 319 |
{ \exp_args:No \use:c { \ist@actionlabel@text@font } } {#1} % AL text font |
| 320 |
} |
| 321 |
} |
| 322 |
|
| 323 |
% payoffs: (default: mathtrue) |
| 324 |
|
| 325 |
\newcount\istmathflagpayoff |
| 326 |
\newcommand*\istpayoffmathtrue { \istmathflagpayoff = 1 } |
| 327 |
\newcommand*\istpayoffmathfalse { \istmathflagpayoff = 0 } |
| 328 |
\istpayoffmathtrue % default declared : mathtrue |
| 329 |
|
| 330 |
% payoff text font |
| 331 |
% (not used) |
| 332 |
\newcommand*\istpayofftextfont [1] { \def\ist@payoff@text@font {#1} } |
| 333 |
\istpayofftextfont { } |
| 334 |
|
| 335 |
% \istpayoffstyle |
| 336 |
\NewDocumentCommand \istpayoffstyle{m} |
| 337 |
{ |
| 338 |
\int_compare:nTF { \istmathflagpayoff == 1 } |
| 339 |
{ \ensuremath {#1} } |
| 340 |
{ |
| 341 |
\tl_if_empty:NF \ist@payoff@text@font |
| 342 |
{ \exp_args:No \use:c { \ist@payoff@text@font } } {#1} % payoff text font |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
% \setistmathTF(*) |
| 347 |
% * {} {} {} <owner font> {action labels font} [payoff font] |
| 348 |
\NewDocumentCommand \setistmathTF{ s m m m D<>{} G{textit} O{} } |
| 349 |
{ |
| 350 |
\int_compare:nTF { #2 == 1 } { \istownermathtrue } { \istownermathfalse } |
| 351 |
\int_compare:nTF { #3 == 1 } { \istactionlabelmathtrue } { \istactionlabelmathfalse } |
| 352 |
\int_compare:nTF { #4 == 1 } { \istpayoffmathtrue } { \istpayoffmathfalse } |
| 353 |
\IfBooleanT {#1} |
| 354 |
{ |
| 355 |
\istownertextfont { #5 } |
| 356 |
\istactionlabeltextfont { #6 } |
| 357 |
\istpayofftextfont { #7 } |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
|
| 362 |
%% fine tuning: labels (experimental) |
| 363 |
\newcommand*\xtALxShift{0pt} % default xshift |
| 364 |
\newcommand*\xtALyShift{0pt} % default yshift |
| 365 |
|
| 366 |
\NewDocumentCommand \xtALPush { m m } |
| 367 |
{ |
| 368 |
\renewcommand*\xtALxShift{#1} |
| 369 |
\renewcommand*\xtALyShift{#2} |
| 370 |
} |
| 371 |
|
| 372 |
\newcommand*\istactionlabelxshift{1pt} % default horizontal push (alternatively, .67pt) |
| 373 |
\newcommand*\istactionlabelyshift{2pt} % default vertical push (alternatively, 2.5pt) |
| 374 |
|
| 375 |
\NewDocumentCommand \xtALShift { G{\istactionlabelxshift} G{\istactionlabelyshift} } |
| 376 |
{ |
| 377 |
\renewcommand*\istactionlabelxshift{#1} |
| 378 |
\renewcommand*\istactionlabelyshift{#2} |
| 379 |
} |
| 380 |
|
| 381 |
|
| 382 |
%% node anchors (experimental, used only in test, not documented) |
| 383 |
\let\istparentanchor\tikzparentanchor % empty by default |
| 384 |
\let\istchildanchor\tikzchildanchor % empty by default |
| 385 |
\newcommand*\setistparentanchor [1] { \renewcommand*\istparentanchor{.#1} } |
| 386 |
\newcommand*\setistchildanchor [1] { \renewcommand*\istchildanchor{.#1} } |
| 387 |
|
| 388 |
\NewDocumentCommand \setistbranchanchors{ m G{center} } |
| 389 |
{ |
| 390 |
\renewcommand*\istparentanchor {.#1} |
| 391 |
\renewcommand \istchildanchor {.#2} |
| 392 |
} |
| 393 |
|
| 394 |
|
| 395 |
%%%%%%%%%%%%%%%%% |
| 396 |
%% istgame macros |
| 397 |
%%%%%%%%%%%%%%%%% |
| 398 |
|
| 399 |
%% basics (in child) |
| 400 |
% -- used in the definition of \istb and its variants |
| 401 |
\def\xt@ndot{node[solid~node]{}} % (within child) default node dot: decision node |
| 402 |
\def\xt@show@tndot{} % default: no terminal nodes printed |
| 403 |
\def\xt@show@endpoint{} % default: no endpoints printed |
| 404 |
\def\cntm@ndot{} % default: no cntm node dot printed |
| 405 |
\def\cntm@show@endpoint{} % default: no cntm endpoint printed |
| 406 |
|
| 407 |
|
| 408 |
\ExplSyntaxOff |
| 409 |
|
| 410 |
%%----------------- |
| 411 |
%% expl3 up to here (paused, because of colon problem) |
| 412 |
%%----------------- |
| 413 |
|
| 414 |
|
| 415 |
%% payoffs |
| 416 |
|
| 417 |
|
| 418 |
%---syntaxoff----- |
| 419 |
% remark: label={[opt]pos:{text}} (needed this form for \istgrowdirection to put payoffs) |
| 420 |
\NewDocumentCommand \istpayoff{ m +m } |
| 421 |
{ |
| 422 |
node [ inner sep = 0pt , text depth = .25ex , |
| 423 |
label = {#1:\istpayoffstyle{#2} } ] {} % colon here |
| 424 |
} |
| 425 |
|
| 426 |
%---syntaxoff----- |
| 427 |
% \ISTRoot |
| 428 |
% (used in \istroot) |
| 429 |
% ' [grow] (root) (at) [node] <angle> {owner} +levdist..sibdist+ |
| 430 |
\NewDocumentCommand \ISTRoot |
| 431 |
{ t' O{south} r() D(){0,0} O{} D<>{} G{} D+.{\xtlevdist} D.+{\xtsibdist} } |
| 432 |
{ |
| 433 |
\IfBooleanTF {#1} |
| 434 |
{ |
| 435 |
\tikzset{level 1/.style = { level distance = #8 , sibling distance = #9 } } % colon here |
| 436 |
\node (#3) at (#4) [decision node , #5 , label = {#6:{#7} } ] |
| 437 |
{} [ \xt@growswap=#2 ] |
| 438 |
} |
| 439 |
{ |
| 440 |
\tikzset{level 1/.style = { level distance = #8 , sibling distance = #9 } } % colon here |
| 441 |
\node (#3) at (#4) [ decision node , #5 , label = {#6:{#7} } ] |
| 442 |
{} [ \xt@grow=#2 ] |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
%%----------------- |
| 448 |
%% expl3 from here again |
| 449 |
%%----------------- |
| 450 |
|
| 451 |
\ExplSyntaxOn |
| 452 |
|
| 453 |
%% \bool_new:N declaration %% added: 2026/05/18 |
| 454 |
|
| 455 |
\bool_new:N \cntm_distance_call_bool % to distinguish cntm sibdist |
| 456 |
\bool_new:N \cntm_act_sibdist_call_bool % from cntm action sibdist |
| 457 |
\bool_new:N \xt_xscale_call_bool % for InfosetO, CInfosetO, and more |
| 458 |
\bool_new:N \xt_yscale_call_bool % for InfosetO, CInfosetO, and more |
| 459 |
\bool_new:N \xt_scale_call_bool % for InfosetO, CInfosetO, and more |
| 460 |
\bool_new:N \_arrow_option_exist_bool % for arrow shorten |
| 461 |
\bool_new:N \xt_growswap_call_bool % for CInfoset(O) |
| 462 |
\bool_new:N \_istroot_cntmA_call_bool % for \istbA |
| 463 |
\bool_new:N \_istroot_cntm_call_bool % for \istbA |
| 464 |
\bool_new:N \_xt_levdist_local_call_bool % for \istbA |
| 465 |
\bool_new:N \_cntm_distance_local_call_bool % for \istbA |
| 466 |
\bool_new:N \_cntmA_distance_local_call_bool % for \istbA |
| 467 |
|
| 468 |
|
| 469 |
%% main macros: \xtdistance, \ISTRoot(O), \ISTCntm(Arc) |
| 470 |
|
| 471 |
\def\xtdefault@levdist {15mm} %% (default) level distance : 15mm |
| 472 |
\def\xtdefault@sibdist {\xtdefault@levdist} %% (default) sibling distance : 15mm |
| 473 |
\newcommand*\xtlevdist {\xtdefault@levdist} |
| 474 |
\newcommand*\xtsibdist {\xtdefault@sibdist} |
| 475 |
|
| 476 |
\NewDocumentCommand \xtdistance |
| 477 |
{ O{1} m G{\xtdefault@sibdist} } |
| 478 |
{ |
| 479 |
\renewcommand*\xtlevdist {#2} |
| 480 |
\renewcommand*\xtsibdist {#3} |
| 481 |
\tikzset{ level~#1/.style = {level~distance = \xtlevdist , sibling~distance = \xtsibdist } } |
| 482 |
} |
| 483 |
|
| 484 |
|
| 485 |
%% counterclockwise (grow=) or clockwise (grow'=) |
| 486 |
|
| 487 |
% default: growing south counterclockwise |
| 488 |
\def\xt@grow { grow } |
| 489 |
\def\xt@growswap { grow' } |
| 490 |
\def\istdefault@grow { south } % tree growing direction |
| 491 |
|
| 492 |
% \setxtgrowkey %% just for one simple tree |
| 493 |
\NewDocumentCommand \setxtgrowkey { m } |
| 494 |
{ |
| 495 |
\renewcommand*\xt@grow {#1} |
| 496 |
} |
| 497 |
|
| 498 |
% growsawp call test |
| 499 |
\bool_set_false:N \xt_growswap_call_bool |
| 500 |
|
| 501 |
% \setistgrowdirection %% for whole tree |
| 502 |
\NewDocumentCommand \setistgrowdirection{ t' m } |
| 503 |
{ \IfBooleanTF {#1} |
| 504 |
{ |
| 505 |
\bool_set_true:N \xt_growswap_call_bool |
| 506 |
\renewcommand*\xt@grow { grow' } |
| 507 |
\renewcommand*\istdefault@grow {#2} |
| 508 |
} |
| 509 |
{ |
| 510 |
\renewcommand*\xt@grow { grow } |
| 511 |
\renewcommand*\istdefault@grow {#2} |
| 512 |
} |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
% \ISTRootO (oval version) |
| 517 |
% (used in \istrooto) |
| 518 |
% ' [grow] (root) (at) [node] <angle> {owner} +levdis..sibdist+ |
| 519 |
\NewDocumentCommand \ISTRootO |
| 520 |
{ t' O{south} r() D(){0,0} O{} D<>{} G{} D+.{\xtlevdist} D.+{\xtsibdist} } |
| 521 |
{ |
| 522 |
\IfBooleanTF {#1} |
| 523 |
{ |
| 524 |
\tikzset { level~1/.style = { level~distance = #8 , sibling~distance = #9} } |
| 525 |
\node (#3) at (#4) [ oval~node , #5 ] {#7} [ \xt@growswap = #2 ] |
| 526 |
} |
| 527 |
{ |
| 528 |
\tikzset { level~1/.style = { level~distance = #8 , sibling~distance = #9 } } |
| 529 |
\node (#3) at (#4) [ oval~node , #5 ] {#7} [ \xt@grow = #2 ] |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
%% istgame environment (can be used in the preamble) |
| 534 |
|
| 535 |
\def\istgame@default@fontsize { \normalsize } |
| 536 |
\def\istgame@default@arrowend@shorten { 0pt } % 0pt needed, otherwise affects all the lines |
| 537 |
|
| 538 |
\NewDocumentCommand \setistgamefontsize { m } |
| 539 |
{ |
| 540 |
\renewcommand*{\istgame@default@fontsize} {#1} |
| 541 |
} |
| 542 |
|
| 543 |
\NewDocumentCommand \setistgameshorten { m } |
| 544 |
{ |
| 545 |
\renewcommand*{\istgame@default@arrowend@shorten} {#1} |
| 546 |
} |
| 547 |
|
| 548 |
%% (2021/04/09) |
| 549 |
%% more global macros (can be used in the preamble) |
| 550 |
|
| 551 |
\NewDocumentCommand \setistsolidnodesize { m } |
| 552 |
{ |
| 553 |
\renewcommand*{\istdefault@solid@node@size} {#1} |
| 554 |
} |
| 555 |
|
| 556 |
\NewDocumentCommand \setisthollownodesize { m } |
| 557 |
{ |
| 558 |
\renewcommand*{\istdefault@hollow@node@size} {#1} |
| 559 |
} |
| 560 |
|
| 561 |
\NewDocumentCommand \setistellipsenodesize { m } |
| 562 |
{ |
| 563 |
% \renewcommand*{\istdefault@ellipse@node@size} {#1} |
| 564 |
\renewcommand*{\istellipsenodesize} {#1} |
| 565 |
} |
| 566 |
|
| 567 |
\NewDocumentCommand \setistrectanglenodesize { m } %% typo corrected 2026/05/18 |
| 568 |
{ |
| 569 |
\renewcommand*{\istdefault@rectangle@node@size} {#1} |
| 570 |
} |
| 571 |
|
| 572 |
|
| 573 |
% get ready for checking (x)(y)scale option |
| 574 |
\clist_new:N \l_parseopt_clist |
| 575 |
|
| 576 |
% \xtxscale |
| 577 |
\cs_new_nopar:Npn \get_xscale_option_string:n #1 |
| 578 |
{ |
| 579 |
\get_opt_xvalue:w #1\q_stop |
| 580 |
} |
| 581 |
\cs_new_nopar:Npn \get_opt_xvalue:w #1=#2\q_stop |
| 582 |
{ |
| 583 |
% keep the value of xscale |
| 584 |
\tl_gset:Nn \xtxscale { #2 } |
| 585 |
} |
| 586 |
|
| 587 |
% \xtyscale |
| 588 |
\cs_new_nopar:Npn \get_yscale_option_string:n #1 |
| 589 |
{ |
| 590 |
\get_opt_yvalue:w #1\q_stop |
| 591 |
} |
| 592 |
\cs_new_nopar:Npn \get_opt_yvalue:w #1=#2\q_stop |
| 593 |
{ |
| 594 |
% keep the value of yscale |
| 595 |
\tl_gset:Nn \xtyscale { #2 } |
| 596 |
} |
| 597 |
|
| 598 |
% \xtscale |
| 599 |
\cs_new_nopar:Npn \get_scale_option_string:n #1 |
| 600 |
{ |
| 601 |
\get_opt_value:w #1\q_stop |
| 602 |
} |
| 603 |
\cs_new_nopar:Npn \get_opt_value:w #1=#2\q_stop |
| 604 |
{ |
| 605 |
% keep the value of scale |
| 606 |
\tl_gset:Nn \xtscale { #2 } |
| 607 |
} |
| 608 |
|
| 609 |
|
| 610 |
% to resolve TikZ problem: sloped label conflict with x-y-scale |
| 611 |
% temporary solution (experimental) |
| 612 |
|
| 613 |
% \xtcureslopedlabelsNS (for north and south growing tree) |
| 614 |
\NewDocumentCommand \xtcureslopedlabelsNS { } |
| 615 |
{ |
| 616 |
\istgameScaleCallTestAndAdjust |
| 617 |
\bool_if:NTF \xt_xscale_call_bool |
| 618 |
{ |
| 619 |
\pgfmathsetmacro\xtsibdistadj {\xtxscale*\xtsibdist} |
| 620 |
\pgfmathsetmacro\xtlevdistadj {1*\xtlevdist} |
| 621 |
} |
| 622 |
{ |
| 623 |
\bool_if:NT \xt_yscale_call_bool |
| 624 |
{ |
| 625 |
\pgfmathsetmacro\xtsibdistadj {1*\xtsibdist} |
| 626 |
\pgfmathsetmacro\xtlevdistadj {\xtyscale*\xtlevdist} |
| 627 |
} |
| 628 |
} |
| 629 |
\xtdistance{\xtlevdistadj}{\xtsibdistadj} |
| 630 |
} |
| 631 |
|
| 632 |
% \xtcureslopedlabelsEW (for east and west growing tree) |
| 633 |
\NewDocumentCommand \xtcureslopedlabelsEW { } |
| 634 |
{ |
| 635 |
\istgameScaleCallTestAndAdjust |
| 636 |
\bool_if:NTF \xt_xscale_call_bool |
| 637 |
{ |
| 638 |
\pgfmathsetmacro\xtsibdistadj {1*\xtsibdist} |
| 639 |
\pgfmathsetmacro\xtlevdistadj {\xtxscale*\xtlevdist} |
| 640 |
} |
| 641 |
{ |
| 642 |
\bool_if:NT \xt_yscale_call_bool |
| 643 |
{ |
| 644 |
\pgfmathsetmacro\xtsibdistadj {\xtyscale*\xtsibdist} |
| 645 |
\pgfmathsetmacro\xtlevdistadj {1*\xtlevdist} |
| 646 |
} |
| 647 |
} |
| 648 |
\xtdistance{\xtlevdistadj}{\xtsibdistadj} |
| 649 |
} |
| 650 |
|
| 651 |
%%% istgame: main environment |
| 652 |
\DeclareDocumentEnvironment {istgame} { s O{} } % accepts tikzpicture options |
| 653 |
{ |
| 654 |
% call set (false) |
| 655 |
\bool_set_false:N \cntm_distance_call_bool % to distinguish cntm sibdist |
| 656 |
\bool_set_false:N \cntm_act_sibdist_call_bool % from cntm action sibdist |
| 657 |
\bool_set_false:N \xt_xscale_call_bool % for InfosetO, CInfosetO, and more |
| 658 |
\bool_set_false:N \xt_yscale_call_bool % for InfosetO, CInfosetO, and more |
| 659 |
\bool_set_false:N \xt_scale_call_bool % for InfosetO, CInfosetO, and more |
| 660 |
\bool_set_false:N \_arrow_option_exist_bool % for arrow shorten |
| 661 |
\bool_set_false:N \xt_growswap_call_bool % for CInfoset(O) |
| 662 |
\bool_set_false:N \_istroot_cntmA_call_bool % for \istbA |
| 663 |
\bool_set_false:N \_istroot_cntm_call_bool % for \istbA |
| 664 |
\bool_set_false:N \_xt_levdist_local_call_bool % for \istbA |
| 665 |
\bool_set_false:N \_cntm_distance_local_call_bool % for \istbA |
| 666 |
\bool_set_false:N \_cntmA_distance_local_call_bool % for \istbA |
| 667 |
|
| 668 |
\IfBooleanTF { #1 } |
| 669 |
{ |
| 670 |
\def\xtxscale{1} |
| 671 |
\def\xtyscale{1} |
| 672 |
\def\xtscale{1} |
| 673 |
|
| 674 |
\def\xtcureslopedlabelsNS{} |
| 675 |
\def\xtcureslopedlabelsEW{} |
| 676 |
|
| 677 |
\begin{tikzpicture} [ #2 ] |
| 678 |
} |
| 679 |
{ |
| 680 |
% extract the value of xscale/yscale/scale |
| 681 |
% (extract scale value, only if it is used alone) |
| 682 |
\clist_set:Nn \l_parseopt_clist { #2 } |
| 683 |
\tl_gset:Nn \xtxscale {1.0} |
| 684 |
\tl_gset:Nn \xtyscale {1.0} |
| 685 |
\tl_gset:Nn \xtscale {1.0} |
| 686 |
\clist_map_inline:Nn \l_parseopt_clist |
| 687 |
{ |
| 688 |
\str_if_in:nnTF { ##1 } { xscale } |
| 689 |
{ |
| 690 |
\bool_set_true:N \xt_xscale_call_bool |
| 691 |
\get_xscale_option_string:n { ##1 } |
| 692 |
\str_if_in:nnT { ##1 } {yscale} |
| 693 |
{ |
| 694 |
\bool_set_true:N \xt_yscale_call_bool |
| 695 |
\get_yscale_option_string:n { ##1 } |
| 696 |
} |
| 697 |
} |
| 698 |
{ |
| 699 |
\str_if_in:nnTF { ##1 } { yscale } |
| 700 |
{ |
| 701 |
\bool_set_true:N \xt_yscale_call_bool |
| 702 |
\get_yscale_option_string:n { ##1 } |
| 703 |
\str_if_in:nnT {##1} { xscale } |
| 704 |
{ |
| 705 |
\bool_set_true:N \xt_xscale_call_bool |
| 706 |
\get_xscale_option_string:n { ##1 } |
| 707 |
} |
| 708 |
} |
| 709 |
{ % xscale:false, yscale:false |
| 710 |
\str_if_in:nnT { ##1 } { scale } |
| 711 |
{ |
| 712 |
\bool_set_true:N \xt_scale_call_bool |
| 713 |
\get_scale_option_string:n { ##1 } |
| 714 |
} |
| 715 |
} |
| 716 |
} |
| 717 |
} |
| 718 |
|
| 719 |
\clist_if_in:NnT \l_parseopt_clist { -> } % check if [->] exists |
| 720 |
{ |
| 721 |
\bool_set_true:N \_arrow_option_exist_bool |
| 722 |
\clist_remove_all:Nn \l_parseopt_clist { -> } |
| 723 |
\clist_put_left:No \l_parseopt_clist { -> , shorten~> = \istgame@default@arrowend@shorten } |
| 724 |
} |
| 725 |
|
| 726 |
\tl_set:Nn \l_tmpa_tl { font = \istgame@default@fontsize , > = stealth , } |
| 727 |
\tl_put_right:Nx \l_tmpa_tl { \clist_use:Nn \l_parseopt_clist { , } } |
| 728 |
|
| 729 |
\exp_last_unbraced:NnNo |
| 730 |
\begin{tikzpicture} [ \l_tmpa_tl ] |
| 731 |
} |
| 732 |
} |
| 733 |
{ |
| 734 |
\end{tikzpicture} |
| 735 |
} |
| 736 |
%%% % add the following as env option: tikz-qtree conflict resolution |
| 737 |
%%% edge~from~parent~path = { (\tikzparentnode) -- (\tikzchildnode) } |
| 738 |
|
| 739 |
|
| 740 |
%% scale call test and adjust |
| 741 |
|
| 742 |
\def\xtinfosetheightvar {\xtinfosetheight} |
| 743 |
\def\cntminfosetheightvar {\cntminfosetheight} |
| 744 |
|
| 745 |
% \istgameScaleCallTestAndAdjust |
| 746 |
% use this only in a GROUP |
| 747 |
\NewExpandableDocumentCommand \istgameScaleCallTestAndAdjust { } |
| 748 |
{ |
| 749 |
\bool_if:NTF \xt_xscale_call_bool |
| 750 |
{ |
| 751 |
\pgftransformxscale{1/\xtxscale} |
| 752 |
% keep going for yscale |
| 753 |
\bool_if:NT \xt_yscale_call_bool |
| 754 |
{ |
| 755 |
\pgftransformyscale{1/\xtyscale} |
| 756 |
} |
| 757 |
% for scaling infosetO if scaled together with x-y-scale |
| 758 |
\renewcommand*\xtinfosetheightvar {\xtinfosetheight*\xtscale} |
| 759 |
\renewcommand*\cntminfosetheightvar {\cntminfosetheight*\xtscale} |
| 760 |
} |
| 761 |
{ |
| 762 |
\bool_if:NTF \xt_yscale_call_bool |
| 763 |
{ |
| 764 |
\pgftransformyscale{1/\xtyscale} |
| 765 |
% keep going for xscale |
| 766 |
\bool_if:NT \xt_xscale_call_bool |
| 767 |
{ |
| 768 |
\pgftransformxscale{1/\xtxscale} |
| 769 |
} |
| 770 |
% for scaling infosetO if scaled together with x-y-scale |
| 771 |
\renewcommand*\xtinfosetheightvar {\xtinfosetheight*\xtscale} |
| 772 |
\renewcommand*\cntminfosetheightvar {\cntminfosetheight*\xtscale} |
| 773 |
} |
| 774 |
{ |
| 775 |
\bool_if:NT \xt_scale_call_bool |
| 776 |
{ |
| 777 |
% no scaling infosetO if scaled without x-y-scale |
| 778 |
\pgftransformscale{1/\xtscale} |
| 779 |
} |
| 780 |
} |
| 781 |
} |
| 782 |
} |
| 783 |
|
| 784 |
|
| 785 |
%% --------------- |
| 786 |
%% core macro part |
| 787 |
%% --------------- |
| 788 |
|
| 789 |
% get ready |
| 790 |
\tl_new:N \ischo_game_tl |
| 791 |
|
| 792 |
% action (with abbreviations) |
| 793 |
% BE CAREFUL: each case has different options (do not try to shorten) |
| 794 |
% {#1: branch line style} {#2: position} {#3: action labels} |
| 795 |
\cs_new:Npn \ist_move:nnn #1 #2 #3 |
| 796 |
{ |
| 797 |
\str_case:nnF { #2 } |
| 798 |
{ |
| 799 |
{ al } { |
| 800 |
edge~from~parent [ #1 ] |
| 801 |
node [ above~left , text~depth = .25ex , |
| 802 |
xshift = \istactionlabelxshift , yshift = -\istactionlabelyshift ] |
| 803 |
{ \istactionlabelstyle{#3} } |
| 804 |
} |
| 805 |
{ ar } { |
| 806 |
edge~from~parent [ #1 ] |
| 807 |
node [ above~right , text~depth = .25ex , |
| 808 |
xshift = -\istactionlabelxshift , yshift = -\istactionlabelyshift ] |
| 809 |
{ \istactionlabelstyle{#3} } |
| 810 |
} |
| 811 |
{ bl } { |
| 812 |
edge~from~parent [ #1 ] |
| 813 |
node [ below~left , text~depth = .25ex , |
| 814 |
xshift = \istactionlabelxshift , yshift = \istactionlabelyshift ] |
| 815 |
{ \istactionlabelstyle{#3} } |
| 816 |
} |
| 817 |
{ br } { |
| 818 |
edge~from~parent [ #1 ] |
| 819 |
node [ below~right , text~depth = .25ex , |
| 820 |
xshift = -\istactionlabelxshift , yshift = \istactionlabelyshift ] |
| 821 |
{ \istactionlabelstyle{#3} } |
| 822 |
} |
| 823 |
{ l } { |
| 824 |
edge~from~parent [ #1 ] |
| 825 |
node [ left , text~depth = .25ex , xshift = -\xtALxShift ] |
| 826 |
{ \istactionlabelstyle{#3} } |
| 827 |
} |
| 828 |
{ r } { |
| 829 |
edge~from~parent [ #1 ] |
| 830 |
node [ right , text~depth = .25ex , xshift = \xtALxShift ] |
| 831 |
{ \istactionlabelstyle{#3} } |
| 832 |
} |
| 833 |
{ a } { |
| 834 |
edge~from~parent [ #1 ] |
| 835 |
node [ above , text~depth = .25ex , yshift = \xtALyShift ] |
| 836 |
{ \istactionlabelstyle{#3} } |
| 837 |
} |
| 838 |
{ b } { |
| 839 |
edge~from~parent [ #1 ] |
| 840 |
node [ below , text~depth = .25ex , yshift = -\xtALyShift ] |
| 841 |
{ \istactionlabelstyle{#3} } |
| 842 |
} |
| 843 |
} |
| 844 |
{ |
| 845 |
edge~from~parent [ #1 ] |
| 846 |
node [ text~depth = .25ex , #2 ] { \istactionlabelstyle{#3} } % was \istmove{#1}{#2}{#3} |
| 847 |
} |
| 848 |
} |
| 849 |
|
| 850 |
% payoff (with abbreviations) |
| 851 |
% {#1: position} {#2: payoffs} |
| 852 |
\cs_new:Npn \ist_payoff:nn #1 #2 |
| 853 |
{ |
| 854 |
\str_case:nnF { #1 } |
| 855 |
{ |
| 856 |
{ al } { \istpayoff { above~left } { #2 } } |
| 857 |
{ ar } { \istpayoff { above~right } { #2 } } |
| 858 |
{ bl } { \istpayoff { below~left } { #2 } } |
| 859 |
{ br } { \istpayoff { below~right } { #2 } } |
| 860 |
{ l } { \istpayoff { left } { #2 } } |
| 861 |
{ r } { \istpayoff { right } { #2 } } |
| 862 |
{ a } { \istpayoff { above } { #2 } } |
| 863 |
{ b } { \istpayoff { below } { #2 } } |
| 864 |
} |
| 865 |
{ |
| 866 |
\istpayoff { #1 } { #2 } |
| 867 |
} |
| 868 |
} |
| 869 |
|
| 870 |
|
| 871 |
%% core macros: \istroot, \istb, \endist |
| 872 |
|
| 873 |
% \istroot(') -- standard version |
| 874 |
% ' [grow, tree opt] (root) (at) [node style] <angle> {owner} +levdis..sibdist+ |
| 875 |
\NewDocumentCommand \istroot |
| 876 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. D.+{\xtsibdist} } |
| 877 |
{ |
| 878 |
% for \istbA |
| 879 |
\IfNoValueTF {#8} |
| 880 |
{ % if the third option exists in \cntmdistance(*) |
| 881 |
\bool_set_false:N \_xt_levdist_local_call_bool |
| 882 |
\tl_set:Nn \_xt_levdist_local_tl { \xtlevdist } |
| 883 |
\tl_set:Nn \_xt_sibdist_local_tl { \xtsibdist } |
| 884 |
} |
| 885 |
{ |
| 886 |
\bool_set_true:N \_xt_levdist_local_call_bool |
| 887 |
\tl_set:Nn \_xt_levdist_local_tl { #8 } |
| 888 |
\tl_set:Nn \_xt_sibdist_local_tl { #9 } |
| 889 |
} |
| 890 |
% normal process |
| 891 |
\tl_clear:N \ischo_game_tl |
| 892 |
\xdef\istgrowdirection{#2} % used in \istb to specify [payoff direction] |
| 893 |
|
| 894 |
\IfBooleanTF {#1} |
| 895 |
{ |
| 896 |
\tl_put_right:Nn \ischo_game_tl { \ISTRoot' } |
| 897 |
} |
| 898 |
{ |
| 899 |
\tl_put_right:Nn \ischo_game_tl { \ISTRoot } |
| 900 |
} |
| 901 |
|
| 902 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] < #6 > } |
| 903 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle{ #7 } } } |
| 904 |
\tl_put_right:Nx \ischo_game_tl { + { \_xt_levdist_local_tl } .. { #9 } + } |
| 905 |
% { } needed for #8 and #9 with decimal dim |
| 906 |
} |
| 907 |
|
| 908 |
% \istrooto(') -- oval version |
| 909 |
% ' [grow] (root) (at) [node style] <angle> {owner} +levdis..sibdist+ --- <angle>: redundant |
| 910 |
\NewDocumentCommand \istrooto |
| 911 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. D.+{\xtsibdist} } |
| 912 |
{ |
| 913 |
% for \istbA |
| 914 |
\IfNoValueTF {#8} |
| 915 |
{ |
| 916 |
\bool_set_false:N \_xt_levdist_local_call_bool |
| 917 |
\tl_set:Nn \_xt_levdist_local_tl { \xtlevdist } |
| 918 |
\tl_set:Nn \_xt_sibdist_local_tl { \xtsibdist } |
| 919 |
} |
| 920 |
{ |
| 921 |
\bool_set_true:N \_xt_levdist_local_call_bool |
| 922 |
\tl_set:Nn \_xt_levdist_local_tl { #8 } |
| 923 |
\tl_set:Nn \_xt_sibdist_local_tl { #9 } |
| 924 |
} |
| 925 |
% normal process |
| 926 |
\tl_clear:N \ischo_game_tl |
| 927 |
\xdef\istgrowdirection{#2} % used in \istb to specify [payoff direction] |
| 928 |
|
| 929 |
\IfBooleanTF {#1} |
| 930 |
{ |
| 931 |
\tl_put_right:Nn \ischo_game_tl { \ISTRootO' } |
| 932 |
} |
| 933 |
{ |
| 934 |
\tl_put_right:Nn \ischo_game_tl { \ISTRootO } |
| 935 |
} |
| 936 |
|
| 937 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] } |
| 938 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle { #7 } } } |
| 939 |
\tl_put_right:Nx \ischo_game_tl { + { \_xt_levdist_local_tl } .. { #9 } + } |
| 940 |
% { } needed for #8 and #9 with decimal dim |
| 941 |
} |
| 942 |
|
| 943 |
% \istbm % missing version |
| 944 |
\NewDocumentCommand \istbm { } |
| 945 |
{ |
| 946 |
\istb<missing> |
| 947 |
} |
| 948 |
|
| 949 |
% \istbm % missing version (just in case) |
| 950 |
\NewDocumentCommand \istbAm { } |
| 951 |
{ |
| 952 |
\istbA<missing> |
| 953 |
} |
| 954 |
|
| 955 |
|
| 956 |
% \istb(*) |
| 957 |
% * (redundant) <grow,xtdistances> [line style] {action labels} [pos] {payoffs} [pos] |
| 958 |
% second option is redundant (this helps not getting errors when playing with \istbA) |
| 959 |
% default payoff postion: \istgrowdirection |
| 960 |
\NewDocumentCommand \istb |
| 961 |
{ s D(){1} D<>{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 962 |
{ |
| 963 |
\tl_put_right:Nn \ischo_game_tl |
| 964 |
{ |
| 965 |
child [ #3 ] |
| 966 |
{ |
| 967 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@endpoint } |
| 968 |
\IfValueT { #7 } { \ist_payoff:nn { #8 } { #7 } } |
| 969 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #4 } { #6 } { #5 } |
| 970 |
} |
| 971 |
} |
| 972 |
} |
| 973 |
|
| 974 |
% \istbt(*) % terminal version |
| 975 |
% this is the replacement of \istb.(*) |
| 976 |
% * (redundant) <grow,xtdistances> [line style] {action labels} [pos] {payoffs} [pos] |
| 977 |
% second option is redundant (this helps not getting errors when playing with \istbA) |
| 978 |
\NewDocumentCommand \istbt |
| 979 |
{ s D(){1} D<>{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 980 |
{ |
| 981 |
\tl_put_right:Nn \ischo_game_tl |
| 982 |
{ |
| 983 |
child [ #3 ] |
| 984 |
{ |
| 985 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@tndot } |
| 986 |
\IfValueT { #7 } { \ist_payoff:nn { #8 } { #7 } } |
| 987 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #4 } { #6 } { #5 } |
| 988 |
} |
| 989 |
} |
| 990 |
} |
| 991 |
|
| 992 |
|
| 993 |
% \istB(*) % dual version |
| 994 |
% * <grow,xtdistances> [line style] {AL 1} [pos 1] {AL 2} [pos 2] {payoffs} [pos] |
| 995 |
\NewDocumentCommand \istB |
| 996 |
{ s D<>{} O{} +G{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 997 |
{ |
| 998 |
\tl_put_right:Nn \ischo_game_tl |
| 999 |
{ |
| 1000 |
child [ #2 ] |
| 1001 |
{ |
| 1002 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@endpoint } |
| 1003 |
\IfValueT { #8 } { \ist_payoff:nn { #9 } { #8 } } |
| 1004 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow } { #7 } { #6 } |
| 1005 |
\ist_move:nnn { #3 } { #5 } { #4 } |
| 1006 |
} |
| 1007 |
} |
| 1008 |
} |
| 1009 |
|
| 1010 |
|
| 1011 |
% \istBt(*) % dual terminal version |
| 1012 |
% * <grow,xt-distances> [line style] {AL 1} [pos 1] {AL 2} [pos 2] {payoffs} [pos] |
| 1013 |
\NewDocumentCommand \istBt |
| 1014 |
{ s D<>{} O{} +G{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 1015 |
{ |
| 1016 |
\tl_put_right:Nn \ischo_game_tl |
| 1017 |
{ |
| 1018 |
child [ #2 ] |
| 1019 |
{ |
| 1020 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@tndot } |
| 1021 |
\IfValueT { #8 } { \ist_payoff:nn { #9 } { #8 } } |
| 1022 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow } { #7 } { #6 } |
| 1023 |
\ist_move:nnn { #3 } { #5 } { #4 } |
| 1024 |
} |
| 1025 |
} |
| 1026 |
} |
| 1027 |
|
| 1028 |
|
| 1029 |
% \istbA (arc version) -- to work with \istrootcntmA and variants |
| 1030 |
% * (Xpoint adj factor) <grow,xt-distances> [line style] {action labels} [pos] {payoffs} [pos] |
| 1031 |
% code complication, inevitable to take care of too many cases |
| 1032 |
\NewDocumentCommand \istbA |
| 1033 |
{ s D(){1} D<>{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 1034 |
{ |
| 1035 |
%% to toss adjusted levdist and sibdist for every case |
| 1036 |
\bool_if:NTF \_istroot_cntmA_call_bool |
| 1037 |
{ % with \istrootcntmA |
| 1038 |
% adjust levdist (to make longer branch only for \istrootcntmA and its oval version) |
| 1039 |
\pgfmathsetmacro \xtlevdistVarA { \cntmApos * \_cntmA_levdist_local_tl * \cntmAplotfactorAdj } |
| 1040 |
\pgfmathsetmacro \xtsibdistVarA { \cntmApos * \_cntm_act_sibdist_local_tl } % better not mul \...Adj |
| 1041 |
% this is correct (there is no \_cntmA_act_sibdist_local_tl) |
| 1042 |
} |
| 1043 |
{ |
| 1044 |
\bool_if:NTF \_istroot_cntm_call_bool |
| 1045 |
{ % with \istrootcntm |
| 1046 |
\pgfmathsetmacro \xtlevdistVarA { \cntmpos * \_cntm_levdist_local_tl } |
| 1047 |
\pgfmathsetmacro \xtsibdistVarA { \cntmpos * \_cntm_act_sibdist_local_tl } |
| 1048 |
} |
| 1049 |
{ |
| 1050 |
\bool_if:NTF \_xt_levdist_local_call_bool |
| 1051 |
{ % if +#8..#9+ exists ( \_xt_levdist_local_tl defined in \istroot ) |
| 1052 |
\pgfmathsetmacro \xtlevdistVarA { \_xt_levdist_local_tl } |
| 1053 |
\pgfmathsetmacro \xtsibdistVarA { \_xt_sibdist_local_tl } |
| 1054 |
} |
| 1055 |
{ % ordinary case |
| 1056 |
\pgfmathsetmacro \xtlevdistVarA { \xtlevdist } |
| 1057 |
\pgfmathsetmacro \xtsibdistVarA { \xtsibdist } |
| 1058 |
} |
| 1059 |
} |
| 1060 |
} |
| 1061 |
%% draw branch |
| 1062 |
\tl_put_right:Nn \ischo_game_tl |
| 1063 |
{ |
| 1064 |
child [ level~distance = #2 * \xtlevdistVarA , sibling~distance = \xtsibdistVarA , #3 ] |
| 1065 |
{ |
| 1066 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@endpoint } |
| 1067 |
\IfValueT { #7 } { \ist_payoff:nn { #8 } { #7 } } |
| 1068 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #4 } { #6 } { #5 } |
| 1069 |
} |
| 1070 |
} |
| 1071 |
} |
| 1072 |
|
| 1073 |
|
| 1074 |
% \istbAt (arc terminal version) |
| 1075 |
% * (Xpoint adj factor) <grow,xt-distances> [line style] {action labels} [pos] {payoffs} [pos] |
| 1076 |
\NewDocumentCommand \istbAt |
| 1077 |
{ s D(){1} D<>{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 1078 |
{ |
| 1079 |
%% to toss adjusted levdist and sibdist for every case |
| 1080 |
\bool_if:NTF \_istroot_cntmA_call_bool |
| 1081 |
{ % with \istrootcntmA |
| 1082 |
% adjust levdist (to make longer branch only for \istrootcntmA and its oval version) |
| 1083 |
\pgfmathsetmacro \xtlevdistVarA { \cntmApos * \_cntmA_levdist_local_tl * \cntmAplotfactorAdj } |
| 1084 |
\pgfmathsetmacro \xtsibdistVarA { \cntmApos * \_cntm_act_sibdist_local_tl } % better not mul \...Adj |
| 1085 |
% this is correct (there is no \_cntmA_act_sibdist_local_tl) |
| 1086 |
} |
| 1087 |
{ |
| 1088 |
\bool_if:NTF \_istroot_cntm_call_bool |
| 1089 |
{ % with \istrootcntm |
| 1090 |
\pgfmathsetmacro \xtlevdistVarA { \cntmpos * \_cntm_levdist_local_tl } |
| 1091 |
\pgfmathsetmacro \xtsibdistVarA { \cntmpos * \_cntm_act_sibdist_local_tl } |
| 1092 |
} |
| 1093 |
{ |
| 1094 |
\bool_if:NTF \_xt_levdist_local_call_bool |
| 1095 |
{ % if +#8..#9+ exists ( \_xt_levdist_local_tl defined in \istroot ) |
| 1096 |
\pgfmathsetmacro \xtlevdistVarA { \_xt_levdist_local_tl } |
| 1097 |
\pgfmathsetmacro \xtsibdistVarA { \_xt_sibdist_local_tl } |
| 1098 |
} |
| 1099 |
{ % ordinary case |
| 1100 |
\pgfmathsetmacro \xtlevdistVarA { \xtlevdist } |
| 1101 |
\pgfmathsetmacro \xtsibdistVarA { \xtsibdist } |
| 1102 |
} |
| 1103 |
} |
| 1104 |
} |
| 1105 |
%% draw branch |
| 1106 |
\tl_put_right:Nn \ischo_game_tl |
| 1107 |
{ |
| 1108 |
child [ level~distance = #2 * \xtlevdistVarA , sibling~distance = \xtsibdistVarA , #3 ] |
| 1109 |
{ |
| 1110 |
\IfBooleanTF { #1 } { \xt@ndot } { \xt@show@tndot } |
| 1111 |
\IfValueT { #7 } { \ist_payoff:nn { #8 } { #7 } } |
| 1112 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #4 } { #6 } { #5 } |
| 1113 |
} |
| 1114 |
} |
| 1115 |
} |
| 1116 |
|
| 1117 |
|
| 1118 |
% \printist (to use \istrootcntm and all its variants) |
| 1119 |
\NewDocumentCommand \printist { } |
| 1120 |
{ |
| 1121 |
\tl_use:N \ischo_game_tl |
| 1122 |
} |
| 1123 |
|
| 1124 |
% \endist |
| 1125 |
\NewDocumentCommand \endist { } |
| 1126 |
{ |
| 1127 |
% call set false for changing branch lengths with \istbA |
| 1128 |
\bool_set_false:N \_istroot_cntm_call_bool |
| 1129 |
\bool_set_false:N \_istroot_cntmA_call_bool |
| 1130 |
% final print of simple tree |
| 1131 |
\printist ; |
| 1132 |
% restore initial values for \cntmistb and \cntmAistb |
| 1133 |
\cntmistbVariablesRestore |
| 1134 |
\cntmAistbVariablesRestore |
| 1135 |
} |
| 1136 |
|
| 1137 |
|
| 1138 |
%%% continuum of branches %%% |
| 1139 |
|
| 1140 |
|
| 1141 |
%% preset for continuum of branches (used in \ISTCntm, \ISTCntmArc) |
| 1142 |
|
| 1143 |
%% cntm distances |
| 1144 |
\def\cntmdefaultlevdist{8mm} |
| 1145 |
%\def\cntmdefaultsibdist{3*\cntmdefaultlevdist} |
| 1146 |
\def\cntmdefaultsibdist{24mm} |
| 1147 |
\newcommand*\cntmlevdist{\cntmdefaultlevdist} |
| 1148 |
\pgfmathsetmacro\tmpcntmsibdist{3*\cntmlevdist} % this detour is safer |
| 1149 |
\newcommand*\cntmsibdist{\tmpcntmsibdist} |
| 1150 |
|
| 1151 |
% cntm action sibling distance (used in \ISTCntm, \ISTCntmArc) |
| 1152 |
\def\cntm@default@actsibdist{\cntmsibdist/3} |
| 1153 |
\newcommand*\cntmACTsibdist{\cntm@default@actsibdist} |
| 1154 |
\NewDocumentCommand \cntmactsibdist{m} |
| 1155 |
{ |
| 1156 |
\renewcommand*\cntmACTsibdist{#1} |
| 1157 |
} |
| 1158 |
|
| 1159 |
% \cntmdistance call test |
| 1160 |
\bool_set_false:N \cntm_distance_call_bool |
| 1161 |
\bool_set_false:N \cntm_act_sibdist_call_bool |
| 1162 |
|
| 1163 |
% \cntmdistance |
| 1164 |
% use this BEFORE \istrootcntm and \istrootcntmA |
| 1165 |
% * {cntmlevdist} {cntmsibdist} {cntm act sibdist} [cntm color] |
| 1166 |
\NewDocumentCommand \cntmdistance |
| 1167 |
{ s m G{ \cntmdefaultsibdist } g } |
| 1168 |
{ |
| 1169 |
\IfBooleanT {#1} |
| 1170 |
{ |
| 1171 |
\renewcommand*\xtlevdist { \cntmlevdist } |
| 1172 |
\renewcommand*\xtsibdist { \cntmsibdist } |
| 1173 |
} |
| 1174 |
|
| 1175 |
\renewcommand*\cntmlevdist {#2} |
| 1176 |
\renewcommand*\cntmsibdist {#3} |
| 1177 |
|
| 1178 |
\IfValueTF {#4} |
| 1179 |
{ % this call set is used in \istrootcntm and its variants |
| 1180 |
% distinguish \cntmactsibdist from \cntmsibdist, the latter used only for cntm |
| 1181 |
\bool_set_true:N \cntm_act_sibdist_call_bool |
| 1182 |
\cntmactsibdist {#4} |
| 1183 |
} |
| 1184 |
{ |
| 1185 |
\cntmactsibdist { \cntm@default@actsibdist } |
| 1186 |
} |
| 1187 |
|
| 1188 |
\bool_set_true:N \cntm_distance_call_bool |
| 1189 |
% \tikzset{level~1/.style={level~distance=\cntmlevdist,sibling~distance=\cntmsibdist}} |
| 1190 |
} |
| 1191 |
|
| 1192 |
%=========================================== |
| 1193 |
%=========================================== |
| 1194 |
|
| 1195 |
%% information sets |
| 1196 |
|
| 1197 |
% infoset layer (for every infoset) |
| 1198 |
\def\xtdefault@infosetlayer{background} |
| 1199 |
\newcommand*\xtinfosetlayer{\xtdefault@infosetlayer} |
| 1200 |
\NewDocumentCommand \setxtinfosetlayer{ G{ \xtdefault@infosetlayer } } |
| 1201 |
{ |
| 1202 |
\renewcommand*\xtinfosetlayer {#1} |
| 1203 |
} |
| 1204 |
|
| 1205 |
% infoset style (for every infoset) |
| 1206 |
\def\xtdefault@infoset@style{} |
| 1207 |
\newcommand*\xtdefaultinfosetstyle{\xtdefault@infoset@style} |
| 1208 |
|
| 1209 |
\NewDocumentCommand \setxtinfosetstyle { G{} } |
| 1210 |
{ |
| 1211 |
\tikzset { infoset~style/.style = { semithick, densely~dotted, #1 } } |
| 1212 |
} |
| 1213 |
% initial set (as infoset style = {semithick,densely dotted}) |
| 1214 |
\setxtinfosetstyle |
| 1215 |
|
| 1216 |
% infoset height (for oval type) |
| 1217 |
\def\xtdefault@infosetheight { 1em } % 1em=12pt |
| 1218 |
\newcommand*\xtinfosetheight { \xtdefault@infosetheight } |
| 1219 |
|
| 1220 |
|
| 1221 |
% \xtInfoset |
| 1222 |
% * [opt] (from) (to) {owner} [pos] |
| 1223 |
\NewDocumentCommand \xtInfoset { s O{} r() r() +G{} O{} } |
| 1224 |
{ |
| 1225 |
\begin{scope} % in group: to make \setistmathT011 local %% added: 20260/05/18 |
| 1226 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1227 |
\draw [ - , infoset~style , #2 ] (#3) to (#4) ; |
| 1228 |
\IfBooleanTF {#1} { } { \setistmathTF011 \istownertextfont{} } % must be in group |
| 1229 |
\str_case:nnF {#6} |
| 1230 |
{ |
| 1231 |
{al} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1232 |
[ above~left ] { \istownerstyle{#5} } ; } |
| 1233 |
{ar} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1234 |
[ above~right ] { \istownerstyle{#5} } ; } |
| 1235 |
{bl} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1236 |
[ below~left ] { \istownerstyle{#5} } ; } |
| 1237 |
{br} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1238 |
[ below~right ] { \istownerstyle{#5} } ; } |
| 1239 |
{l} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1240 |
[ left ] { \istownerstyle{#5} } ; } |
| 1241 |
{r} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1242 |
[ right ] { \istownerstyle{#5} } ; } |
| 1243 |
{a} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1244 |
[ above ] { \istownerstyle{#5} } ; } |
| 1245 |
{b} { \node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1246 |
[ below ] { \istownerstyle{#5} } ; } |
| 1247 |
} |
| 1248 |
{ |
| 1249 |
\node [-] at ( $ (#3) ! .5 ! (#4) $ ) |
| 1250 |
[ above , #6 ] { \istownerstyle{#5} } ; |
| 1251 |
} |
| 1252 |
\end{pgfonlayer} |
| 1253 |
\end{scope} %% added: 2026/05/18 |
| 1254 |
} |
| 1255 |
|
| 1256 |
% \xtInfosetO -- oval version |
| 1257 |
|
| 1258 |
% * [opt] (from) (to) {owner} [pos] (height dim) |
| 1259 |
\NewDocumentCommand \xtInfosetO { s O{} r() r() +G{} O{} D(){\xtdefault@infosetheight} } |
| 1260 |
{ |
| 1261 |
\begin{scope} % in group: to make \setistmathT011 local |
| 1262 |
\IfBooleanTF {#1} { } { \setistmathTF011 \istownertextfont{} } |
| 1263 |
\coordinate (xtinfoA) at (#3) ; |
| 1264 |
\coordinate (xtinfoB) at (#4) ; |
| 1265 |
\renewcommand*\xtinfosetheight {#7} |
| 1266 |
|
| 1267 |
\istgameScaleCallTestAndAdjust % (must be in a GROUP) % this determines \xsinfosetheightvar |
| 1268 |
|
| 1269 |
% \str_if_eq:eeTF { #3 } { #4 } |
| 1270 |
\str_if_eq:nnTF { #3 } { #4 } |
| 1271 |
{% singleton infoset with a circle |
| 1272 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1273 |
\draw [ - ] (xtinfoA) node [ - , draw , circle , samples=500 , inner~sep = 0pt, |
| 1274 |
minimum~size = \xtinfosetheightvar , infoset~style , #2 ] {} ; % -var needed for scaling |
| 1275 |
\end{pgfonlayer} |
| 1276 |
\draw [ draw = none , - ] (#3) node [ - , #6 ] { \istownerstyle{#5} } ; |
| 1277 |
} |
| 1278 |
{% connecting two nodes |
| 1279 |
\renewcommand*\xtinfosetheight {#7} |
| 1280 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1281 |
\path |
| 1282 |
let |
| 1283 |
\p1 = ( $ (xtinfoA.center) - (xtinfoB.center) $ ) , |
| 1284 |
\n1 = { veclen(\x1,\y1) } |
| 1285 |
in |
| 1286 |
(xtinfoA) -- (xtinfoB) |
| 1287 |
node [ - , draw , rectangle , samples = 500 , inner~sep = 0pt , |
| 1288 |
transform~shape , sloped , midway , |
| 1289 |
rounded~corners = .5*\xtinfosetheightvar , % var needed for scaling |
| 1290 |
minimum~width = \n1 + \xtinfosetheight , |
| 1291 |
minimum~height = \xtinfosetheight , infoset~style , #2 ] { } ; |
| 1292 |
\draw [ draw = none , - ] (xtinfoA) to |
| 1293 |
[ edge~node = { node [ - , #6 ] { \istownerstyle{#5} } } ] (xtinfoB) ; % (in group) |
| 1294 |
\end{pgfonlayer} |
| 1295 |
} |
| 1296 |
\end{scope} |
| 1297 |
} |
| 1298 |
|
| 1299 |
|
| 1300 |
%=========================================== |
| 1301 |
|
| 1302 |
%% CI(curve infoset) defaults |
| 1303 |
\def\xtCI@default@opt { } % CI line option |
| 1304 |
\def\xtCI@default@pos { 1 } % CI position |
| 1305 |
\def\xtCI@default@plotfactor { 1.3 } % CI curvature |
| 1306 |
\def\xtCInfosetplotfactor { \xtCI@default@plotfactor } |
| 1307 |
\newcommand*\xtCIopt { \xtCI@default@opt } |
| 1308 |
\newcommand*\xtCIpos { \xtCI@default@pos } |
| 1309 |
\newcommand*\xtCIplotfactor { \xtCI@default@plotfactor } |
| 1310 |
\def\xtcimidvarfactor { .5 } |
| 1311 |
|
| 1312 |
% base distance to CI-root and mid-point (used in \xtCInfosetO) |
| 1313 |
\def\xtCI@default@rootdist { 25mm } |
| 1314 |
|
| 1315 |
% xtCI default positions (used in \xtCInfosetO) |
| 1316 |
\def\xtCIdefaultpos { 0 } |
| 1317 |
\def\xtCIdefaultposA { -1 } |
| 1318 |
\def\xtCIdefaultposB { 1 } |
| 1319 |
|
| 1320 |
% \setxtCIplotfactor |
| 1321 |
% use this before \istrootcntmA |
| 1322 |
\NewDocumentCommand \setxtCIplotfactor { m } |
| 1323 |
{ |
| 1324 |
\renewcommand*\xtCIplotfactor {#1} |
| 1325 |
\edef\xtCInfosetplotfactor {#1} |
| 1326 |
} |
| 1327 |
|
| 1328 |
% detouring colon problem |
| 1329 |
\NewExpandableDocumentCommand \setxtCIAngleAccordingtoGrowswapCall { } |
| 1330 |
{ |
| 1331 |
\bool_if:NTF \xt_growswap_call_bool |
| 1332 |
{ \tl_set:Nn \xtCIang { 90 } } |
| 1333 |
{ \tl_set:Nn \xtCIang { -90 } } |
| 1334 |
} |
| 1335 |
|
| 1336 |
% detouring colon problem |
| 1337 |
\def\xtciang@adjusted { 35 } |
| 1338 |
\def\xtciang@adjustedLessThanOne { -15 } |
| 1339 |
|
| 1340 |
% #1 : \xtciplotfactor |
| 1341 |
% #2 : midvarfactor |
| 1342 |
\NewExpandableDocumentCommand \setxtCIAngleAccordingtoGrowswapCallForCI { m m } |
| 1343 |
{ |
| 1344 |
\bool_if:NTF \xt_growswap_call_bool |
| 1345 |
{ % growswap true |
| 1346 |
\tl_set:Nn \xtCIangNew { 90 } |
| 1347 |
\tl_set:Nn \xtcisign { -1 } |
| 1348 |
\pgfmathsetmacro \xtciangA { 45-45*(#1-1)/.6 } |
| 1349 |
\pgfmathsetmacro \xtciangB { -45+45*(#1-1)/.6 } |
| 1350 |
\tl_if_novalue:nF { #2 } %% equivalent to \IfNoValueTF |
| 1351 |
{ |
| 1352 |
\fp_compare:nTF { .5 > #2 } |
| 1353 |
{ |
| 1354 |
\fp_compare:nTF { 1 > #1 } |
| 1355 |
{ |
| 1356 |
\pgfmathsetmacro \xtciangA { \xtciangA + 60 - \xtciang@adjusted } |
| 1357 |
} |
| 1358 |
{ |
| 1359 |
\pgfmathsetmacro \xtciangA { \xtciangA - \xtciang@adjusted } |
| 1360 |
} |
| 1361 |
} |
| 1362 |
{ |
| 1363 |
\fp_compare:nT { .5 < #2 } |
| 1364 |
{ |
| 1365 |
\fp_compare:nTF { 1 > #1 } |
| 1366 |
{ |
| 1367 |
\pgfmathsetmacro \xtciangB { \xtciangB - 60 + \xtciang@adjusted } |
| 1368 |
} |
| 1369 |
{ |
| 1370 |
\pgfmathsetmacro \xtciangB { \xtciangB + \xtciang@adjusted } |
| 1371 |
} |
| 1372 |
} |
| 1373 |
} |
| 1374 |
} |
| 1375 |
} |
| 1376 |
{ % growswap false (no problem) |
| 1377 |
\tl_set:Nn \xtCIangNew { -90 } |
| 1378 |
\tl_set:Nn \xtcisign { 1 } |
| 1379 |
\pgfmathsetmacro\xtciangA{ -45+45*(#1-1)/.6 } |
| 1380 |
\pgfmathsetmacro\xtciangB{ 45-45*(#1-1)/.6 } |
| 1381 |
\fp_compare:nT { 1.0 > #1 } { \edef\xtciang@adjusted { \xtciang@adjustedLessThanOne } } |
| 1382 |
\tl_if_novalue:nF { #2 } %% equivalent to \IfNoValueTF |
| 1383 |
{ |
| 1384 |
\fp_compare:nTF { .5 > #2 } |
| 1385 |
{ |
| 1386 |
\pgfmathsetmacro \xtciangA { \xtciangA + \xtciang@adjusted } % if midvarfactor < .5 |
| 1387 |
} |
| 1388 |
{ |
| 1389 |
\fp_compare:nT { .5 < #2 } |
| 1390 |
{ |
| 1391 |
\pgfmathsetmacro \xtciangB { \xtciangB - \xtciang@adjusted } % if midvarfactor > .5 |
| 1392 |
} |
| 1393 |
} |
| 1394 |
} |
| 1395 |
} |
| 1396 |
} |
| 1397 |
|
| 1398 |
|
| 1399 |
%% detouring colon problem |
| 1400 |
\def\ciang@adjusted { 35 } |
| 1401 |
\def\ciang@adjustedLessThanOne { -15 } |
| 1402 |
|
| 1403 |
\let \cntminfosetheight \xtinfosetheight |
| 1404 |
% #1 : \ciplotfactor |
| 1405 |
\NewExpandableDocumentCommand \setciAngleAccordingtoGrowswapCallForCntmAI { m } |
| 1406 |
{ |
| 1407 |
\bool_if:NTF \xt_growswap_call_bool |
| 1408 |
{ % growswap true |
| 1409 |
\tl_set:Nn \ciangNew { 90 } |
| 1410 |
\tl_set:Nn \cisign { -1 } |
| 1411 |
\pgfmathsetmacro \ciangA { -45+45*(#1-1)/.9 } |
| 1412 |
\pgfmathsetmacro \ciangB { 45-45*(#1-1)/.9 } |
| 1413 |
} |
| 1414 |
{ % growswap false |
| 1415 |
\tl_set:Nn \ciangNew { -90 } |
| 1416 |
\tl_set:Nn \cisign { 1 } |
| 1417 |
\pgfmathsetmacro \ciangA { 45-45*(#1-1)/.9 } |
| 1418 |
\pgfmathsetmacro \ciangB { -45+45*(#1-1)/.9 } |
| 1419 |
} |
| 1420 |
} |
| 1421 |
|
| 1422 |
%% detouring abbreviations (used in \xtCInfoset) |
| 1423 |
\NewDocumentCommand \xtCInfosetAbbreviations { m } |
| 1424 |
{ |
| 1425 |
\str_case:nnF {#1} |
| 1426 |
{ |
| 1427 |
{l} { \def\xtciowner@pos { left } } |
| 1428 |
{r} { \def\xtciowner@pos { right} } |
| 1429 |
{a} { \def\xtciowner@pos { above} } |
| 1430 |
{b} { \def\xtciowner@pos { below} } |
| 1431 |
{al} { \def\xtciowner@pos { above~left } } |
| 1432 |
{ar} { \def\xtciowner@pos { above~right } } |
| 1433 |
{bl} { \def\xtciowner@pos { below~left } } |
| 1434 |
{br} { \def\xtciowner@pos { below~right } } |
| 1435 |
} |
| 1436 |
{ |
| 1437 |
\def\xtciowner@pos {#1} |
| 1438 |
} |
| 1439 |
\tl_set:Nx \xtcioptionstring { at (xtC) [ above , \xtciowner@pos ] } |
| 1440 |
} |
| 1441 |
|
| 1442 |
% detouring colon problem (for comparing two node being identical or not) |
| 1443 |
% \xtCITestCoordinates (used in \xtCInfoset) |
| 1444 |
\newif \ifxtCIsamecoordinates |
| 1445 |
\NewDocumentCommand \xtCITestCoordinates { m m } |
| 1446 |
{ |
| 1447 |
% \str_if_eq:eeTF {#1} {#2} |
| 1448 |
\str_if_eq:nnTF {#1} {#2} |
| 1449 |
{ |
| 1450 |
\xtCIsamecoordinatestrue |
| 1451 |
} |
| 1452 |
{ |
| 1453 |
\xtCIsamecoordinatesfalse |
| 1454 |
} |
| 1455 |
} |
| 1456 |
|
| 1457 |
|
| 1458 |
%++++++++++++++++++++++++++++++++++++ |
| 1459 |
%% +++ ONLY FOR DEVELOPER +++++++++++ |
| 1460 |
%% to show X points and X circles (this is used in definition of \xtCInfosetO and \cntmAInfosetO) |
| 1461 |
|
| 1462 |
% getting ready to show X points |
| 1463 |
\newif \ifxtXpoints |
| 1464 |
\newif \ifxtXpointsONE |
| 1465 |
\newif \ifxtXpointsTWO |
| 1466 |
\newif \ifxtXpointsTHREE |
| 1467 |
\newif \ifxtXpointsFOUR |
| 1468 |
\newif \ifxtXpointsLabel |
| 1469 |
% getting ready to show X circles |
| 1470 |
\newif \ifxtXcircles |
| 1471 |
\newif \ifxtXcircleX |
| 1472 |
\newif \ifxtXcircleY |
| 1473 |
|
| 1474 |
% showing X circles |
| 1475 |
% used in \xtshowXpoints |
| 1476 |
% can be used independently |
| 1477 |
\NewDocumentCommand \xtshowXcircles { m } |
| 1478 |
{ |
| 1479 |
\xtXcircleXfalse |
| 1480 |
\xtXcircleYfalse |
| 1481 |
\xtXcirclestrue |
| 1482 |
\int_compare:nTF { #1 >= 3 } |
| 1483 |
{ |
| 1484 |
\xtXcircleXtrue |
| 1485 |
\xtXcircleYtrue |
| 1486 |
} |
| 1487 |
{ |
| 1488 |
\int_compare:nTF { #1 >= 2 } |
| 1489 |
{ |
| 1490 |
\xtXcircleXfalse |
| 1491 |
\xtXcircleYtrue |
| 1492 |
} |
| 1493 |
{ |
| 1494 |
\int_compare:nT { #1 >= 1 } |
| 1495 |
{ |
| 1496 |
\xtXcircleXtrue |
| 1497 |
\xtXcircleYfalse |
| 1498 |
} |
| 1499 |
} |
| 1500 |
} |
| 1501 |
} |
| 1502 |
|
| 1503 |
% hide X circles |
| 1504 |
\NewDocumentCommand \xthideXcircles { } |
| 1505 |
{ |
| 1506 |
\xtXcirclesfalse |
| 1507 |
} |
| 1508 |
|
| 1509 |
% to control point size |
| 1510 |
\def\xtXpoint@sizeA { \istsolidnodesize } |
| 1511 |
\def\xtXpoint@sizeB { 5/3 * \istsolidnodesize } |
| 1512 |
\newcommand*\xtXpointsizeA { \xtXpoint@sizeA } |
| 1513 |
\newcommand*\xtXpointsizeB { \xtXpoint@sizeB } |
| 1514 |
|
| 1515 |
% showing X points |
| 1516 |
% \xtshowXpoints |
| 1517 |
% * {point choice num}{circle choice num}(points size dim)(basic points size dim) |
| 1518 |
% usage: \xtshowXpoints33(2pt)(3pt) |
| 1519 |
% point choice number: 0,1,2,3,4 |
| 1520 |
% circle choice number: 0,1,2,3 |
| 1521 |
% this serves \xtCInfosetO as well as \cntmAInfosetO |
| 1522 |
\NewDocumentCommand \xtshowXpoints { s m m D(){\xtXpoint@sizeA} D(){\xtXpoint@sizeB} } |
| 1523 |
{ |
| 1524 |
\renewcommand*\xtXpointsizeA {#4} |
| 1525 |
\renewcommand\xtXpointsizeB {#5} |
| 1526 |
\xtXpointsLabelfalse |
| 1527 |
\IfBooleanTF {#1} { \xtXpointsLabeltrue } { \xtXpointsLabelfalse } |
| 1528 |
\xtXpointsONEfalse |
| 1529 |
\xtXpointsTWOfalse |
| 1530 |
\xtXpointsTHREEfalse |
| 1531 |
\xtXpointsFOURfalse |
| 1532 |
\xtXpointstrue |
| 1533 |
\int_compare:nTF { #2 >= 4 } |
| 1534 |
{ |
| 1535 |
\xtXpointsTHREEtrue |
| 1536 |
\xtXpointsTWOtrue |
| 1537 |
\xtXpointsONEtrue |
| 1538 |
} |
| 1539 |
{ |
| 1540 |
\int_compare:nTF { #2 >= 3 } |
| 1541 |
{ |
| 1542 |
\xtXpointsONEfalse |
| 1543 |
\xtXpointsTWOtrue |
| 1544 |
\xtXpointsTHREEtrue |
| 1545 |
} |
| 1546 |
{ |
| 1547 |
\int_compare:nTF { #2 >= 2 } |
| 1548 |
{ |
| 1549 |
\xtXpointsONEtrue |
| 1550 |
\xtXpointsTWOtrue |
| 1551 |
\xtXpointsTHREEfalse |
| 1552 |
} |
| 1553 |
{ |
| 1554 |
\int_compare:nT { #2 >= 1 } |
| 1555 |
{ |
| 1556 |
\xtXpointsONEtrue |
| 1557 |
\xtXpointsTWOfalse |
| 1558 |
\xtXpointsTHREEfalse |
| 1559 |
} |
| 1560 |
} |
| 1561 |
} |
| 1562 |
} |
| 1563 |
\xtshowXcircles{#3} |
| 1564 |
} |
| 1565 |
|
| 1566 |
% hide X points |
| 1567 |
\NewDocumentCommand \xthideXpoints {} |
| 1568 |
{ |
| 1569 |
\xtXpointsfalse |
| 1570 |
} |
| 1571 |
%++++++++++++++++++++++++++++++++++++ |
| 1572 |
|
| 1573 |
|
| 1574 |
\ExplSyntaxOff |
| 1575 |
|
| 1576 |
%%----------------- |
| 1577 |
%% expl3 up to here (paused, because of colon problem) |
| 1578 |
%%----------------- |
| 1579 |
|
| 1580 |
%---syntaxoff----- |
| 1581 |
% \xtCInfoset |
| 1582 |
% * [line opt] (beg-coor) !offmid weight! (end-coor) <plotfactor> +G{} O{} (info height dim) |
| 1583 |
\NewDocumentCommand \xtCInfoset |
| 1584 |
{ s O{} r() d!! r() D<>{\xtCIplotfactor} +G{} O{} } |
| 1585 |
{ |
| 1586 |
\begin{scope} |
| 1587 |
\istgameScaleCallTestAndAdjust % (must be in a GROUP) |
| 1588 |
\IfBooleanTF {#1} { } { \setistmathTF011 \istownertextfont{} } % must be in a group |
| 1589 |
|
| 1590 |
\coordinate (xtA) at (#3) ; |
| 1591 |
\coordinate (xtB) at (#5) ; |
| 1592 |
\edef\xtciplotfactor {#6} |
| 1593 |
\def\xtcitension { 1 } |
| 1594 |
|
| 1595 |
\IfValueT {#4} { \edef\xtcimidvarfactor {#4} } |
| 1596 |
\setxtCIAngleAccordingtoGrowswapCallForCI {#6} {#4} |
| 1597 |
|
| 1598 |
\path |
| 1599 |
let \p1 = ($(xtA)-(xtB)$) , \n1 = { veclen(\p1) } |
| 1600 |
in \pgfextra{ \xdef\xtcidist {\n1} } ; |
| 1601 |
|
| 1602 |
\coordinate (xtcimid) at ( $ (xtA) ! .5 ! (xtB) $ ) ; |
| 1603 |
\coordinate (xtciroot) at ( $ (xtcimid) ! .5 * \xtcidist ! \xtCIangNew:(xtB) $ ) ; |
| 1604 |
\coordinate (xtcimid-var) at ( $ (xtA) ! \xtcimidvarfactor ! (xtB) $ ) ; |
| 1605 |
\coordinate (xtC) at ( $ (xtciroot) ! \xtciplotfactor ! (xtcimid-var) $ ) ; |
| 1606 |
|
| 1607 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1608 |
\draw [ - , samples=500 , tension = \xtcitension , infoset style , #2 ] |
| 1609 |
plot [ smooth ] coordinates { (xtA) (xtC) (xtB) } ; |
| 1610 |
% detoured abbreviations (\node at (xtC) [ above , #8 ] { \istownerstyle{#7} } ;) |
| 1611 |
\xtCInfosetAbbreviations {#8} |
| 1612 |
\expandafter \node \xtcioptionstring [-] { \istownerstyle{#7} }; |
| 1613 |
\end{pgfonlayer} |
| 1614 |
\end{scope} |
| 1615 |
} |
| 1616 |
|
| 1617 |
%++++++++++++++++++++++++++++++++++++ |
| 1618 |
%% +++ ONLY FOR DEVELOPER +++++++++++ |
| 1619 |
%---syntaxoff----- |
| 1620 |
% for controlling X points |
| 1621 |
\tikzset { nodedot/.style = |
| 1622 |
{ - , draw , fill , circle , inner sep = 0pt , minimum size = 2pt } |
| 1623 |
} |
| 1624 |
|
| 1625 |
%---syntaxoff----- |
| 1626 |
% * [node opt] (coor) <pos> {label} (min size dim) |
| 1627 |
\NewDocumentCommand \xtXnodedot { s O{} r() D<>{above} G{} D(){\istsolidnodesize} } |
| 1628 |
{ |
| 1629 |
\IfBooleanTF {#1} |
| 1630 |
{ |
| 1631 |
\node at (#3) [ nodedot , minimum size = #6 , |
| 1632 |
label={[label distance=-2pt]#4:{\tiny\ttfamily #5}} , #2 ] {} ; |
| 1633 |
} |
| 1634 |
{ |
| 1635 |
\node at (#3) [ nodedot , minimum size = #6 , #2 ] {} ; |
| 1636 |
} |
| 1637 |
} |
| 1638 |
%++++++++++++++++++++++++++++++++++++ |
| 1639 |
|
| 1640 |
%---syntaxoff----- |
| 1641 |
% initial values |
| 1642 |
\def\xtcibegang {0} |
| 1643 |
\def\xtciendang {0} |
| 1644 |
|
| 1645 |
\NewDocumentCommand \xtCInfosetOTurnX { m g } |
| 1646 |
{ |
| 1647 |
\renewcommand*\xtcibegang{#1} |
| 1648 |
\IfNoValueTF {#2} |
| 1649 |
{ \renewcommand*\xtciendang{-\xtcibegang} } |
| 1650 |
{ \renewcommand*\xtciendang{#2} } |
| 1651 |
} |
| 1652 |
|
| 1653 |
%---syntaxoff----- |
| 1654 |
% \xtCInfosetO |
| 1655 |
% * [line opt] (beg-coor) !offmid weight! (end-coor) <plotfactor> +G{} O{} (info height dim) |
| 1656 |
\NewDocumentCommand \xtCInfosetO |
| 1657 |
{ s O{} r() d!! r() D<>{\xtCIplotfactor} +G{} O{} D(){\xtdefault@infosetheight} } |
| 1658 |
{ |
| 1659 |
\begin{scope} |
| 1660 |
\IfBooleanTF {#1} { } { \setistmathTF011 \istownertextfont{} } % must be in a group |
| 1661 |
|
| 1662 |
\coordinate (xtA) at (#3) ; |
| 1663 |
\coordinate (xtB) at (#5) ; |
| 1664 |
\renewcommand*\xtinfosetheight{#9} |
| 1665 |
|
| 1666 |
\istgameScaleCallTestAndAdjust % (must be in a GROUP) % this determines \xsinfosetheightvar |
| 1667 |
\xtCITestCoordinates{#3}{#5} |
| 1668 |
\ifxtCIsamecoordinates |
| 1669 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1670 |
\draw [ - ] (xtA) |
| 1671 |
node [ - , draw , circle , samples = 500 , inner sep = 0pt , |
| 1672 |
minimum size=\xtinfosetheightvar , % var needed for scaling |
| 1673 |
infoset style , #2 |
| 1674 |
] { } ; |
| 1675 |
\end{pgfonlayer} |
| 1676 |
\node at (#3) [ - , #8 ] { \istownerstyle{#7} } ; |
| 1677 |
\else |
| 1678 |
\edef\xtciplotfactor{#6} |
| 1679 |
\def\xtcitension{1} |
| 1680 |
\def\xradius{ .5*\xtinfosetheight } |
| 1681 |
\xdef\tosstoxtXcircles{\xtinfosetheightvar} % +++ for developer (see below) +++ |
| 1682 |
|
| 1683 |
\IfValueT {#4} {\edef\xtcimidvarfactor{#4}} |
| 1684 |
\setxtCIAngleAccordingtoGrowswapCallForCI{#6}{#4} |
| 1685 |
|
| 1686 |
\path |
| 1687 |
let \p1 = ($(xtA)-(xtB)$) , \n1 = {veclen(\p1)} |
| 1688 |
in \pgfextra{\xdef\xtcidist{\n1}} ; |
| 1689 |
|
| 1690 |
\pgfmathsetmacro\xratio{ scalar(\xtCI@default@rootdist/\xtcidist) } |
| 1691 |
|
| 1692 |
\coordinate (xtcimid) at ($(xtA)!.5!(xtB)$) ; |
| 1693 |
\coordinate (xtciroot) at ($(xtcimid)!.5*\xtcidist!\xtCIangNew:(xtB)$) ; |
| 1694 |
\coordinate (xtcimid-var) at ($(xtA)!\xtcimidvarfactor!(xtB)$) ; |
| 1695 |
\coordinate (xtC) at ($(xtciroot)!\xtciplotfactor!(xtcimid-var)$) ; |
| 1696 |
|
| 1697 |
\path (xtciroot) -- (xtA) -- |
| 1698 |
( [turn] \xtciangA+\xtcibegang:\xradius) coordinate (xtAA1) ; |
| 1699 |
\path (xtciroot) -- (xtB) -- |
| 1700 |
( [turn] \xtciangB+\xtciendang:\xradius) coordinate (xtBB1) ; |
| 1701 |
|
| 1702 |
\coordinate (xtAA2) at ($(xtAA1)!2!(xtA)$) ; |
| 1703 |
\coordinate (xtBB2) at ($(xtBB1)!2!(xtB)$) ; |
| 1704 |
|
| 1705 |
\draw [ draw=none , - ] (xtciroot) -- (xtC) -- ([turn]0:\xradius) coordinate (xtCC1) ; |
| 1706 |
\draw [ draw=none , - ] (xtciroot) -- (xtC) -- ([turn]180:\xradius) coordinate (xtCC2) ; |
| 1707 |
|
| 1708 |
\coordinate (XpointA) at ($(xtA)!\xradius!-\xtCIangNew:(xtAA1)$) ; |
| 1709 |
\coordinate (XpointB) at ($(xtB)!\xradius! \xtCIangNew:(xtBB1)$) ; |
| 1710 |
|
| 1711 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1712 |
\draw [ - , samples = 500 , tension = \xtcitension , infoset style , #2 ] |
| 1713 |
plot [smooth] |
| 1714 |
coordinates {(xtAA1)(xtCC1)(xtBB1)} -- |
| 1715 |
plot [smooth,tension=1.75] |
| 1716 |
coordinates {(xtBB1)(XpointB)(xtBB2)} -- |
| 1717 |
plot [smooth] |
| 1718 |
coordinates {(xtBB2)(xtCC2)(xtAA2)} -- |
| 1719 |
plot [smooth,tension=1.75] |
| 1720 |
coordinates {(xtAA2)(XpointA)(xtAA1)} -- cycle ; |
| 1721 |
\node at (xtC) [ - , #8 ] { \istownerstyle{#7} } ; |
| 1722 |
\end{pgfonlayer} |
| 1723 |
\fi |
| 1724 |
\end{scope} |
| 1725 |
% back to initial values |
| 1726 |
\def\xtcibegang{0} |
| 1727 |
\def\xtciendang{0} |
| 1728 |
%++++++++++++++++++++++++++++++++++++ |
| 1729 |
%% +++ ONLY FOR DEVELOPER +++++++++++ |
| 1730 |
%% control points |
| 1731 |
\ifxtXpoints |
| 1732 |
\ifxtXpointsONE |
| 1733 |
\ifxtXpointsLabel |
| 1734 |
\xtXnodedot*[fill=green](xtA)<right>{A}(\xtXpointsizeB) |
| 1735 |
\xtXnodedot*[fill=green](xtB)<left>{B}(\xtXpointsizeB) |
| 1736 |
\xtXnodedot*[green](xtC)<right>{C}(\xtXpointsizeB) |
| 1737 |
\xtXnodedot*[fill=blue!40](xtciroot)<right>{root}(\xtXpointsizeB) |
| 1738 |
\xtXnodedot*[fill=green](xtcimid-var)<right>{m}(\xtXpointsizeB) |
| 1739 |
\else |
| 1740 |
\xtXnodedot[fill=green](xtA)<right>{A}(\xtXpointsizeB) |
| 1741 |
\xtXnodedot[fill=green](xtB)<left>{B}(\xtXpointsizeB) |
| 1742 |
\xtXnodedot[green](xtC)<right>{C}(\xtXpointsizeB) |
| 1743 |
\xtXnodedot[fill=blue!40](xtciroot)<right>{root}(\xtXpointsizeB) |
| 1744 |
\xtXnodedot[fill=green](xtcimid-var)<right>{m}(\xtXpointsizeB) |
| 1745 |
\fi |
| 1746 |
\fi |
| 1747 |
\ifxtXpointsTWO |
| 1748 |
\ifxtXpointsLabel |
| 1749 |
\xtXnodedot*[blue](xtAA1){a1}(\xtXpointsizeA) |
| 1750 |
\xtXnodedot*[red](xtAA2)<below>{a2}(\xtXpointsizeA) |
| 1751 |
\xtXnodedot*[blue](xtBB1){b1} |
| 1752 |
\xtXnodedot*[red](xtBB2)<below>{b2}(\xtXpointsizeA) |
| 1753 |
\xtXnodedot*[blue](xtCC1){c1}(\xtXpointsizeA) |
| 1754 |
\xtXnodedot*[red](xtCC2)<below>{c2}(\xtXpointsizeA) |
| 1755 |
\else |
| 1756 |
\xtXnodedot[blue](xtAA1){a1}(\xtXpointsizeA) |
| 1757 |
\xtXnodedot[red](xtAA2)<below>{a2}(\xtXpointsizeA) |
| 1758 |
\xtXnodedot[blue](xtBB1){b1}(\xtXpointsizeA) |
| 1759 |
\xtXnodedot[red](xtBB2)<below>{b2}(\xtXpointsizeA) |
| 1760 |
\xtXnodedot[blue](xtCC1){c1}(\xtXpointsizeA) |
| 1761 |
\xtXnodedot[red](xtCC2)<below>{c2}(\xtXpointsizeA) |
| 1762 |
\fi |
| 1763 |
\fi |
| 1764 |
\ifxtXpointsTHREE |
| 1765 |
\ifxtXpointsLabel |
| 1766 |
\xtXnodedot*[blue](XpointA)<left>{x}(\xtXpointsizeA) |
| 1767 |
\xtXnodedot*[red](XpointB)<right>{y}(\xtXpointsizeA) |
| 1768 |
\else |
| 1769 |
\xtXnodedot[blue](XpointA)<left>{x}(\xtXpointsizeA) |
| 1770 |
\xtXnodedot[red](XpointB)<right>{y}(\xtXpointsizeA) |
| 1771 |
\fi |
| 1772 |
\fi |
| 1773 |
\fi |
| 1774 |
% X circles |
| 1775 |
\ifxtXcircles |
| 1776 |
\ifxtXcircleX |
| 1777 |
\node at (xtA) [ - , circle , draw=blue , opacity=.5 , |
| 1778 |
minimum size=\tosstoxtXcircles ] {} ; |
| 1779 |
\fi |
| 1780 |
\ifxtXcircleY |
| 1781 |
\node at (xtB) [ - , circle , draw=red , opacity=.5 , |
| 1782 |
minimum size=\tosstoxtXcircles ] {} ; |
| 1783 |
\fi |
| 1784 |
\fi |
| 1785 |
%++++++++++++++++++++++++++++++++++++ |
| 1786 |
} |
| 1787 |
|
| 1788 |
|
| 1789 |
%% continuum of branches : information sets |
| 1790 |
|
| 1791 |
%---syntaxoff----- |
| 1792 |
%% cntmA defaults (used in \ISTCntmArc) |
| 1793 |
\def\cntmA@default@opt {} % arc line option |
| 1794 |
\def\cntmA@default@pos {1} % arc position %% default was .5 |
| 1795 |
\def\cntmA@default@plotfactor {1.333} % arc curvature |
| 1796 |
\def\cntmAInfosetplotfactor {\cntmA@default@plotfactor} |
| 1797 |
\def\cntmA@default@fillcolor {transparent} % no white |
| 1798 |
\newcommand*\cntmAopt {\cntmA@default@opt} |
| 1799 |
\newcommand*\cntmApos {\cntmA@default@pos} |
| 1800 |
\newcommand*\cntmAplotfactor {\cntmA@default@plotfactor} |
| 1801 |
\newcommand*\cntmAfillcolor {\cntmA@default@fillcolor} |
| 1802 |
|
| 1803 |
%---syntaxoff----- |
| 1804 |
% \cntmAplotfactorset |
| 1805 |
% use this before \istrootcntmA |
| 1806 |
\NewDocumentCommand \cntmAplotfactorset { m } |
| 1807 |
{ |
| 1808 |
\renewcommand*\cntmAplotfactor {#1} |
| 1809 |
\edef\cntmAInfosetplotfactor {#1} |
| 1810 |
} |
| 1811 |
|
| 1812 |
%---syntaxoff----- |
| 1813 |
% \cntmApreset |
| 1814 |
% use this before \istrootcntmA |
| 1815 |
% \cntmApreset |
| 1816 |
% [Aopt]<plotfactor>{Apos}[fill color] |
| 1817 |
% use fill color only at the second bracket option (not first) |
| 1818 |
\NewDocumentCommand \cntmApreset |
| 1819 |
{ O{\cntmA@default@opt} D<>{\cntmA@default@plotfactor} g O{\cntmA@default@fillcolor} } |
| 1820 |
{ |
| 1821 |
\IfNoValueTF {#3} |
| 1822 |
{ |
| 1823 |
\renewcommand*\cntmApos {\cntmA@default@pos} |
| 1824 |
} |
| 1825 |
{ |
| 1826 |
\renewcommand*\cntmApos {#3} |
| 1827 |
} |
| 1828 |
\renewcommand*\cntmAopt {#1} |
| 1829 |
\cntmAplotfactorset {#2} |
| 1830 |
\renewcommand*\cntmAfillcolor {#4} |
| 1831 |
} |
| 1832 |
|
| 1833 |
|
| 1834 |
%---syntaxoff----- |
| 1835 |
% cntm layer |
| 1836 |
\def\cntm@default@layer{background} % better than behind |
| 1837 |
\NewDocumentCommand \cntmlayerset{ m } |
| 1838 |
{ |
| 1839 |
\renewcommand*\cntm@default@layer{#1} |
| 1840 |
} |
| 1841 |
|
| 1842 |
%---syntaxoff----- |
| 1843 |
% cntmA layer |
| 1844 |
\def\cntmA@default@layer{behind} % better than background |
| 1845 |
\newcommand*\cntmAdefaultlayer{\cntmA@default@layer} |
| 1846 |
\NewDocumentCommand \cntmAlayerpreset{ G{\cntmA@default@layer} } |
| 1847 |
{ |
| 1848 |
\renewcommand*\cntmAdefaultlayer{#1} |
| 1849 |
} |
| 1850 |
|
| 1851 |
|
| 1852 |
%---syntaxoff----- |
| 1853 |
% \cntmAInfoset |
| 1854 |
% [Aopt] (cntm-root) <\xtCIplotfactor> {addto cntmApos} |
| 1855 |
\NewDocumentCommand \cntmAInfoset |
| 1856 |
{ O{\cntmA@default@opt} r() D<>{\cntmAInfosetplotfactor} G{.1} } |
| 1857 |
{ |
| 1858 |
% save arc options and position |
| 1859 |
\let\tmpAIpos\cntmApos |
| 1860 |
\let\tmpAIopt\cntmAopt |
| 1861 |
\pgfmathsetmacro{\cntmAInfosetpos}{\cntmApos+#4} |
| 1862 |
|
| 1863 |
\coordinate (ciroot) at (#2) ; |
| 1864 |
\coordinate (ciA) at ($(ciroot)!\cntmAInfosetpos!(cntm-1)$) ; |
| 1865 |
\coordinate (ciB) at ($(ciroot)!\cntmAInfosetpos!(cntm-2)$) ; |
| 1866 |
\edef\ciplotfactor{#3} |
| 1867 |
\def\citension{1} |
| 1868 |
|
| 1869 |
\pgfmathsetmacro\cidistratio{ scalar(\cntmlevdist/\cntmsibdist) } |
| 1870 |
\pgfmathsetmacro\ciplotfactorVal{ 1 + (\ciplotfactor-1) * sqrt(1/3) / sqrt(\cidistratio) } |
| 1871 |
|
| 1872 |
\coordinate (cimid) at ($(ciA)!.5!(ciB)$) ; |
| 1873 |
\coordinate (ciC) at ($(ciroot)!\ciplotfactorVal!(cimid)$) ; |
| 1874 |
|
| 1875 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1876 |
\draw [ - , samples=500 , tension = \citension , infoset style , #1 ] |
| 1877 |
plot [smooth] coordinates {(ciA)(ciC)(ciB)} ; |
| 1878 |
\end{pgfonlayer} |
| 1879 |
\let\cntmApos\tmpAIpos |
| 1880 |
\let\cntmAopt\tmpAIopt |
| 1881 |
} |
| 1882 |
|
| 1883 |
|
| 1884 |
%---syntaxoff----- |
| 1885 |
% \cntmAInfosetO |
| 1886 |
% [Aopt] (cntm-root) <plot factor> {Apos} [turn X-ang] (infoset height) |
| 1887 |
\NewDocumentCommand \cntmAInfosetO |
| 1888 |
{ O{\cntmA@default@opt} r() D<>{\cntmAInfosetplotfactor} G{\cntmApos} O{0} D(){\xtdefault@infosetheight} } |
| 1889 |
{ |
| 1890 |
\begin{scope} |
| 1891 |
\coordinate (ciroot) at (#2) ; |
| 1892 |
\coordinate (ciA) at ($(ciroot)!#4!(cntm-1)$) ; |
| 1893 |
\coordinate (ciB) at ($(ciroot)!#4!(cntm-2)$) ; |
| 1894 |
\edef\ciplotfactor{#3} |
| 1895 |
\def\ciAdjXang{#5} |
| 1896 |
\def\cntminfosetheight{#6} |
| 1897 |
\def\citension{1} |
| 1898 |
|
| 1899 |
\istgameScaleCallTestAndAdjust % (must be in a GROUP) |
| 1900 |
\def\ciradius{ .5*\cntminfosetheight } % not -var |
| 1901 |
\xdef\tosstocntmXcircles{\cntminfosetheightvar} % +++ for developer (see below) +++ |
| 1902 |
\setciAngleAccordingtoGrowswapCallForCntmAI{#3} |
| 1903 |
|
| 1904 |
\pgfmathsetmacro\cidistratio{ scalar(\cntmlevdist/\cntmsibdist) } |
| 1905 |
% to ease the curvature (using \cidistratio) |
| 1906 |
\pgfmathsetmacro\ciplotfactorVal{ 1 + (\ciplotfactor-1)*sqrt(1/3)/sqrt(\cidistratio) } |
| 1907 |
% adjust Xangle |
| 1908 |
\ifdim .5pt <\cidistratio pt |
| 1909 |
\pgfmathsetmacro\ciDefaultAdjXang{ -5 + 30*\cidistratio } % (10 if ratio=1/2 ) |
| 1910 |
\else |
| 1911 |
\pgfmathsetmacro\ciDefaultAdjXang{ -10 + 30*\cidistratio } % (0 if ratio=1/3 ) |
| 1912 |
\fi |
| 1913 |
\pgfmathsetmacro\ciXadj{ \cisign * (\ciDefaultAdjXang - \ciAdjXang) } |
| 1914 |
|
| 1915 |
% defining coordinates |
| 1916 |
\coordinate (cimid) at ($(ciA)!.5!(ciB)$) ; |
| 1917 |
\coordinate (ciC) at ($(ciroot)!\ciplotfactorVal!(cimid)$) ; |
| 1918 |
|
| 1919 |
\path (ciroot) -- (ciA) -- |
| 1920 |
( [turn] \ciangA-\ciXadj:\ciradius) coordinate (ciAA1) ; |
| 1921 |
\path (ciroot) -- (ciB) -- |
| 1922 |
( [turn] \ciangB+\ciXadj:\ciradius) coordinate (ciBB1) ; |
| 1923 |
|
| 1924 |
\coordinate (ciAA2) at ($(ciAA1)!2!(ciA)$) ; |
| 1925 |
\coordinate (ciBB2) at ($(ciBB1)!2!(ciB)$) ; |
| 1926 |
|
| 1927 |
\draw [ draw=none , - ] |
| 1928 |
(ciroot) -- (ciC) -- ([turn]0:\ciradius) coordinate (ciCC1) ; |
| 1929 |
\draw [ draw=none , - ] |
| 1930 |
(ciroot) -- (ciC) -- ([turn]180:\ciradius) coordinate (ciCC2) ; |
| 1931 |
|
| 1932 |
\coordinate (ciXpointA) at ($(ciA)!\ciradius! \ciangNew:(ciAA1)$) ; |
| 1933 |
\coordinate (ciXpointB) at ($(ciB)!\ciradius!-\ciangNew:(ciBB1)$) ; |
| 1934 |
|
| 1935 |
\begin{pgfonlayer}{\xtinfosetlayer} |
| 1936 |
\draw [ - , samples=500 , tension = \citension , infoset style , #1 ] |
| 1937 |
plot [smooth] |
| 1938 |
coordinates {(ciAA1)(ciCC1)(ciBB1)} -- |
| 1939 |
plot [smooth,tension=1.75] |
| 1940 |
coordinates {(ciBB1)(ciXpointB)(ciBB2)} -- |
| 1941 |
plot [smooth] |
| 1942 |
coordinates {(ciBB2)(ciCC2)(ciAA2)} -- |
| 1943 |
plot [smooth,tension=1.75] |
| 1944 |
coordinates {(ciAA2)(ciXpointA)(ciAA1)} -- cycle ; |
| 1945 |
\end{pgfonlayer} |
| 1946 |
\end{scope} |
| 1947 |
%++++++++++++++++++++++++++++++++++++ |
| 1948 |
%% +++ ONLY FOR DEVELOPER +++++++++++ |
| 1949 |
%% control points |
| 1950 |
\ifxtXpoints |
| 1951 |
\ifxtXpointsONE |
| 1952 |
\ifxtXpointsLabel |
| 1953 |
\xtXnodedot*[fill=green](ciA)<right>{A}(\xtXpointsizeB) |
| 1954 |
\xtXnodedot*[fill=green](ciB)<left>{B}(\xtXpointsizeB) |
| 1955 |
\xtXnodedot*[green](ciC)<right>{A}(\xtXpointsizeB) |
| 1956 |
\xtXnodedot*[fill=green](ciroot)(\xtXpointsizeB) |
| 1957 |
\xtXnodedot*[fill=green](cimid)<right>{m}(\xtXpointsizeB) |
| 1958 |
\else |
| 1959 |
\xtXnodedot[fill=green](ciA)<right>{A}(\xtXpointsizeB) |
| 1960 |
\xtXnodedot[fill=green](ciB)<left>{B}(\xtXpointsizeB) |
| 1961 |
\xtXnodedot[green](ciC)<right>{A}(\xtXpointsizeB) |
| 1962 |
\xtXnodedot[fill=green](ciroot)(\xtXpointsizeB) |
| 1963 |
\xtXnodedot[fill=green](cimid)<right>{m}(\xtXpointsizeB) |
| 1964 |
\fi |
| 1965 |
\fi |
| 1966 |
\ifxtXpointsTWO |
| 1967 |
\ifxtXpointsLabel |
| 1968 |
\xtXnodedot*[blue](ciAA1)<below>{a1}(\xtXpointsizeA) |
| 1969 |
\xtXnodedot*[red](ciAA2)<above>{a2}(\xtXpointsizeA) |
| 1970 |
\xtXnodedot*[blue](ciBB1)<below>{b1}(\xtXpointsizeA) |
| 1971 |
\xtXnodedot*[red](ciBB2)<above>{b2}(\xtXpointsizeA) |
| 1972 |
\xtXnodedot*[blue](ciCC1)<below>{c1}(\xtXpointsizeA) |
| 1973 |
\xtXnodedot*[red](ciCC2)<above>{c2}(\xtXpointsizeA) |
| 1974 |
\else |
| 1975 |
\xtXnodedot[blue](ciAA1)<below>{a1}(\xtXpointsizeA) |
| 1976 |
\xtXnodedot[red](ciAA2)<above>{a2}(\xtXpointsizeA) |
| 1977 |
\xtXnodedot[blue](ciBB1)<below>{b1}(\xtXpointsizeA) |
| 1978 |
\xtXnodedot[red](ciBB2)<above>{b2}(\xtXpointsizeA) |
| 1979 |
\xtXnodedot[blue](ciCC1)<below>{c1}(\xtXpointsizeA) |
| 1980 |
\xtXnodedot[red](ciCC2)<above>{c2}(\xtXpointsizeA) |
| 1981 |
\fi |
| 1982 |
\fi |
| 1983 |
\ifxtXpointsTHREE |
| 1984 |
\ifxtXpointsLabel |
| 1985 |
\xtXnodedot*[blue](ciXpointA)<left>{x}(\xtXpointsizeA) |
| 1986 |
\xtXnodedot*[red](ciXpointB)<right>{y}(\xtXpointsizeA) |
| 1987 |
\else |
| 1988 |
\xtXnodedot[blue](ciXpointA)<left>{x}(\xtXpointsizeA) |
| 1989 |
\xtXnodedot[red](ciXpointB)<right>{y}(\xtXpointsizeA) |
| 1990 |
\fi |
| 1991 |
\fi |
| 1992 |
\fi |
| 1993 |
% X circles |
| 1994 |
\ifxtXcircles |
| 1995 |
\ifxtXcircleX |
| 1996 |
\node at (ciA) [ - , circle , draw=blue , opacity=.5, |
| 1997 |
minimum size=\tosstocntmXcircles ] {} ; |
| 1998 |
\fi |
| 1999 |
\ifxtXcircleY |
| 2000 |
\node at (ciB) [ - , circle , draw=red , opacity=.5 , |
| 2001 |
minimum size=\tosstocntmXcircles ] {} ; |
| 2002 |
\fi |
| 2003 |
\fi |
| 2004 |
%++++++++++++++++++++++++++++++++++++ |
| 2005 |
} |
| 2006 |
|
| 2007 |
|
| 2008 |
%%----------------- |
| 2009 |
%% expl3 from here again |
| 2010 |
%%----------------- |
| 2011 |
|
| 2012 |
\ExplSyntaxOn |
| 2013 |
|
| 2014 |
%% preset for \istb (for outermost branches) for "cntm triangle" and "cntm arc" |
| 2015 |
% cntmA stands for "cntm arc" |
| 2016 |
|
| 2017 |
% cntm color |
| 2018 |
|
| 2019 |
\def\cntm@default@opt { } |
| 2020 |
\newcommand*\cntmopt { \cntm@default@opt } |
| 2021 |
|
| 2022 |
\def\cntm@default@drawcolor { black!25 } |
| 2023 |
\newcommand*\cntmdrawcolor { \cntm@default@drawcolor } |
| 2024 |
\def\cntm@default@fillcolor { \cntm@default@drawcolor } |
| 2025 |
\newcommand*\cntmfillcolor { \cntm@default@fillcolor } |
| 2026 |
\def\cntm@default@pos { 1 } |
| 2027 |
\newcommand*\cntmpos { \cntm@default@pos } |
| 2028 |
|
| 2029 |
% cntm outermost draw options |
| 2030 |
\def\cntm@default@branchopt { draw = none } % "draw=none" needed to keep cntm "triangle" default |
| 2031 |
\newcommand*\cntmbranchopt { \cntm@default@branchopt } |
| 2032 |
|
| 2033 |
\def\cntmLeftAL { } % leftmost AL |
| 2034 |
\def\cntmLeftALpos { } % leftmost AL position |
| 2035 |
\def\cntmRightAL { } % rightmost AL |
| 2036 |
\def\cntmRightALpos { } % rightmost AL position |
| 2037 |
|
| 2038 |
% cntmA outermost draw options |
| 2039 |
\def\cntmAbranchdrawopt { } % "empty" needed for cntmA outermost "branch" control |
| 2040 |
|
| 2041 |
\def\cntmALeftAL { } % leftmost AL |
| 2042 |
\def\cntmALeftALpos { } % leftmost AL position |
| 2043 |
\def\cntmARightAL { } % rightmost AL |
| 2044 |
\def\cntmARightALpos { } % rightmost AL position |
| 2045 |
|
| 2046 |
|
| 2047 |
\bool_set_false:N \_cntm_pos_call_bool |
| 2048 |
|
| 2049 |
% \cntmpreset |
| 2050 |
% * [ draw, color, fill ] { shrink factor } [ fill color ] |
| 2051 |
% the first, if exists, [ fill=color ] wins the second [ fill color ] |
| 2052 |
% that is, \cntmopt (with fill=color) wins \cntmfillcolor |
| 2053 |
\NewDocumentCommand \cntmpreset { s O{} g o } |
| 2054 |
{ |
| 2055 |
\IfNoValueTF {#3} |
| 2056 |
{ |
| 2057 |
\renewcommand*\cntmpos{\cntm@default@pos} |
| 2058 |
} |
| 2059 |
{ |
| 2060 |
\renewcommand*\cntmpos{#3} |
| 2061 |
\bool_set_true:N \_cntm_pos_call_bool |
| 2062 |
} |
| 2063 |
\IfBooleanTF {#1} |
| 2064 |
{ |
| 2065 |
\IfValueTF {#4} |
| 2066 |
{ |
| 2067 |
\renewcommand*\cntmfillcolor{#4} |
| 2068 |
\renewcommand*\cntmopt{ - , solid , draw = black , fill = \cntmfillcolor , #2 } |
| 2069 |
} |
| 2070 |
{ |
| 2071 |
\renewcommand*\cntmopt{ - , solid , draw = black , fill = none , #2 } |
| 2072 |
} |
| 2073 |
} |
| 2074 |
{ |
| 2075 |
\IfValueT {#4} |
| 2076 |
{ |
| 2077 |
\renewcommand*\cntmdrawcolor{#4} |
| 2078 |
\let\cntmfillcolor\cntmdrawcolor |
| 2079 |
} |
| 2080 |
\renewcommand*\cntmopt{ - , solid, draw = \cntmdrawcolor , fill = \cntmfillcolor, #2} |
| 2081 |
} |
| 2082 |
} |
| 2083 |
|
| 2084 |
|
| 2085 |
% ============ |
| 2086 |
% complication needed to resolve tex expansion issues |
| 2087 |
% ------------ |
| 2088 |
|
| 2089 |
% \cntmistb |
| 2090 |
% complication: |
| 2091 |
% controls options for outermost branches via \l_cntm_left/rightmost_branch_opt_tl |
| 2092 |
% finally used in \istrootcntm and \istrootocntm |
| 2093 |
% USE this BEFORE \istrootcntm |
| 2094 |
% * [ line opt ] { LEFT AL } [ LEFT pos ] { RIGHT AL } [ RIGHT pos ] |
| 2095 |
\NewDocumentCommand \cntmistb{ s O{} +G{} O{} +G{} O{} } |
| 2096 |
{ |
| 2097 |
% to resolve the nullfont problem (ndh) |
| 2098 |
\tl_set_eq:NN \l_nullfont_tl \cntm@show@endpoint |
| 2099 |
|
| 2100 |
\renewcommand*\cntmbranchopt { - , draw=none, #2 } |
| 2101 |
\renewcommand*\cntmLeftAL {#3} |
| 2102 |
\renewcommand*\cntmRightAL {#5} |
| 2103 |
\renewcommand*\cntmLeftALpos |
| 2104 |
{ |
| 2105 |
\str_case:nnF {#4} |
| 2106 |
{ |
| 2107 |
{al} { above~left , text~depth = .25ex , |
| 2108 |
xshift = \istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2109 |
{ar} { above~right , text~depth = .25ex , |
| 2110 |
xshift = -\istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2111 |
{bl} { below~left , text~depth = .25ex , |
| 2112 |
xshift = \istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2113 |
{br} { below~right , text~depth = .25ex , |
| 2114 |
xshift = -\istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2115 |
{l} { left , text~depth = .25ex , xshift = -\xtALxShift } |
| 2116 |
{r} { right , text~depth = .25ex , xshift = \xtALxShift } |
| 2117 |
{a} { above , text~depth = .25ex , xshift = \xtALxShift } |
| 2118 |
{b} { below , text~depth = .25ex , xshift = -\xtALxShift } |
| 2119 |
} |
| 2120 |
{ |
| 2121 |
#4 |
| 2122 |
} |
| 2123 |
} |
| 2124 |
\renewcommand*\cntmRightALpos |
| 2125 |
{ |
| 2126 |
\str_case:nnF {#6} |
| 2127 |
{ |
| 2128 |
{al} { above~left , text~depth = .25ex , |
| 2129 |
xshift = \istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2130 |
{ar} { above~right , text~depth = .25ex , |
| 2131 |
xshift = -\istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2132 |
{bl} { below~left , text~depth = .25ex , |
| 2133 |
xshift = \istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2134 |
{br} { below~right , text~depth = .25ex , |
| 2135 |
xshift = -\istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2136 |
{l} { left , text~depth = .25ex , xshift = -\xtALxShift } |
| 2137 |
{r} { right , text~depth = .25ex , xshift = \xtALxShift } |
| 2138 |
{a} { above , text~depth = .25ex , xshift = \xtALxShift } |
| 2139 |
{b} { below , text~depth = .25ex , xshift = -\xtALxShift } |
| 2140 |
} |
| 2141 |
{ |
| 2142 |
#6 |
| 2143 |
} |
| 2144 |
} |
| 2145 |
\IfBooleanTF {#1} |
| 2146 |
{ % disobey \xtShowEndPoints* -- force to print solid node |
| 2147 |
\renewcommand*\cntm@show@endpoint { node [ at~end , solid~node ] {} } |
| 2148 |
} |
| 2149 |
{ % obey \xtShowEndPoints* and toss the value to \istrootcntm(A) via \cntmOUTERistb |
| 2150 |
\tl_set:NV \cntm@show@endpoint \l_nullfont_tl % (ndh) |
| 2151 |
} |
| 2152 |
} |
| 2153 |
|
| 2154 |
|
| 2155 |
% \cntmAistb |
| 2156 |
% complication: |
| 2157 |
% controls options for outermost branches via \l_cntmA_left/rightmost_branch_opt_tl |
| 2158 |
% finally used in \istrootcntmA and \istrootocntmA |
| 2159 |
% USE this BEFORE \istrootcntmA |
| 2160 |
% * [ line opt ] { LEFT AL } [ LEFT pos ] { RIGHT AL } [ RIGHT pos ] |
| 2161 |
\NewDocumentCommand \cntmAistb { s O{-} +G{} O{} +G{} O{} } |
| 2162 |
{ |
| 2163 |
% to resolve the nullfont problem (ndh) |
| 2164 |
\tl_set_eq:NN \l_nullfont_tl \cntm@show@endpoint |
| 2165 |
|
| 2166 |
\renewcommand*\cntmAbranchdrawopt {#2} |
| 2167 |
\renewcommand*\cntmALeftAL {#3} |
| 2168 |
\renewcommand*\cntmARightAL {#5} |
| 2169 |
\renewcommand*\cntmALeftALpos |
| 2170 |
{ |
| 2171 |
\str_case:nnF {#4} |
| 2172 |
{ |
| 2173 |
{al} { above~left , text~depth = .25ex , |
| 2174 |
xshift = \istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2175 |
{ar} { above~right , text~depth = .25ex , |
| 2176 |
xshift = -\istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2177 |
{bl} { below~left , text~depth = .25ex , |
| 2178 |
xshift = \istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2179 |
{br} { below~right , text~depth = .25ex , |
| 2180 |
xshift = -\istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2181 |
{l} { left , text~depth = .25ex , xshift = -\xtALxShift } |
| 2182 |
{r} { right , text~depth = .25ex , xshift = \xtALxShift } |
| 2183 |
{a} { above , text~depth = .25ex , xshift = \xtALxShift } |
| 2184 |
{b} { below , text~depth = .25ex , xshift = -\xtALxShift } |
| 2185 |
} |
| 2186 |
{ |
| 2187 |
#4 |
| 2188 |
} |
| 2189 |
} |
| 2190 |
\renewcommand*\cntmARightALpos |
| 2191 |
{ |
| 2192 |
\str_case:nnF {#6} |
| 2193 |
{ |
| 2194 |
{al} { above~left , text~depth = .25ex , |
| 2195 |
xshift = \istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2196 |
{ar} { above~right , text~depth = .25ex , |
| 2197 |
xshift = -\istactionlabelxshift , yshift = -\istactionlabelyshift } |
| 2198 |
{bl} { below~left , text~depth = .25ex , |
| 2199 |
xshift = \istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2200 |
{br} { below~right , text~depth = .25ex , |
| 2201 |
xshift = -\istactionlabelxshift , yshift = \istactionlabelyshift } |
| 2202 |
{l} { left , text~depth = .25ex , xshift = -\xtALxShift } |
| 2203 |
{r} { right , text~depth = .25ex , xshift = \xtALxShift } |
| 2204 |
{a} { above , text~depth = .25ex , xshift = \xtALxShift } |
| 2205 |
{b} { below , text~depth = .25ex , xshift = -\xtALxShift } |
| 2206 |
} |
| 2207 |
{ |
| 2208 |
#6 |
| 2209 |
} |
| 2210 |
} |
| 2211 |
\IfBooleanTF {#1} |
| 2212 |
{ % disobey \xtShowEndPoints* -- force to print solid node |
| 2213 |
\renewcommand*\cntm@show@endpoint { node [ at~end , solid~node ] {} } |
| 2214 |
} |
| 2215 |
{ % obey \xtShowEndPoints* and toss the value to \istrootcntm(A) via \cntmOUTERistb |
| 2216 |
\tl_set:NV \cntm@show@endpoint \l_nullfont_tl % (ndh) |
| 2217 |
} |
| 2218 |
} |
| 2219 |
|
| 2220 |
% to restore initial values after \cntmistb |
| 2221 |
% (restore is done by \endist) |
| 2222 |
\def\cntmistbVariablesRestore |
| 2223 |
{ |
| 2224 |
\renewcommand*\cntmbranchopt { \cntm@default@branchopt } |
| 2225 |
\renewcommand*\cntmLeftAL { } |
| 2226 |
\renewcommand*\cntmRightAL { } |
| 2227 |
\renewcommand*\cntmLeftALpos { } |
| 2228 |
\renewcommand*\cntmRightALpos { } |
| 2229 |
} |
| 2230 |
|
| 2231 |
% to restore initial values after \cntmistb |
| 2232 |
% (restore is done by \endist) |
| 2233 |
\def\cntmAistbVariablesRestore |
| 2234 |
{ |
| 2235 |
\renewcommand*\cntmAbranchdrawopt { } |
| 2236 |
\renewcommand*\cntmALeftAL { } |
| 2237 |
\renewcommand*\cntmARightAL { } |
| 2238 |
\renewcommand*\cntmALeftALpos { } |
| 2239 |
\renewcommand*\cntmARightALpos { } |
| 2240 |
} |
| 2241 |
|
| 2242 |
% \cntmistb LEFT/RIGHT options: |
| 2243 |
% (still in the complication) collecting branch options input by \cntmistb |
| 2244 |
% the collected token list will be used in \istrootcntm and \istrootocntm |
| 2245 |
% [ - , \cntmAbranchdrawopt ] { LEFT AL } [ LEFT pos ] { RIGHT AL } [ RIGHT pos ] |
| 2246 |
\cs_new:Npn \_collect_cntm_leftmost_branch_opts: |
| 2247 |
{ |
| 2248 |
\tl_set:Nn \l_cntm_leftmost_branch_opt_tl { [ - , } |
| 2249 |
\tl_put_right:Nx \l_cntm_leftmost_branch_opt_tl { \cntmbranchopt ] } |
| 2250 |
\tl_put_right:Nn \l_cntm_leftmost_branch_opt_tl { { \istactionlabelstyle { \cntmLeftAL } } } |
| 2251 |
\tl_put_right:Nx \l_cntm_leftmost_branch_opt_tl { [ \cntmLeftALpos ] } |
| 2252 |
} |
| 2253 |
|
| 2254 |
\cs_new:Npn \_collect_cntm_rightmost_branch_opts: |
| 2255 |
{ |
| 2256 |
\tl_set:Nn \l_cntm_rightmost_branch_opt_tl { [ - , } |
| 2257 |
\tl_put_right:Nx \l_cntm_rightmost_branch_opt_tl { \cntmbranchopt ] } |
| 2258 |
\tl_put_right:Nn \l_cntm_rightmost_branch_opt_tl { { \istactionlabelstyle { \cntmRightAL } } } |
| 2259 |
\tl_put_right:Nx \l_cntm_rightmost_branch_opt_tl { [ \cntmRightALpos ] } |
| 2260 |
} |
| 2261 |
|
| 2262 |
|
| 2263 |
% \cntmAistb LEFT/RIGHT options: |
| 2264 |
% (still in the complication) collecting branch options input by \cntmAistb |
| 2265 |
% the collected token list will be used in \istrootcntmA and \istrootocntmA |
| 2266 |
% [ - , \cntmAbranchdrawopt ] { LEFT AL } [ LEFT pos ] { RIGHT AL } [ RIGHT pos ] |
| 2267 |
\cs_new:Npn \_collect_cntmA_leftmost_branch_opts: |
| 2268 |
{ |
| 2269 |
\tl_set:Nn \l_cntmA_leftmost_branch_opt_tl { [ - , } |
| 2270 |
\tl_put_right:Nx \l_cntmA_leftmost_branch_opt_tl { \cntmAbranchdrawopt ] } |
| 2271 |
\tl_put_right:Nn \l_cntmA_leftmost_branch_opt_tl { { \istactionlabelstyle { \cntmALeftAL } } } |
| 2272 |
\tl_put_right:Nx \l_cntmA_leftmost_branch_opt_tl { [ \cntmALeftALpos ] } |
| 2273 |
} |
| 2274 |
|
| 2275 |
\cs_new:Npn \_collect_cntmA_rightmost_branch_opts: |
| 2276 |
{ |
| 2277 |
\tl_set:Nn \l_cntmA_rightmost_branch_opt_tl { [ - , } |
| 2278 |
\tl_put_right:Nx \l_cntmA_rightmost_branch_opt_tl { \cntmAbranchdrawopt ] } |
| 2279 |
\tl_put_right:Nn \l_cntmA_rightmost_branch_opt_tl { { \istactionlabelstyle { \cntmARightAL } } } |
| 2280 |
\tl_put_right:Nx \l_cntmA_rightmost_branch_opt_tl { [ \cntmARightALpos ] } |
| 2281 |
} |
| 2282 |
|
| 2283 |
|
| 2284 |
% complication needed to resolve tex expansion issues (for cntm triangle) |
| 2285 |
% this will be used to draw cntm triangle in \istrootcntm and \istrootcntmo |
| 2286 |
% [ - , draw = \cntmdrawcolor , fill = \cntmfillcolor ] |
| 2287 |
\cs_new:Npn \_collect_cntm_triangle_cmdstr: |
| 2288 |
{ |
| 2289 |
\tl_set:Nn \l_tmp_option_str_tl { [ - , } |
| 2290 |
\tl_put_right:Nn \l_tmp_option_str_tl { draw = } |
| 2291 |
\tl_put_right:Nx \l_tmp_option_str_tl { \cntmdrawcolor , } |
| 2292 |
\tl_put_right:Nn \l_tmp_option_str_tl { fill = } |
| 2293 |
\tl_put_right:Nx \l_tmp_option_str_tl { \cntmfillcolor , } |
| 2294 |
\tl_put_right:Nx \l_tmp_option_str_tl { \cntmopt ] } |
| 2295 |
} |
| 2296 |
|
| 2297 |
|
| 2298 |
% \cntmOUTERistb |
| 2299 |
% modification of \istb for cntm outermost branches with NO PAYOFF |
| 2300 |
% this actually draws outermost branches (used in \istrootcntm and \istrootocntm) |
| 2301 |
\NewDocumentCommand \cntmOUTERistb |
| 2302 |
{ s D<>{} O{} +G{} O{} } |
| 2303 |
{ |
| 2304 |
\tl_put_right:Nn \ischo_game_tl |
| 2305 |
{ |
| 2306 |
child [ #2 ] |
| 2307 |
{ |
| 2308 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #3 } { #5 } { #4 } |
| 2309 |
% the next must NOT go BEFORE \ist_move:nnn : PROBLEMatic (possibly TikZ problem) |
| 2310 |
\IfBooleanTF { #1 } { \cntm@ndot } { \cntm@show@endpoint } |
| 2311 |
} |
| 2312 |
} |
| 2313 |
} |
| 2314 |
|
| 2315 |
|
| 2316 |
% \cntmAOUTERistb |
| 2317 |
% modification of \istb for cntmA outermost branches with NO PAYOFF |
| 2318 |
% this actually draws outermost branches (used in \istrootcntmA and \istrootocntmA) |
| 2319 |
\NewDocumentCommand \cntmAOUTERistb |
| 2320 |
{ s D<>{} O{} +G{} O{} +g O{\istgrowdirection} } |
| 2321 |
{ |
| 2322 |
\tl_put_right:Nn \ischo_game_tl |
| 2323 |
{ |
| 2324 |
child [ #2 ] |
| 2325 |
{ |
| 2326 |
\ist_move:nnn { \xt@show@midarrow , \xt@show@arrow , #3 } { #5 } { #4 } |
| 2327 |
% the next must NOT go BEFORE \ist_move:nnn : PROBLEMatic (possibly TikZ problem) |
| 2328 |
\IfBooleanTF { #1 } { \cntm@ndot } { \cntm@show@endpoint } |
| 2329 |
} |
| 2330 |
} |
| 2331 |
} |
| 2332 |
|
| 2333 |
% ------------ |
| 2334 |
% complication so far needed to resolve tex expansion issues |
| 2335 |
% still more complication below |
| 2336 |
% ============ |
| 2337 |
|
| 2338 |
|
| 2339 |
%% main macros: continuum of branches |
| 2340 |
|
| 2341 |
% \istrootcntm -- standard cntm version |
| 2342 |
% ' [grow] (root) (at) [node style] <angle> {owner} +cntmlevdist..cntmsibdist+ |
| 2343 |
\NewDocumentCommand \istrootcntm |
| 2344 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. d.+ } |
| 2345 |
{ |
| 2346 |
% to suppress \xtShowArrows for cntm |
| 2347 |
\let\tmp@xt@show@arrow\xt@show@arrow |
| 2348 |
\def\xt@show@arrow { } |
| 2349 |
\let\tmp@xt@show@midarrow\xt@show@midarrow |
| 2350 |
\def\xt@show@midarrow { } |
| 2351 |
|
| 2352 |
% Now \_cntm_levdist_local_tl and \_cntm_sibdist_local_tl is the bases |
| 2353 |
\IfNoValueTF {#8} |
| 2354 |
{ |
| 2355 |
\bool_set_false:N \_cntm_distance_local_call_bool |
| 2356 |
\tl_set:Nn \_cntm_levdist_local_tl { \cntmlevdist } |
| 2357 |
\tl_set:Nn \_cntm_sibdist_local_tl { \cntmsibdist } |
| 2358 |
} |
| 2359 |
{ |
| 2360 |
\bool_set_true:N \_cntm_distance_local_call_bool |
| 2361 |
\tl_set:Nn \_cntm_levdist_local_tl { #8 } |
| 2362 |
\tl_set:Nn \_cntm_sibdist_local_tl { #9 } |
| 2363 |
} |
| 2364 |
|
| 2365 |
% Now \_cntm_act_sibdist_tl is the base |
| 2366 |
\bool_if:NTF \cntm_act_sibdist_call_bool |
| 2367 |
{ |
| 2368 |
\tl_set:Nn \_cntm_act_sibdist_local_tl { \cntmACTsibdist } |
| 2369 |
} |
| 2370 |
{ |
| 2371 |
\tl_set:Nn \_cntm_act_sibdist_local_tl { 1/3 * \_cntm_sibdist_local_tl } |
| 2372 |
} |
| 2373 |
|
| 2374 |
% adjust \cntm position for smaller triangle |
| 2375 |
\pgfmathsetmacro \cntmlevdistVar { \cntmpos * \_cntm_levdist_local_tl } |
| 2376 |
\pgfmathsetmacro \cntmsibdistVar { \cntmpos * \_cntm_sibdist_local_tl } |
| 2377 |
|
| 2378 |
%% \istroot(') : cntm outermost branches |
| 2379 |
\tl_clear:N \ischo_game_tl |
| 2380 |
\xdef\istgrowdirection{#2} |
| 2381 |
|
| 2382 |
% execute \ISTRoot [\istgrowdirection] (cntm) (#4) [null node] +{#8}..{#9}+ |
| 2383 |
% this defines (cntm) |
| 2384 |
\IfBooleanTF {#1} |
| 2385 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot' } } |
| 2386 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot } } |
| 2387 |
% collect arguments |
| 2388 |
\tl_put_right:Nx \ischo_game_tl |
| 2389 |
{ |
| 2390 |
[ \istgrowdirection ] (cntm) (#4) [ null~node ] |
| 2391 |
+ { \cntmlevdistVar } .. { \cntmsibdistVar } + |
| 2392 |
} |
| 2393 |
|
| 2394 |
%% (before executing \istb) call options collected from above complication |
| 2395 |
\_collect_cntm_leftmost_branch_opts: |
| 2396 |
\_collect_cntm_rightmost_branch_opts: |
| 2397 |
|
| 2398 |
% execute \istb \istb for cntm LEFT/RIGHT outermost branches |
| 2399 |
% this defines (cntm-1) and (cntm-2) |
| 2400 |
\exp_last_unbraced:NV \cntmOUTERistb \l_cntm_leftmost_branch_opt_tl |
| 2401 |
\exp_last_unbraced:NV \cntmOUTERistb \l_cntm_rightmost_branch_opt_tl |
| 2402 |
\printist ; |
| 2403 |
|
| 2404 |
%% draw cntm triangle, using (cntm), (cntm-1), (cntm-2) |
| 2405 |
\begin{scope}[ shorten~< = 0pt , shorten~> = 0pt ] |
| 2406 |
% call (draw and fill) options collected from above complication |
| 2407 |
\_collect_cntm_triangle_cmdstr: |
| 2408 |
% and finally draw "cntm triangle" |
| 2409 |
% \draw [opts] (cntm) -- (cntm-1) -- (cntm-2) - (cntm) ; |
| 2410 |
\begin{pgfonlayer}{\cntm@default@layer} % default: background |
| 2411 |
\exp_last_unbraced:No \draw \l_tmp_option_str_tl (cntm)--(cntm-1)--(cntm-2)--(cntm) ; |
| 2412 |
\end{pgfonlayer} |
| 2413 |
\end{scope} |
| 2414 |
|
| 2415 |
%% cntm action (actually taken by a player) |
| 2416 |
% this is normal \istroot(') |
| 2417 |
\tl_clear:N \ischo_game_tl |
| 2418 |
|
| 2419 |
\IfBooleanTF {#1} |
| 2420 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot' } } |
| 2421 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot } } |
| 2422 |
% collect arguments |
| 2423 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] (#3) (cntm) [#5] <#6> } |
| 2424 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle{ #7 } } } |
| 2425 |
\tl_put_right:Nx \ischo_game_tl { +{ \_cntm_levdist_local_tl }..{ 1*\_cntm_act_sibdist_local_tl }+ } |
| 2426 |
|
| 2427 |
% call set (for \istbA) |
| 2428 |
\bool_set_true:N \_istroot_cntm_call_bool % for \istbA |
| 2429 |
|
| 2430 |
% back to normal \xtShowArrows |
| 2431 |
\let\xt@show@arrow\tmp@xt@show@arrow |
| 2432 |
\let\xt@show@midarrow\tmp@xt@show@midarrow |
| 2433 |
} |
| 2434 |
|
| 2435 |
|
| 2436 |
% resolving expansion issue (for cntmA) |
| 2437 |
% [ - , tension=1 , \cntmAopt ] |
| 2438 |
\cs_new:Npn \_collect_cntmA_cmdstr: |
| 2439 |
{ |
| 2440 |
\tl_set:Nn \l_tmp_arc_option_str_tl { [ - , tension=1 , } |
| 2441 |
\tl_put_right:Nx \l_tmp_arc_option_str_tl { \cntmAopt ] } |
| 2442 |
} |
| 2443 |
|
| 2444 |
% [ - , tension=1 , \cntmAfillcolor ] |
| 2445 |
\cs_new:Npn \_collect_cntmA_color_cmdstr: |
| 2446 |
{ |
| 2447 |
\tl_set:Nn \l_tmp_arc_color_str_tl { [ - , tension=1 , } |
| 2448 |
\tl_put_right:Nx \l_tmp_arc_color_str_tl { \cntmAfillcolor ] } |
| 2449 |
} |
| 2450 |
|
| 2451 |
% \istrootcntmA -- cntm arc version |
| 2452 |
% ' [grow] (root) (at) [node style] <angle> {owner} +cntmlevdist..cntmsibdist+ |
| 2453 |
\NewDocumentCommand \istrootcntmA |
| 2454 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. d.+ } |
| 2455 |
{ |
| 2456 |
% to suppress \xtShowArrows for cntm |
| 2457 |
\let\tmp@xt@show@arrow\xt@show@arrow |
| 2458 |
\def\xt@show@arrow { } |
| 2459 |
\let\tmp@xt@show@midarrow\xt@show@midarrow |
| 2460 |
\def\xt@show@midarrow { } |
| 2461 |
|
| 2462 |
% Now \_cntm_levdist_local_tl and \_cntm_sibdist_local_tl is the bases |
| 2463 |
\IfNoValueTF {#8} |
| 2464 |
{ |
| 2465 |
\bool_set_false:N \_cntmA_distance_local_call_bool |
| 2466 |
\tl_set:Nn \_cntmA_levdist_local_tl { \cntmlevdist } |
| 2467 |
\tl_set:Nn \_cntmA_sibdist_local_tl { \cntmsibdist } |
| 2468 |
} |
| 2469 |
{ |
| 2470 |
\bool_set_true:N \_cntmA_distance_local_call_bool |
| 2471 |
\tl_set:Nn \_cntmA_levdist_local_tl { #8 } |
| 2472 |
\tl_set:Nn \_cntmA_sibdist_local_tl { #9 } |
| 2473 |
} |
| 2474 |
|
| 2475 |
% Now \_cntm_act_sibdist_tl is the base |
| 2476 |
\bool_if:NTF \cntm_act_sibdist_call_bool |
| 2477 |
{ |
| 2478 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {\cntmACTsibdist} |
| 2479 |
} |
| 2480 |
{ |
| 2481 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {1/3*\_cntmA_sibdist_local_tl} |
| 2482 |
} |
| 2483 |
|
| 2484 |
%% \ISTRoot(') : for drawing cntmA outermost branches |
| 2485 |
\tl_clear:N \ischo_game_tl |
| 2486 |
\xdef\istgrowdirection{#2} |
| 2487 |
|
| 2488 |
% execute \ISTRoot |
| 2489 |
% this defines (cntm) |
| 2490 |
\IfBooleanTF {#1} |
| 2491 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot' } } |
| 2492 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot } } |
| 2493 |
% collect arguments |
| 2494 |
\tl_put_right:Nx \ischo_game_tl |
| 2495 |
{ [ \istgrowdirection ] (cntm) (#4) [ null~node ] |
| 2496 |
+{\_cntmA_levdist_local_tl}..{\_cntmA_sibdist_local_tl}+ } |
| 2497 |
|
| 2498 |
%% (before executing \istb) call options collected from above complication |
| 2499 |
\_collect_cntmA_leftmost_branch_opts: |
| 2500 |
\_collect_cntmA_rightmost_branch_opts: |
| 2501 |
|
| 2502 |
% execute \istb \istb for cntmA LEFT/RIGHT outermost branches |
| 2503 |
% this defines (cntm-1) and (cntm-2) |
| 2504 |
\exp_last_unbraced:NV \cntmAOUTERistb \l_cntmA_leftmost_branch_opt_tl |
| 2505 |
\exp_last_unbraced:NV \cntmAOUTERistb \l_cntmA_rightmost_branch_opt_tl |
| 2506 |
\printist ; |
| 2507 |
|
| 2508 |
%% defining cntmA points |
| 2509 |
% First, adjust plot vertex to compensate dependency of tree shape |
| 2510 |
\pgfmathsetmacro\cntmdistratio{ scalar (\_cntmA_levdist_local_tl/\_cntmA_sibdist_local_tl) } |
| 2511 |
% sqrt(1/3) is to make the cntmdist ratio 1/3 as standard |
| 2512 |
\pgfmathsetmacro\cntmAplotfactorVal |
| 2513 |
{ 1 + (\cntmAplotfactor-1) * sqrt(1/3) / sqrt(\cntmdistratio) } |
| 2514 |
\xdef\cntmAplotfactorAdj{\cntmAplotfactorVal} % used also in \istbA(t) |
| 2515 |
\coordinate (cntmA-beg) at ( $ (cntm) ! \cntmApos ! (cntm-1) $ ) ; % begin point |
| 2516 |
\coordinate (cntmA-end) at ( $ (cntm) ! \cntmApos ! (cntm-2) $ ) ; % end point |
| 2517 |
\coordinate (cntmA-mid-base) at ( $ (cntm-1) ! .5 ! (cntm-2)$) ; % base midpoint |
| 2518 |
% defines "compensated" plot vertex |
| 2519 |
\coordinate (cntmA-vertex) |
| 2520 |
at ( $ (cntm) ! \cntmAplotfactorAdj*\cntmApos ! (cntmA-mid-base) $ ) ; |
| 2521 |
% (for expost/outside use) |
| 2522 |
\coordinate (cntmAi-begpoint) at ( $ (cntm) ! \cntmApos ! (cntm-1) $ ) ; |
| 2523 |
\coordinate (cntmAi-endpoint) at ( $ (cntm) ! \cntmApos ! (cntm-2) $ ) ; |
| 2524 |
|
| 2525 |
%% plot cntmA |
| 2526 |
% \draw [ \cntmAopt , - , <opts> , tension=1 ] |
| 2527 |
\_collect_cntmA_cmdstr: |
| 2528 |
\_collect_cntmA_color_cmdstr: |
| 2529 |
|
| 2530 |
\begin{scope}[ shorten~< = 0pt , shorten~> = 0pt ] |
| 2531 |
\begin{pgfonlayer}{\cntmAdefaultlayer} % default: behind |
| 2532 |
\exp_last_unbraced:No \fill \l_tmp_arc_color_str_tl |
| 2533 |
(cntm) -- plot [ smooth ] coordinates { (cntmA-beg) (cntmA-vertex) (cntmA-end) } -- cycle ; |
| 2534 |
\exp_last_unbraced:No \draw \l_tmp_arc_option_str_tl |
| 2535 |
plot [ smooth ] coordinates { (cntmA-beg) (cntmA-vertex) (cntmA-end) } ; |
| 2536 |
\end{pgfonlayer} |
| 2537 |
\end{scope} |
| 2538 |
|
| 2539 |
%% cntmA action (actually taken by a player) |
| 2540 |
% this is normal \istroot(') |
| 2541 |
\tl_clear:N \ischo_game_tl |
| 2542 |
|
| 2543 |
\IfBooleanTF {#1} |
| 2544 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot' } } |
| 2545 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRoot } } |
| 2546 |
% collect arguments |
| 2547 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] (#3) (cntm) [#5] <#6> } |
| 2548 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle{ #7 } } } |
| 2549 |
\tl_put_right:Nx \ischo_game_tl { +{ \_cntmA_levdist_local_tl }..{ 1*\_cntm_act_sibdist_local_tl }+ } |
| 2550 |
|
| 2551 |
% call set (for \istbA) |
| 2552 |
\bool_set_true:N \_istroot_cntmA_call_bool |
| 2553 |
|
| 2554 |
% back to normal \xtShowArrows |
| 2555 |
\let\xt@show@arrow\tmp@xt@show@arrow |
| 2556 |
\let\xt@show@midarrow\tmp@xt@show@midarrow |
| 2557 |
} |
| 2558 |
|
| 2559 |
% \cntmAexpostShowEndPoints |
| 2560 |
% use this right after \istrootcntmA and \istrootocntmA |
| 2561 |
% (before \cntmAInfoset and \cntmAInfosetO) |
| 2562 |
\NewDocumentCommand \cntmAexpostShowEndPoints |
| 2563 |
{ O{} O{} } |
| 2564 |
{ |
| 2565 |
%\begin{pgfonlayer}{above} % main is ok |
| 2566 |
\node [ solid~node , #1 ] at (cntmAi-begpoint) {} ; |
| 2567 |
\node [ solid~node , #2 ] at (cntmAi-endpoint) {} ; |
| 2568 |
%\end{pgfonlayer} |
| 2569 |
} |
| 2570 |
|
| 2571 |
|
| 2572 |
% \istrootocntm -- oval cntm version |
| 2573 |
% ' [grow] (root) (at) [node style] <angle> {owner} +cntmlevdist..cntmsibdist+ |
| 2574 |
\NewDocumentCommand \istrootocntm |
| 2575 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. d.+ } |
| 2576 |
{ |
| 2577 |
% to suppress \xtShowArrows for cntm |
| 2578 |
\let\tmp@xt@show@arrow\xt@show@arrow |
| 2579 |
\def\xt@show@arrow { } |
| 2580 |
\let\tmp@xt@show@midarrow\xt@show@midarrow |
| 2581 |
\def\xt@show@midarrow { } |
| 2582 |
|
| 2583 |
% Now \_cntm_levdist_local_tl and \_cntm_sibdist_local_tl is the bases |
| 2584 |
\IfNoValueTF {#8} |
| 2585 |
{ |
| 2586 |
\bool_set_false:N \_cntm_distance_local_call_bool |
| 2587 |
\tl_set:Nn \_cntm_levdist_local_tl { \cntmlevdist } |
| 2588 |
\tl_set:Nn \_cntm_sibdist_local_tl { \cntmsibdist } |
| 2589 |
} |
| 2590 |
{ |
| 2591 |
\bool_set_true:N \_cntm_distance_local_call_bool |
| 2592 |
\tl_set:Nn \_cntm_levdist_local_tl { #8 } |
| 2593 |
\tl_set:Nn \_cntm_sibdist_local_tl { #9 } |
| 2594 |
} |
| 2595 |
|
| 2596 |
% Now \_cntm_act_sibdist_tl is the base |
| 2597 |
\bool_if:NTF \cntm_act_sibdist_call_bool |
| 2598 |
{ |
| 2599 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {\cntmACTsibdist} |
| 2600 |
} |
| 2601 |
{ |
| 2602 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {1/3*\_cntm_sibdist_local_tl} |
| 2603 |
} |
| 2604 |
|
| 2605 |
% adjust \cntm position for smaller triangle |
| 2606 |
\pgfmathsetmacro\cntmlevdistVar{\cntmpos*\_cntm_levdist_local_tl} |
| 2607 |
\pgfmathsetmacro\cntmsibdistVar{\cntmpos*\_cntm_sibdist_local_tl} |
| 2608 |
|
| 2609 |
%% \istrooto(') : cntm outermost branches |
| 2610 |
\tl_clear:N \ischo_game_tl |
| 2611 |
\xdef\istgrowdirection{#2} |
| 2612 |
|
| 2613 |
% execute \ISTRoot [\istgrowdirection] (cntm) (#4) [null node] +{#8}..{#9}+ |
| 2614 |
% this defines (cntm) |
| 2615 |
\IfBooleanTF {#1} |
| 2616 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO' } } |
| 2617 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO } } |
| 2618 |
% collect arguments |
| 2619 |
\tl_put_right:Nx \ischo_game_tl |
| 2620 |
{ |
| 2621 |
[ \istgrowdirection ] (cntm) (#4) [ null~node ] |
| 2622 |
+{\cntmlevdistVar}..{\cntmsibdistVar}+ |
| 2623 |
} |
| 2624 |
|
| 2625 |
%% (before executing \istb) call options collected from above complication |
| 2626 |
\_collect_cntm_leftmost_branch_opts: |
| 2627 |
\_collect_cntm_rightmost_branch_opts: |
| 2628 |
|
| 2629 |
% execute \istb \istb for cntm LEFT/RIGHT outermost branches |
| 2630 |
% this defines (cntm-1) and (cntm-2) |
| 2631 |
\exp_last_unbraced:NV \cntmOUTERistb \l_cntm_leftmost_branch_opt_tl |
| 2632 |
\exp_last_unbraced:NV \cntmOUTERistb \l_cntm_rightmost_branch_opt_tl |
| 2633 |
\printist ; |
| 2634 |
|
| 2635 |
%% draw cntm triangle, using (cntm), (cntm-1), (cntm-2) |
| 2636 |
\begin{scope}[ shorten~< = 0pt , shorten~> = 0pt ] |
| 2637 |
% call (draw and fill) options collected from above complication |
| 2638 |
\_collect_cntm_triangle_cmdstr: |
| 2639 |
% and finally draw "cntm triangle" |
| 2640 |
% \draw [opts] (cntm) -- (cntm-1) -- (cntm-2) - (cntm) ; |
| 2641 |
\begin{pgfonlayer}{\cntm@default@layer} % default: background |
| 2642 |
\exp_last_unbraced:No \draw \l_tmp_option_str_tl (cntm)--(cntm-1)--(cntm-2)--(cntm) ; |
| 2643 |
\end{pgfonlayer} |
| 2644 |
\end{scope} |
| 2645 |
|
| 2646 |
%% cntm action (actually taken by a player) |
| 2647 |
% this is normal \istrooto(') |
| 2648 |
\tl_clear:N \ischo_game_tl |
| 2649 |
|
| 2650 |
\IfBooleanTF {#1} |
| 2651 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO' } } |
| 2652 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO } } |
| 2653 |
% collect arguments |
| 2654 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] (#3) (cntm) [#5] <#6> } |
| 2655 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle{ #7 } } } |
| 2656 |
\tl_put_right:Nx \ischo_game_tl { +{ \_cntm_levdist_local_tl }..{ 1*\_cntm_act_sibdist_local_tl }+ } |
| 2657 |
|
| 2658 |
% call set (for \istbA) |
| 2659 |
\bool_set_true:N \_istroot_cntm_call_bool % for \istbA (HERE, USE \_istroot_ but not \_istrooto_ ) |
| 2660 |
|
| 2661 |
% back to normal \xtShowArrows |
| 2662 |
\let\xt@show@arrow\tmp@xt@show@arrow |
| 2663 |
\let\xt@show@midarrow\tmp@xt@show@midarrow |
| 2664 |
} |
| 2665 |
|
| 2666 |
% \istrootocntmA -- oval cntm arc version |
| 2667 |
% ' [grow] (root) (at) [node style] <angle> {owner} +cntmlevdist..cntmsibdist+ |
| 2668 |
\NewDocumentCommand \istrootocntmA |
| 2669 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} D<>{above} G{} d+. d.+ } |
| 2670 |
{ |
| 2671 |
% to suppress \xtShowArrows for cntm |
| 2672 |
\let\tmp@xt@show@arrow\xt@show@arrow |
| 2673 |
\def\xt@show@arrow { } |
| 2674 |
\let\tmp@xt@show@midarrow\xt@show@midarrow |
| 2675 |
\def\xt@show@midarrow { } |
| 2676 |
|
| 2677 |
% Now \_cntm_levdist_local_tl and \_cntm_sibdist_local_tl is the bases |
| 2678 |
\IfNoValueTF {#8} |
| 2679 |
{ |
| 2680 |
\bool_set_false:N \_cntmA_distance_local_call_bool |
| 2681 |
\tl_set:Nn \_cntmA_levdist_local_tl { \cntmlevdist } |
| 2682 |
\tl_set:Nn \_cntmA_sibdist_local_tl { \cntmsibdist } |
| 2683 |
} |
| 2684 |
{ |
| 2685 |
\bool_set_true:N \_cntmA_distance_local_call_bool |
| 2686 |
\tl_set:Nn \_cntmA_levdist_local_tl { #8 } |
| 2687 |
\tl_set:Nn \_cntmA_sibdist_local_tl { #9 } |
| 2688 |
} |
| 2689 |
|
| 2690 |
% Now \_cntm_act_sibdist_tl is the base |
| 2691 |
\bool_if:NTF \cntm_act_sibdist_call_bool |
| 2692 |
{ |
| 2693 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {\cntmACTsibdist} |
| 2694 |
} |
| 2695 |
{ |
| 2696 |
\tl_set:Nn \_cntm_act_sibdist_local_tl {1/3*\_cntmA_sibdist_local_tl} |
| 2697 |
} |
| 2698 |
|
| 2699 |
%% \ISTRootO(') : for drawing cntmA outermost branches |
| 2700 |
\tl_clear:N \ischo_game_tl |
| 2701 |
\xdef\istgrowdirection{#2} |
| 2702 |
|
| 2703 |
% execute \ISTRootO |
| 2704 |
% this defines (cntm) |
| 2705 |
\IfBooleanTF {#1} |
| 2706 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO' } } |
| 2707 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO } } |
| 2708 |
% collect arguments |
| 2709 |
\tl_put_right:Nx \ischo_game_tl |
| 2710 |
{ [ \istgrowdirection ] (cntm) (#4) [ null~node ] |
| 2711 |
+{\_cntmA_levdist_local_tl}..{\_cntmA_sibdist_local_tl}+ } |
| 2712 |
|
| 2713 |
%% (before executing \istb) call options collected from above complication |
| 2714 |
\_collect_cntmA_leftmost_branch_opts: |
| 2715 |
\_collect_cntmA_rightmost_branch_opts: |
| 2716 |
|
| 2717 |
% execute \istb \istb for cntmA LEFT/RIGHT outermost branches |
| 2718 |
% this defines (cntm-1) and (cntm-2) |
| 2719 |
\exp_last_unbraced:NV \cntmAOUTERistb \l_cntmA_leftmost_branch_opt_tl |
| 2720 |
\exp_last_unbraced:NV \cntmAOUTERistb \l_cntmA_rightmost_branch_opt_tl |
| 2721 |
\printist ; |
| 2722 |
|
| 2723 |
%% defining cntmA points |
| 2724 |
% First, adjust plot vertex to compensate dependency of tree shape |
| 2725 |
\pgfmathsetmacro\cntmdistratio{ scalar (\_cntmA_levdist_local_tl/\_cntmA_sibdist_local_tl) } |
| 2726 |
% sqrt(1/3) is to make the cntmdist ratio 1/3 as standard |
| 2727 |
\pgfmathsetmacro\cntmAplotfactorVal |
| 2728 |
{ 1 + (\cntmAplotfactor-1) * sqrt(1/3) / sqrt(\cntmdistratio) } |
| 2729 |
\xdef\cntmAplotfactorAdj{\cntmAplotfactorVal} % used also in \istbA(t) |
| 2730 |
\coordinate (cntmA-beg) at ( $ (cntm) ! \cntmApos ! (cntm-1) $ ) ; % begin point |
| 2731 |
\coordinate (cntmA-end) at ( $ (cntm) ! \cntmApos ! (cntm-2) $ ) ; % end point |
| 2732 |
\coordinate (cntmA-mid-base) at ( $ (cntm-1) ! .5 ! (cntm-2)$) ; % base midpoint |
| 2733 |
% defines "compensated" plot vertex |
| 2734 |
\coordinate (cntmA-vertex) |
| 2735 |
at ( $ (cntm) ! \cntmAplotfactorAdj*\cntmApos ! (cntmA-mid-base) $ ) ; |
| 2736 |
% (for expost/outside use) |
| 2737 |
\coordinate (cntmAi-begpoint) at ( $ (cntm) ! \cntmApos ! (cntm-1) $ ) ; |
| 2738 |
\coordinate (cntmAi-endpoint) at ( $ (cntm) ! \cntmApos ! (cntm-2) $ ) ; |
| 2739 |
|
| 2740 |
%% plot cntmA |
| 2741 |
% \draw [ \cntmAopt , - , <opts> , tension=1 ] |
| 2742 |
\_collect_cntmA_cmdstr: |
| 2743 |
\_collect_cntmA_color_cmdstr: |
| 2744 |
|
| 2745 |
\begin{scope}[ shorten~< = 0pt , shorten~> = 0pt ] |
| 2746 |
\begin{pgfonlayer}{\cntmAdefaultlayer} % default: behind |
| 2747 |
\exp_last_unbraced:No \fill \l_tmp_arc_color_str_tl |
| 2748 |
(cntm) -- plot [ smooth ] coordinates { (cntmA-beg) (cntmA-vertex) (cntmA-end) } -- cycle ; |
| 2749 |
\exp_last_unbraced:No \draw \l_tmp_arc_option_str_tl |
| 2750 |
plot [ smooth ] coordinates { (cntmA-beg) (cntmA-vertex) (cntmA-end) } ; |
| 2751 |
\end{pgfonlayer} |
| 2752 |
\end{scope} |
| 2753 |
|
| 2754 |
%% cntmA action (actually taken by a player) |
| 2755 |
% this is normal \istrooto(') |
| 2756 |
\tl_clear:N \ischo_game_tl |
| 2757 |
|
| 2758 |
\IfBooleanTF {#1} |
| 2759 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO' } } |
| 2760 |
{ \tl_put_right:Nn \ischo_game_tl { \ISTRootO } } |
| 2761 |
% collect arguments |
| 2762 |
\tl_put_right:Nx \ischo_game_tl { [ \istgrowdirection ] (#3) (cntm) [#5] <#6> } |
| 2763 |
\tl_put_right:Nn \ischo_game_tl { { \istownerstyle{ #7 } } } |
| 2764 |
\tl_put_right:Nx \ischo_game_tl { +{ \_cntmA_levdist_local_tl }..{ 1*\_cntm_act_sibdist_local_tl }+ } |
| 2765 |
|
| 2766 |
% call set (for \istbA) |
| 2767 |
\bool_set_true:N \_istroot_cntmA_call_bool |
| 2768 |
|
| 2769 |
% back to normal \xtShowArrows |
| 2770 |
\let\xt@show@arrow\tmp@xt@show@arrow |
| 2771 |
\let\xt@show@midarrow\tmp@xt@show@midarrow |
| 2772 |
} |
| 2773 |
|
| 2774 |
|
| 2775 |
%% OBSOLETE macros - backward compatibility (to be removed next update) |
| 2776 |
|
| 2777 |
% \obsoleteISTCntm (obsolete) - backward compatibility |
| 2778 |
% (used in \istcntm) |
| 2779 |
\NewDocumentCommand \obsoleteISTCntm |
| 2780 |
{ t' O{south} r() D(){0,0} O{\cntm@default@drawcolor} G{.5} |
| 2781 |
D+.{\cntmdefaultlevdist} D.+{\cntmdefaultsibdist} } |
| 2782 |
{ |
| 2783 |
\cntmdistance{#7}{#8} |
| 2784 |
\tikzset{level~1/.style={level~distance=\cntmlevdist,sibling~distance=\cntmsibdist}} |
| 2785 |
% |
| 2786 |
\IfBooleanTF {#1} |
| 2787 |
{ |
| 2788 |
\setistNullNodeStyle[#5]{\istdefault@null@nodesize}[#5] |
| 2789 |
\begin{pgfonlayer}{background} |
| 2790 |
\node (#3) at (#4) [ null~node ] { } [ \xt@growswap = #2 ] child child ; |
| 2791 |
\draw [ #5 , fill = #5 ] (#3) -- (#3-1) -- (#3-2) -- (#3) ; |
| 2792 |
\end{pgfonlayer} |
| 2793 |
\setistNullNodeStyle{\istdefault@null@nodesize} |
| 2794 |
} |
| 2795 |
{ |
| 2796 |
\setistNullNodeStyle[#5]{\istdefault@null@nodesize}[#5] |
| 2797 |
\begin{pgfonlayer}{background} |
| 2798 |
\node (#3) at (#4) [ null~node ] { } [ \xt@grow = #2 ] child child ; |
| 2799 |
\draw [ #5 , fill = #5 ] (#3) -- (#3-1) -- (#3-2) -- (#3) ; |
| 2800 |
\end{pgfonlayer} |
| 2801 |
\setistNullNodeStyle{\istdefault@null@nodesize} |
| 2802 |
} |
| 2803 |
} |
| 2804 |
|
| 2805 |
% \obsoleteISTCntmArc (arc version) (obsolete) - backward compatibility |
| 2806 |
% (used in \istcntmA) |
| 2807 |
\NewDocumentCommand \obsoleteISTCntmArc |
| 2808 |
{ t' O{south} r() D(){0,0} O{} G{.5} D+.{\cntmdefaultlevdist} D.+{\cntmdefaultsibdist} } |
| 2809 |
{ |
| 2810 |
\cntmdistance{#7}{#8} |
| 2811 |
\tikzset{level~1/.style={level~distance=\cntmlevdist,sibling~distance=\cntmsibdist}} |
| 2812 |
% |
| 2813 |
\IfBooleanTF {#1} |
| 2814 |
{ |
| 2815 |
\begin{pgfonlayer}{background} |
| 2816 |
\node (#3) at (#4) [ null~node ] { } [\xt@growswap=#2] child child ; |
| 2817 |
\draw [ bend~left , #5 ] ( $ (#3) ! #6 ! (#3-1) $ ) to ( $ (#3) ! #6 ! (#3-2) $ ) ; |
| 2818 |
\end{pgfonlayer} |
| 2819 |
} |
| 2820 |
{ |
| 2821 |
\begin{pgfonlayer}{background} |
| 2822 |
\node (#3) at (#4) [ null~node ] { } [\xt@grow=#2] child child ; |
| 2823 |
\draw [ bend~right , #5 ] ( $ (#3) ! #6 ! (#3-1) $ ) to ( $ (#3) ! #6 ! (#3-2) $ ) ; |
| 2824 |
\end{pgfonlayer} |
| 2825 |
} |
| 2826 |
} |
| 2827 |
|
| 2828 |
|
| 2829 |
% \istcntm(') (obsolete) - backward compatibility |
| 2830 |
\NewDocumentCommand \istcntm |
| 2831 |
{ t' O{\istdefault@grow} r() D(){0,0} O{\cntm@default@drawcolor} G{} |
| 2832 |
D+.{\cntmdefaultlevdist} D.+{\cntmdefaultsibdist} } |
| 2833 |
{ |
| 2834 |
\xdef\istgrowdirection{#2} % used in \istb to specify [payoff direction] |
| 2835 |
\IfBooleanTF {#1} |
| 2836 |
{ |
| 2837 |
\obsoleteISTCntm' [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] + #7 .. #8 + |
| 2838 |
} |
| 2839 |
{ |
| 2840 |
\obsoleteISTCntm [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] + #7 .. #8 + |
| 2841 |
} |
| 2842 |
} |
| 2843 |
|
| 2844 |
% \istcntmarc(') (obsolete) - backward compatibility |
| 2845 |
\NewDocumentCommand \istcntmarc |
| 2846 |
{ t' O{\istdefault@grow} r() D(){0,0} O{} G{.5} D+.{\cntmdefaultlevdist} D.+{\cntmdefaultsibdist} } |
| 2847 |
{ |
| 2848 |
\xdef\istgrowdirection{#2} % used in \istb to specify [payoff direction] |
| 2849 |
\IfBooleanTF {#1} |
| 2850 |
{ |
| 2851 |
\obsoleteISTCntmArc' [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] { #6 } + #7 .. #8 + |
| 2852 |
} |
| 2853 |
{ |
| 2854 |
\obsoleteISTCntmArc [ \istgrowdirection ] ( #3 ) ( #4 ) [ #5 ] { #6 }+ #7 .. #8 + |
| 2855 |
} |
| 2856 |
} |
| 2857 |
|
| 2858 |
|
| 2859 |
%% supplementary macros |
| 2860 |
|
| 2861 |
%% \xInfosetOwner (with abbreviations) |
| 2862 |
% * (from) (to) {owner} [pos] |
| 2863 |
\NewDocumentCommand \xtInfosetOwner{ s r() r() +m O{} } |
| 2864 |
{ |
| 2865 |
\begin{scope} % in group: to make \setistmathTF011 local |
| 2866 |
\IfBooleanTF { #1 } { } { \setistmathTF011 \istownertextfont{} } |
| 2867 |
\str_case:nnF { #5 } |
| 2868 |
{ |
| 2869 |
{ al } { \node [ above~left ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2870 |
{ ar } { \node [ above~right ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2871 |
{ bl } { \node [ below~left ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2872 |
{ br } { \node [ below~right ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2873 |
{ l } { \node [ left ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2874 |
{ r } { \node [ right ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2875 |
{ a } { \node [ above ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2876 |
{ b } { \node [ below ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; } |
| 2877 |
} |
| 2878 |
{ |
| 2879 |
\node [ #5 ] at ( $ (#2)!.5!(#3) $ ) { \istownerstyle{#4} } ; |
| 2880 |
} |
| 2881 |
\end{scope} |
| 2882 |
} |
| 2883 |
|
| 2884 |
% \xtOwner (with abbreviations) |
| 2885 |
% * (coor) {owner} [pos] |
| 2886 |
\NewDocumentCommand \xtOwner{ s r() +m O{} } |
| 2887 |
{ |
| 2888 |
\begin{scope} % in group: to make \setistmathTF011 local |
| 2889 |
\IfBooleanTF { #1 } { } { \setistmathTF011 \istownertextfont{} } |
| 2890 |
\str_case:nnF { #4 } |
| 2891 |
{ |
| 2892 |
{ al } { \node [ above~left ] at (#2) { \istownerstyle{#3} } ; } |
| 2893 |
{ ar } { \node [ above~right ] at (#2) { \istownerstyle{#3} } ; } |
| 2894 |
{ bl } { \node [ below~left ] at (#2) { \istownerstyle{#3} } ; } |
| 2895 |
{ br } { \node [ below~right ] at (#2) { \istownerstyle{#3} } ; } |
| 2896 |
{ l } { \node [ left ] at (#2) { \istownerstyle{#3} } ; } |
| 2897 |
{ r } { \node [ right ] at (#2) { \istownerstyle{#3} } ; } |
| 2898 |
{ a } { \node [ above ] at (#2) { \istownerstyle{#3} } ; } |
| 2899 |
{ b } { \node [ below ] at (#2) { \istownerstyle{#3} } ; } |
| 2900 |
} |
| 2901 |
{ |
| 2902 |
\node [ above , #4 ] at (#2) { \istownerstyle{#3} } ; |
| 2903 |
} |
| 2904 |
\end{scope} |
| 2905 |
} |
| 2906 |
|
| 2907 |
% \xtActionLabel |
| 2908 |
% BE CAREFUL: each case has different options (do not try to shorten) |
| 2909 |
% * [opt] (parent) (child) {action label} [pos] |
| 2910 |
\NewDocumentCommand \xtActionLabel{ s O{} r() r() G{} O{} } |
| 2911 |
{ |
| 2912 |
\begin{scope} % in group: to make \setistmathTF011 local |
| 2913 |
\IfBooleanTF { #1 } { } { \setistmathTF011 \istactionlabeltextfont{} } |
| 2914 |
\str_case:nnF { #6 } |
| 2915 |
{ |
| 2916 |
{ al } { |
| 2917 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2918 |
[ edge~node = { node [ above~left , black , text~depth = .25ex , |
| 2919 |
xshift = \istactionlabelxshift , |
| 2920 |
yshift = -\istactionlabelyshift ] |
| 2921 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2922 |
} |
| 2923 |
{ ar } { |
| 2924 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2925 |
[ edge~node = { node [ above~right , black , text~depth = .25ex , |
| 2926 |
xshift = -\istactionlabelxshift , |
| 2927 |
yshift = -\istactionlabelyshift ] |
| 2928 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2929 |
} |
| 2930 |
{ bl } { |
| 2931 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2932 |
[ edge~node = { node [ below~left , black , text~depth = .25ex , |
| 2933 |
xshift = \istactionlabelxshift , |
| 2934 |
yshift = \istactionlabelyshift ] |
| 2935 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2936 |
} |
| 2937 |
{ br } { |
| 2938 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2939 |
[ edge~node = { node [ below~right , black , text~depth = .25ex , |
| 2940 |
xshift = -\istactionlabelxshift , |
| 2941 |
yshift = \istactionlabelyshift ] |
| 2942 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2943 |
} |
| 2944 |
{ l } { |
| 2945 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2946 |
[ edge~node = { node [ left , black , text~depth = .25ex , |
| 2947 |
yshift = -\xtALyShift ] |
| 2948 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2949 |
} |
| 2950 |
{ r } { |
| 2951 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2952 |
[ edge~node = { node [ right , black , text~depth = .25ex , |
| 2953 |
yshift = \xtALyShift ] |
| 2954 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2955 |
} |
| 2956 |
{ a } { |
| 2957 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2958 |
[ edge~node = { node [ above , black , text~depth = .25ex , |
| 2959 |
yshift = \xtALyShift ] |
| 2960 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2961 |
} |
| 2962 |
{ b } { |
| 2963 |
\draw [ - , draw = none , #2 ] (#3) to |
| 2964 |
[ edge~node = { node [ below , black , text~depth = .25ex , |
| 2965 |
yshift = -\xtALyShift ] |
| 2966 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2967 |
} |
| 2968 |
} |
| 2969 |
{ |
| 2970 |
\draw [ - , draw = none , #2] (#3) to |
| 2971 |
[ edge~node = { node [ black , text~depth = .25ex , #6 ] |
| 2972 |
{ \istactionlabelstyle{#5} } } ] (#4) ; |
| 2973 |
} |
| 2974 |
\end{scope} |
| 2975 |
} |
| 2976 |
|
| 2977 |
|
| 2978 |
|
| 2979 |
\def\xtdefault@xtpayoff@outersep{4pt} |
| 2980 |
% \xtPayoff (with abbreviations) |
| 2981 |
% * (coor) {payoffs} [pos] |
| 2982 |
\NewDocumentCommand \xtPayoff{ s r() +m O{below} } |
| 2983 |
{ |
| 2984 |
\begin{scope} % in group: to make \setistmathTF011 local |
| 2985 |
\IfBooleanTF { #1 } { } { \setistmathTF011 \istpayofftextfont{} } |
| 2986 |
\str_case:nnF { #4 } |
| 2987 |
{ |
| 2988 |
{ al } { |
| 2989 |
\node [ above~left , inner~sep = 0pt , |
| 2990 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 2991 |
at (#2) { \istpayoffstyle{#3} } ; |
| 2992 |
} |
| 2993 |
{ ar } { |
| 2994 |
\node [ above~right , inner~sep = 0pt , |
| 2995 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 2996 |
at (#2) { \istpayoffstyle{#3} } ; |
| 2997 |
} |
| 2998 |
{ bl } { |
| 2999 |
\node [ below~left , inner~sep = 0pt , |
| 3000 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3001 |
at (#2) { \istpayoffstyle{#3} } ; |
| 3002 |
} |
| 3003 |
{ br } { |
| 3004 |
\node [ below~right , inner~sep = 0pt , |
| 3005 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3006 |
at (#2) { \istpayoffstyle{#3} } ; |
| 3007 |
} |
| 3008 |
{ l } { |
| 3009 |
\node [ left , inner~sep = 0pt , |
| 3010 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3011 |
at (#2) { \istpayoffstyle{#3} } ; |
| 3012 |
} |
| 3013 |
{ r } { |
| 3014 |
\node [ right , inner~sep = 0pt , |
| 3015 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3016 |
at (#2) { \istpayoffstyle{#3} } ; } |
| 3017 |
{ a } { |
| 3018 |
\node [ above , inner~sep = 0pt , |
| 3019 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3020 |
at (#2) { \istpayoffstyle{#3} } ; } |
| 3021 |
{ b } { |
| 3022 |
\node [ below , inner~sep = 0pt , |
| 3023 |
outer~sep = \xtdefault@xtpayoff@outersep , text~depth = .25ex ] |
| 3024 |
at (#2) { \istpayoffstyle{#3} } ; } |
| 3025 |
} |
| 3026 |
{ |
| 3027 |
\node [ inner~sep = 0pt , outer~sep = \xtdefault@xtpayoff@outersep , |
| 3028 |
text~depth = .25ex , #4 ] |
| 3029 |
at (#2) { \istpayoffstyle{#3} } ; |
| 3030 |
} |
| 3031 |
\end{scope} |
| 3032 |
} |
| 3033 |
|
| 3034 |
|
| 3035 |
% \xtNode(*) |
| 3036 |
% * [opt] (coor) [node style] {text} |
| 3037 |
\NewDocumentCommand \xtNode{ s O{} r() O{} +G{} } |
| 3038 |
{ \IfBooleanTF {#1} |
| 3039 |
{ |
| 3040 |
\istrooto (#3) (#3) [ plain~node , #4 ] {#5} \printist ; |
| 3041 |
} |
| 3042 |
{ |
| 3043 |
\node [ - , #2 ] at (#3) [ solid~node , #4 ] {#5} ; |
| 3044 |
} |
| 3045 |
} |
| 3046 |
|
| 3047 |
|
| 3048 |
%% show and hide endpoints |
| 3049 |
|
| 3050 |
\NewDocumentCommand \xtShowEndPoints{ s O{solid~node} } |
| 3051 |
{ \IfBooleanTF {#1} |
| 3052 |
{ |
| 3053 |
\def\xt@show@endpoint{node[#2]{}} |
| 3054 |
\def\xt@show@tndot{node[#2]{}} |
| 3055 |
\def\cntm@show@endpoint{node[at~end,#2]{}} %% PROBLEMatic: node [#2] (ref. \cntmOUTERistb) |
| 3056 |
} |
| 3057 |
{ |
| 3058 |
\def\xt@show@endpoint{node[#2]{}} |
| 3059 |
\def\xt@show@tndot{node[#2]{}} |
| 3060 |
} |
| 3061 |
} |
| 3062 |
|
| 3063 |
\NewDocumentCommand \xtHideEndPoints{s} |
| 3064 |
{ |
| 3065 |
\IfBooleanTF {#1} |
| 3066 |
{ % works only for cntm |
| 3067 |
\renewcommand*\cntm@show@endpoint{} |
| 3068 |
} |
| 3069 |
{ |
| 3070 |
\renewcommand*\xt@show@endpoint{} |
| 3071 |
\renewcommand*\xt@show@tndot{} |
| 3072 |
} |
| 3073 |
} |
| 3074 |
|
| 3075 |
%% show and hide terminal nodes |
| 3076 |
|
| 3077 |
\NewDocumentCommand \xtShowTerminalNodes{ O{terminal~node} } |
| 3078 |
{ |
| 3079 |
\def\xt@show@tndot{node[#1]{}} |
| 3080 |
} |
| 3081 |
|
| 3082 |
\NewDocumentCommand \xtHideTerminalNodes{} |
| 3083 |
{ |
| 3084 |
\renewcommand*\xt@show@tndot{} |
| 3085 |
} |
| 3086 |
|
| 3087 |
|
| 3088 |
%% subgames |
| 3089 |
|
| 3090 |
% subgame box/oval layer |
| 3091 |
\def\xtdefault@subgamelayer { background } |
| 3092 |
\newcommand*\xtsubgamelayer{ \xtdefault@subgamelayer } |
| 3093 |
\NewDocumentCommand \setxtsubgamelayer { G{\xtdefault@subgamelayer} } |
| 3094 |
{ |
| 3095 |
\renewcommand \xtsubgamelayer { #1 } |
| 3096 |
} |
| 3097 |
|
| 3098 |
\def\xtdefault@subrootshiftbox { 0 , -.3 } |
| 3099 |
% \xtSubgameBox |
| 3100 |
% * (root coor) { (coor1) (coor2)... } [additional opt] |
| 3101 |
\NewDocumentCommand \xtSubgameBox { s r() m O{} } |
| 3102 |
{ |
| 3103 |
\IfBooleanTF {#1} |
| 3104 |
{ |
| 3105 |
\coordinate (xtsubroot) at ( $ (#2) + (\xtdefault@subrootshiftbox) $ ) ; |
| 3106 |
\begin{pgfonlayer}{\xtsubgamelayer} |
| 3107 |
\node [ rectangle , fill , red!20 , inner~sep = 20pt , rounded~corners = 15pt , #4 ] |
| 3108 |
[ fit = (xtsubroot) #3 ] { } ; |
| 3109 |
\end{pgfonlayer} |
| 3110 |
} |
| 3111 |
{ |
| 3112 |
\coordinate (xtsubroot) at ( $ (#2) + ( 0 , -.3 ) $ ) ; |
| 3113 |
\begin{pgfonlayer}{\xtsubgamelayer} |
| 3114 |
\node [ rectangle , draw , dashed , inner~sep = 20pt , rounded~corners = 15pt , black!50 , #4 ] |
| 3115 |
[ fit = (xtsubroot) #3 ] {} ; |
| 3116 |
\end{pgfonlayer} |
| 3117 |
} |
| 3118 |
} |
| 3119 |
|
| 3120 |
\def\xtdefault@subrootshiftoval { 0 , -.7 } |
| 3121 |
% \xtSubgameOval |
| 3122 |
% * (root coor) { (coor1) (coor2)... } [additional opt] |
| 3123 |
\NewDocumentCommand \xtSubgameOval { s r() m O{} } |
| 3124 |
{ |
| 3125 |
\IfBooleanTF {#1} |
| 3126 |
{ |
| 3127 |
\coordinate (xtsubroot) at ( $ (#2) + (\xtdefault@subrootshiftoval) $ ) ; |
| 3128 |
\begin{pgfonlayer}{\xtsubgamelayer} |
| 3129 |
\node [ ellipse , fill , red!20 , inner~sep = 15pt , #4 ] |
| 3130 |
[ fit = (xtsubroot) #3 ] { } ; |
| 3131 |
\end{pgfonlayer} |
| 3132 |
} |
| 3133 |
{ |
| 3134 |
\coordinate (xtsubroot) at ( $ (#2) + ( 0 , -.7 ) $ ) ; |
| 3135 |
\begin{pgfonlayer}{\xtsubgamelayer} % borrowed from infoset |
| 3136 |
\node [ ellipse , draw , dashed , inner~sep = 15pt , black!50 , #4 ] |
| 3137 |
[ fit = (xtsubroot) #3 ] { } ; |
| 3138 |
\end{pgfonlayer} |
| 3139 |
} |
| 3140 |
} |
| 3141 |
|
| 3142 |
% \xtTimeLineH |
| 3143 |
% ' [line opt] (passing point) {from dim} {to dim} {label} [pos] |
| 3144 |
\NewDocumentCommand \xtTimeLineH { t' O{} r() m m G{} O{}} |
| 3145 |
{ |
| 3146 |
\bool_if:NTF \xt_growswap_call_bool |
| 3147 |
{ % if swapped, go opposite direction |
| 3148 |
\pgfmathsetmacro \tlhAA { -1 * #4 } |
| 3149 |
\pgfmathsetmacro \tlhBB { -1 * #5 } |
| 3150 |
\IfBooleanTF { #1 } |
| 3151 |
{ |
| 3152 |
\coordinate (tlhCC) at ( #3 -| { \tlhBB , \tlhAA } ) ; |
| 3153 |
\tl_set:Nn \_TH_label_pos_tl { left } |
| 3154 |
} |
| 3155 |
{ |
| 3156 |
\coordinate (tlhCC) at ( #3 -| { \tlhAA , \tlhBB } ) ; |
| 3157 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3158 |
} |
| 3159 |
} |
| 3160 |
{ |
| 3161 |
\def \tlhAA { #4 } |
| 3162 |
\def \tlhBB { #5 } |
| 3163 |
\IfBooleanTF {#1} |
| 3164 |
{ |
| 3165 |
\coordinate (tlhCC) at ( #3 -| { \tlhAA , \tlhBB } ) ; |
| 3166 |
\tl_set:Nn \_TH_label_pos_tl { left } |
| 3167 |
} |
| 3168 |
{ |
| 3169 |
\coordinate (tlhCC) at ( #3 -| { \tlhBB , \tlhAA } ) ; |
| 3170 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3171 |
} |
| 3172 |
} |
| 3173 |
\begin{pgfonlayer}{\xtsubgamelayer} |
| 3174 |
\str_case:nnF {#7} |
| 3175 |
{ |
| 3176 |
{al} { \node at (tlhCC) [ above~left ] {#6} ; } |
| 3177 |
{ar} { \node at (tlhCC) [ above~right ] {#6} ; } |
| 3178 |
{bl} { \node at (tlhCC) [ below~left ] {#6} ; } |
| 3179 |
{br} { \node at (tlhCC) [ below~right ] {#6} ; } |
| 3180 |
{l} { \node at (tlhCC) [ left ] {#6} ; } |
| 3181 |
{r} { \node at (tlhCC) [ right ] {#6} ; } |
| 3182 |
{a} { \node at (tlhCC) [ above ] {#6} ; } |
| 3183 |
{b} { \node at (tlhCC) [ below ] {#6} ; } |
| 3184 |
} |
| 3185 |
{ |
| 3186 |
\node at ( tlhCC ) [ \_TH_label_pos_tl , #7 ] {#6} ; |
| 3187 |
} |
| 3188 |
\draw [ - , dotted , shorten~< = 0pt, shorten~> = 0pt , #2 ] |
| 3189 |
( #3 -| { \tlhAA , \tlhBB } ) -- ( #3 -| { \tlhBB , \tlhAA } ) ; |
| 3190 |
\end{pgfonlayer} |
| 3191 |
} |
| 3192 |
|
| 3193 |
|
| 3194 |
% \xtTimeLineV |
| 3195 |
% ' [line opt] (passing point) {from dim} {to dim} {label} [pos] |
| 3196 |
\NewDocumentCommand \xtTimeLineV { t' O{} r() m m G{} O{}} |
| 3197 |
{ |
| 3198 |
\bool_if:NTF \xt_growswap_call_bool |
| 3199 |
{ |
| 3200 |
\def\tlvAA{#4} |
| 3201 |
\def\tlvBB{#5} |
| 3202 |
\IfBooleanTF {#1} |
| 3203 |
{ |
| 3204 |
\coordinate (tlvCC) at ( #3 |- { \tlvAA , \tlvBB } ) ; |
| 3205 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3206 |
} |
| 3207 |
{ |
| 3208 |
\coordinate (tlvCC) at ( #3 |- { \tlvBB , \tlvAA } ) ; |
| 3209 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3210 |
} |
| 3211 |
} |
| 3212 |
{ % if not swapped, go opposite direction |
| 3213 |
\pgfmathsetmacro\tlvAA{-1*#4} |
| 3214 |
\pgfmathsetmacro\tlvBB{-1*#5} |
| 3215 |
\IfBooleanTF {#1} |
| 3216 |
{ |
| 3217 |
\coordinate (tlvCC) at ( #3 |- { \tlvBB , \tlvAA } ) ; |
| 3218 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3219 |
} |
| 3220 |
{ |
| 3221 |
\coordinate (tlvCC) at ( #3 |- { \tlvAA , \tlvBB } ) ; |
| 3222 |
\tl_set:Nn \_TH_label_pos_tl { right } |
| 3223 |
} |
| 3224 |
} |
| 3225 |
|
| 3226 |
\begin{pgfonlayer}{\xtsubgamelayer} |
| 3227 |
\str_case:nnF {#7} |
| 3228 |
{ |
| 3229 |
{al} { \node at (tlvCC) [ above~left ] {#6} ; } |
| 3230 |
{ar} { \node at (tlvCC) [ above~right ] {#6} ; } |
| 3231 |
{bl} { \node at (tlvCC) [ below~left ] {#6} ; } |
| 3232 |
{br} { \node at (tlvCC) [ below~right ] {#6} ; } |
| 3233 |
{l} { \node at (tlvCC) [ left ] {#6} ; } |
| 3234 |
{r} { \node at (tlvCC) [ right ] {#6} ; } |
| 3235 |
{a} { \node at (tlvCC) [ above ] {#6} ; } |
| 3236 |
{b} { \node at (tlvCC) [ below ] {#6} ; } |
| 3237 |
} |
| 3238 |
{ |
| 3239 |
\node at ( tlvCC ) [ \_TH_label_pos_tl , #7 ] {#6} ; |
| 3240 |
} |
| 3241 |
\draw [ - , dotted , shorten~< = 0pt, shorten~> = 0pt , #2 ] |
| 3242 |
( #3 |- { \tlvBB , \tlvAA } ) -- ( #3 |- { \tlvAA , \tlvBB } ) ; |
| 3243 |
\end{pgfonlayer} |
| 3244 |
} |
| 3245 |
|
| 3246 |
|
| 3247 |
%% \xtCommentTo |
| 3248 |
% [line opt] (absolute to-coor) (relative from-coor) {text} [pos] (arrow end shorten dim) |
| 3249 |
\NewDocumentCommand \xtCommentTo { O{} r() r() G{} O{} D(){1pt} } |
| 3250 |
{ |
| 3251 |
\draw [ -> , densely~dotted , shorten~< = 0pt , shorten~> = #6 , #1 ] |
| 3252 |
( $ (#2) + (#3) $ ) to (#2) ; |
| 3253 |
\str_case:nnF {#5} |
| 3254 |
{ |
| 3255 |
{al} { \node at ( $ (#2) + (#3) $ ) [ above~left ] {#4} ; } |
| 3256 |
{ar} { \node at ( $ (#2) + (#3) $ ) [ above~right ] {#4} ; } |
| 3257 |
{bl} { \node at ( $ (#2) + (#3) $ ) [ below~left ] {#4} ; } |
| 3258 |
{br} { \node at ( $ (#2) + (#3) $ ) [ below~right ] {#4} ; } |
| 3259 |
{l} { \node at ( $ (#2) + (#3) $ ) [ left ] {#4} ; } |
| 3260 |
{r} { \node at ( $ (#2) + (#3) $ ) [ right ] {#4} ; } |
| 3261 |
{a} { \node at ( $ (#2) + (#3) $ ) [ above ] {#4} ; } |
| 3262 |
{b} { \node at ( $ (#2) + (#3) $ ) [ below ] {#4} ; } |
| 3263 |
} |
| 3264 |
{ |
| 3265 |
\node at ( $ (#2) + (#3) $ ) [ above, #5 ] {#4} ; |
| 3266 |
} |
| 3267 |
} |
| 3268 |
|
| 3269 |
%% \xtCommentFrom |
| 3270 |
% [line opt] (absolute from-coor) (absolute from-coor) {text} [pos] (arrow end shorten dim) |
| 3271 |
\NewDocumentCommand \xtCommentFrom{ O{} r() r() G{} O{} D(){1pt}} |
| 3272 |
{ |
| 3273 |
\draw [ -> , densely~dotted , shorten~< = 0pt , shorten~> = #6 , #1 ] (#2) to (#3) ; |
| 3274 |
\str_case:nnF {#5} |
| 3275 |
{ |
| 3276 |
{al} { \node at (#2) [ above~left ] {#4} ; } |
| 3277 |
{ar} { \node at (#2) [ above~right ] {#4} ; } |
| 3278 |
{bl} { \node at (#2) [ below~left ] {#4} ; } |
| 3279 |
{br} { \node at (#2) [ below~right ] {#4} ; } |
| 3280 |
{l} { \node at (#2) [ left ] {#4} ; } |
| 3281 |
{r} { \node at (#2) [ right ] {#4} ; } |
| 3282 |
{a} { \node at (#2) [ above ] {#4} ; } |
| 3283 |
{b} { \node at (#2) [ below ] {#4} ; } |
| 3284 |
} |
| 3285 |
{ |
| 3286 |
\node at (#2) [ above , #5 ] {#4} ; |
| 3287 |
} |
| 3288 |
} |
| 3289 |
|
| 3290 |
%% mid arrow styles: basics |
| 3291 |
% \xt@default... used |
| 3292 |
|
| 3293 |
\def\xt@default@arrow@pos { .55 } |
| 3294 |
\def\xt@arrow@pos { \xt@default@arrow@pos } |
| 3295 |
\def\xt@default@arrow@opt { black } % black needed here (not to depend on branch color) |
| 3296 |
\def\xt@arrow@opt { \xt@default@arrow@opt } |
| 3297 |
\def\xt@default@arrow@shape { > } |
| 3298 |
\def\xt@arrow@shape { \xt@default@arrow@shape } |
| 3299 |
\newcommand*\xtarrowpos { \xt@arrow@pos } |
| 3300 |
\newcommand*\xtarrowopt { \xt@arrow@opt } |
| 3301 |
\newcommand*\xtarrowshape { \xt@arrow@shape } |
| 3302 |
|
| 3303 |
|
| 3304 |
% \setxtarrowtips |
| 3305 |
% to toss values to arrow tip styles |
| 3306 |
\NewDocumentCommand \setxtarrowtips |
| 3307 |
{ |
| 3308 |
D<>{ \xt@default@arrow@pos } |
| 3309 |
G{ \xt@default@arrow@shape } |
| 3310 |
O{ \xt@default@arrow@opt } |
| 3311 |
} |
| 3312 |
{ |
| 3313 |
\renewcommand*\xt@arrow@pos {#1} |
| 3314 |
\renewcommand*\xt@arrow@shape {#2} |
| 3315 |
\renewcommand*\xtarrowopt { - , thin , solid , shorten~> = 0 , #3} |
| 3316 |
} |
| 3317 |
% initial set for defaults |
| 3318 |
\AtBeginDocument{\setxtarrowtips} |
| 3319 |
|
| 3320 |
% variable style [->]: |
| 3321 |
% accepts an option value changed by \xtarrowopt (this is better) |
| 3322 |
% alternative choice: use original value \xt@arrow@opt by default |
| 3323 |
\tikzset |
| 3324 |
{ ->- /.style = |
| 3325 |
{ |
| 3326 |
decoration = |
| 3327 |
{ |
| 3328 |
markings , |
| 3329 |
mark = at~position~ #1 ~with~ |
| 3330 |
{ \exp_last_unbraced:NNV \arrow [ \xtarrowopt ] { \xtarrowshape } } |
| 3331 |
} , |
| 3332 |
postaction = {decorate} |
| 3333 |
} , |
| 3334 |
->-/.default = \xt@arrow@pos |
| 3335 |
} |
| 3336 |
|
| 3337 |
\tikzset |
| 3338 |
{ ->>- /.style = |
| 3339 |
{ |
| 3340 |
decoration = |
| 3341 |
{ |
| 3342 |
markings , |
| 3343 |
mark = at~position~ #1 ~with~ |
| 3344 |
{ \exp_last_unbraced:NNo \arrow [ \xtarrowopt ] { >> } } |
| 3345 |
} , |
| 3346 |
postaction = {decorate} |
| 3347 |
} , |
| 3348 |
->>-/.default = .6 |
| 3349 |
} |
| 3350 |
|
| 3351 |
\tikzset |
| 3352 |
{ ->>>- /.style = |
| 3353 |
{ |
| 3354 |
decoration = |
| 3355 |
{ |
| 3356 |
markings , |
| 3357 |
mark = at~position~ #1 ~with~ |
| 3358 |
{ \exp_last_unbraced:NNo \arrow [ \xtarrowopt ] { >>> } } |
| 3359 |
} , |
| 3360 |
postaction = {decorate} |
| 3361 |
} , |
| 3362 |
->>>-/.default = .65 |
| 3363 |
} |
| 3364 |
|
| 3365 |
\tikzset |
| 3366 |
{ -o- /.style = |
| 3367 |
{ |
| 3368 |
decoration = |
| 3369 |
{ |
| 3370 |
markings , |
| 3371 |
mark = at~position~ #1 ~with~ |
| 3372 |
{ \exp_last_unbraced:NNo \arrow [ \xtarrowopt ] { o } } |
| 3373 |
} , |
| 3374 |
postaction = {decorate} |
| 3375 |
} , |
| 3376 |
-o-/.default = .55 |
| 3377 |
} |
| 3378 |
|
| 3379 |
\tikzset |
| 3380 |
{ -x- /.style = |
| 3381 |
{ |
| 3382 |
decoration = |
| 3383 |
{ |
| 3384 |
markings , |
| 3385 |
mark |
| 3386 |
= at~position~ #1 ~with~ |
| 3387 |
{ |
| 3388 |
\exp_last_unbraced:NNo \draw [ \xtarrowopt ] |
| 3389 |
(-2pt,-2pt) -- (2pt,2pt); |
| 3390 |
\exp_last_unbraced:NNo \draw [ \xtarrowopt ] |
| 3391 |
(2pt,-2pt) -- (-2pt,2pt); |
| 3392 |
} |
| 3393 |
} , |
| 3394 |
postaction = {decorate} |
| 3395 |
} , |
| 3396 |
-x-/.default = .5 |
| 3397 |
} |
| 3398 |
|
| 3399 |
|
| 3400 |
%% show midarrows |
| 3401 |
|
| 3402 |
\def\xt@show@midarrow { } |
| 3403 |
\def\xt@default@show@midarrow@pos { .55 } |
| 3404 |
\def\xt@show@midarrow@pos { \xt@default@show@midarrow@pos } |
| 3405 |
\def\xt@default@show@midarrow@opt { black } |
| 3406 |
\def\xt@show@midarrow@opt { \xt@default@show@midarrow@opt } |
| 3407 |
\def\xt@default@show@midarrow@shape { >} |
| 3408 |
\def\xt@show@midarrow@shape { \xt@default@show@midarrow@shape } |
| 3409 |
\newcommand*\xtshowmidarrowpos { \xt@show@midarrow@pos } |
| 3410 |
\newcommand*\xtshowmidarrowopt { \xt@show@midarrow@opt } |
| 3411 |
\newcommand*\xtshowmidarrowshape { \xt@show@midarrow@shape } |
| 3412 |
|
| 3413 |
% \setxtshowmidarrows (for simple tree) |
| 3414 |
% to toss values to [show~midarrow] |
| 3415 |
\NewDocumentCommand \setxtshowmidarrows |
| 3416 |
{ |
| 3417 |
D<>{ \xt@default@show@midarrow@pos } |
| 3418 |
G{ \xt@default@show@midarrow@shape } |
| 3419 |
O{ \xt@default@show@midarrow@opt } |
| 3420 |
} |
| 3421 |
{ |
| 3422 |
\renewcommand*\xt@show@midarrow@pos {#1} % default: .55 |
| 3423 |
\renewcommand*\xt@show@midarrow@shape {#2} |
| 3424 |
\renewcommand*\xtshowmidarrowopt {#3} |
| 3425 |
} |
| 3426 |
|
| 3427 |
|
| 3428 |
% show midarrow style |
| 3429 |
\tikzset { stoppostaction/.code = { \let \tikz@postactions \pgfutil@empty } } |
| 3430 |
\tikzset |
| 3431 |
{ show~midarrow /.style = |
| 3432 |
{ |
| 3433 |
decoration = |
| 3434 |
{ |
| 3435 |
markings , |
| 3436 |
mark = { at~position~ #1 ~with~ |
| 3437 |
{ \exp_last_unbraced:NNV |
| 3438 |
\arrow [ \xtshowmidarrowopt ] { \xt@show@midarrow@shape } } |
| 3439 |
} |
| 3440 |
} , |
| 3441 |
postaction = { stoppostaction , decorate } |
| 3442 |
} , |
| 3443 |
show~midarrow/.default = \xt@show@midarrow@pos % default: .55 |
| 3444 |
} |
| 3445 |
|
| 3446 |
|
| 3447 |
% \xtShowMidArrows |
| 3448 |
% on [show~midarrow] |
| 3449 |
\NewDocumentCommand \xtShowMidArrows{ } |
| 3450 |
{ |
| 3451 |
\renewcommand*\xt@show@midarrow { show~midarrow } |
| 3452 |
} |
| 3453 |
|
| 3454 |
% \xtHideMidArrows |
| 3455 |
% off [show~midarrow] |
| 3456 |
\NewDocumentCommand \xtHideMidArrows { } |
| 3457 |
{ |
| 3458 |
\renewcommand \xt@show@midarrow { } |
| 3459 |
} |
| 3460 |
|
| 3461 |
|
| 3462 |
%% show arrows |
| 3463 |
|
| 3464 |
\def\xt@show@arrow { } |
| 3465 |
\def\xt@default@show@arrow@pos { .55 } |
| 3466 |
\def\xt@show@arrow@pos { \xt@default@show@arrow@pos } |
| 3467 |
\def\xt@default@show@arrow@opt { black } |
| 3468 |
\def\xt@show@arrow@opt { \xt@default@show@arrow@opt } |
| 3469 |
\def\xt@default@show@arrow@shape { > } |
| 3470 |
\def\xt@show@arrow@shape { \xt@default@show@arrow@shape } |
| 3471 |
\def\xt@default@show@arrow@shorten { 1.2pt } |
| 3472 |
\def\xt@show@arrow@shorten { \xt@default@show@arrow@shorten } |
| 3473 |
\newcommand*\xtshowarrowpos { \xt@show@arrow@pos } |
| 3474 |
\newcommand*\xtshowarrowopt { \xt@show@arrow@opt } |
| 3475 |
\newcommand*\xtshowarrowshape { \xt@show@arrow@shape } |
| 3476 |
\newcommand*\xtshowarrowshorten { \xt@show@arrow@shorten } |
| 3477 |
|
| 3478 |
% \setxtshowarrows |
| 3479 |
% to toss values to [show~arrow] |
| 3480 |
\NewDocumentCommand \setxtshowarrows |
| 3481 |
{ |
| 3482 |
G{>} |
| 3483 |
O{\xt@default@show@arrow@opt} |
| 3484 |
D(){\xt@default@show@arrow@shorten} |
| 3485 |
} |
| 3486 |
{ |
| 3487 |
\renewcommand*\xt@show@arrow@shape{#1} % default: > |
| 3488 |
\renewcommand*\xtshowarrowopt{#2} % default: black |
| 3489 |
\renewcommand*\xt@show@arrow@shorten{#3} % default: 1.2pt |
| 3490 |
} |
| 3491 |
|
| 3492 |
% show arrow style |
| 3493 |
\tikzset{stoppostaction/.code={\let\tikz@postactions\pgfutil@empty}} |
| 3494 |
\tikzset |
| 3495 |
{ show~arrow /.style = |
| 3496 |
{ |
| 3497 |
decoration = |
| 3498 |
{ |
| 3499 |
markings , |
| 3500 |
mark = { |
| 3501 |
at~position~ 1 + - \pgf@shorten@end@additional + - #1 ~with~ |
| 3502 |
{ \exp_last_unbraced:NNV |
| 3503 |
\arrow [ \xtshowarrowopt ] { \xt@show@arrow@shape } } |
| 3504 |
} |
| 3505 |
} , |
| 3506 |
postaction = { stoppostaction , decorate } |
| 3507 |
} , |
| 3508 |
show~arrow/.default = \xt@show@arrow@shorten % default: 1.2pt |
| 3509 |
} |
| 3510 |
|
| 3511 |
% \xtShowArrows |
| 3512 |
% on [show~arrow] |
| 3513 |
\NewDocumentCommand \xtShowArrows { O{solid~node} } |
| 3514 |
{ |
| 3515 |
\xtShowEndPoints[#1] |
| 3516 |
\renewcommand*\xt@show@arrow { show~arrow } |
| 3517 |
} |
| 3518 |
|
| 3519 |
% \xtHideArrows |
| 3520 |
% off [show~arrow] |
| 3521 |
\NewDocumentCommand \xtHideArrows { s } |
| 3522 |
{ |
| 3523 |
\IfBooleanTF {#1} { \xtShowEndPoints } { \xtHideEndPoints } |
| 3524 |
\renewcommand\xt@show@arrow { } |
| 3525 |
} |
| 3526 |
|
| 3527 |
\ExplSyntaxOff |
| 3528 |
\endinput |