Istgame.Sty Draw Game Trees with Ti Kz
Total Page:16
File Type:pdf, Size:1020Kb
istgame.sty Draw Game Trees with TikZ In-Sung Cho ischo <at> ktug.org Economics, Kongju National University 2019/01/27 version 2.0 Abstract This is a LATEX package that provides macros based on TikZ to draw a game tree. The main idea underlying the core macros here is the completion of a whole tree by using a sequence of simple ‘parent-child’ tree structures, with no longer nested relations involved like the use of grandchildren or great-grandchildren. With the istgame package, you can draw a game tree as easily as drawing a game tree with pen and paper. Keywords: game trees, nodes, branches, information sets, continuum of branches, subgames Table of Contents 0 Changes and remarks ..................................... 1 0.1 Changes ......................................... 1 0.2 What’s new ....................................... 2 0.3 How to read this document ............................... 3 0.4 Remarks ......................................... 4 0.5 Previous changes (up to version 1.0) .......................... 5 1 Getting started ......................................... 6 1.1 Getting-started example: a simple tree ........................ 6 1.2 Connecting simple tree structures ........................... 6 1.3 Complete examples for desperate users ........................ 7 1.3.1 How to put a decision node and its owner ................. 7 1.3.2 How to print branches with action labels and payoffs ........... 7 1.3.3 How to put information sets ......................... 8 1.3.4 How to put a continuum of branches .................... 9 1.3.5 How to change the growing direction of a tree ............... 9 2 Important distances: \xtdistance .............................. 10 3 The istgame environment and node styles .......................... 11 3.1 The istgame environment ................................ 11 3.2 Node styles ........................................ 11 3.2.1 Basic node styles ............................... 11 3.2.2 Your own node styles: \setistNewNodeStyle . 12 4 Core macro: \istroot .................................... 14 4.1 \istroot: basics .................................... 14 4.1.1 \istroot – counterclockwise: standard version . 14 4.1.2 \istroot' – clockwise: swap version .................... 16 4.2 \istrooto: oval version ................................ 17 4.2.1 \istrooto – counterclockwise ........................ 17 4.2.2 \istrooto' – clockwise: swap version ................... 18 5 Core macro: \istb ...................................... 18 5.1 \istb: basics ...................................... 18 i 5.1.1 Basics: branches, action labels, and payoffs . 18 5.1.2 Printing action labels in italics in text mode: \setistmathTF* . 22 5.2 \istb*: starred version ................................. 22 5.2.1 \istb*: basics ................................ 22 5.2.2 \xtShowEndPoints and \xtHideEndPoints . 23 5.3 \istbt: terminal version ................................ 23 5.3.1 \istbt: basics ................................ 23 5.3.2 \xtShowTerminalNodes and \xtHideTerminalNodes . 23 5.4 \istB: dual label version ................................ 24 5.4.1 \istB: basics ................................. 24 5.4.2 \xtActionLabel and \xtActionLabel* . 25 5.5 \istbA: alternative (or arc) version .......................... 26 5.5.1 \istbA: basics ................................ 26 5.5.2 \istbA: application ............................. 26 6 Important labels: players, action labels, and payoffs .................... 27 6.1 How to put players ................................... 27 6.1.1 Players: basics ................................ 27 6.1.2 Coloring players or a whole simple tree using \istroot . 27 6.1.3 Decorating players or a whole simple tree using \istrooto . 28 6.1.4 Changing the input mode and text font style: \setistmathTF(*) . 29 6.2 How to put action labels ................................ 30 6.2.1 Action labels: basics ............................. 30 6.2.2 Decorating action labels ........................... 30 6.2.3 Sloped action labels ............................. 31 6.2.4 Dual action labels .............................. 32 6.2.5 Changing the input mode and text font style: \setistmathTF(*) . 32 6.3 How to put payoffs ................................... 33 6.3.1 Payoffs: basics ................................ 33 6.3.2 Payoffs and \istgrowdirection ...................... 33 6.3.3 Decorating payoffs .............................. 35 6.3.4 Changing the input mode and text font style: \setistmathTF(*) . 35 7 Input mode and text font style changer: \setistmathTF(*) . 36 7.1 \setistmathTF: input mode changer ......................... 36 7.2 \setistmathTF*: input mode and text font style changer . 37 7.3 \setistmathTF* and supplementary macros \xtFoo* printing labels . 37 8 Fine-tuning positions of players, action labels, and payoffs (experimental) . 39 8.1 Fine-tuning positions: owners ............................. 39 8.2 Fine-tuning positions: action labels .......................... 39 8.2.1 Abbreviations: [l], [r], [a], and [b] ................... 39 8.2.2 Abbreviations: [al], [ar], [bl], and [br] . 40 8.3 Fine-tuning positions: payoffs ............................. 41 9 Growing direction of trees ................................... 41 9.1 \setistgrowdirection – counterclockwise ...................... 42 9.2 \setistgrowdirection' – clockwise ......................... 42 9.3 Examples of rotating trees with \setistgrowdirection . 43 9.3.1 A tree growing east – counterclockwise ................... 43 9.3.2 A tree growing east – clockwise ....................... 43 9.3.3 A tree growing north – counterclockwise . 44 9.3.4 A tree growing north – clockwise ...................... 44 9.3.5 \setxtgrowkey for one simple tree ..................... 44 10 Information sets ........................................ 45 10.1 \xtInfoset: standard version ............................. 45 10.2 \xtInfosetO: oval version ............................... 46 10.2.1 \xtInfosetO: basics ............................. 46 10.2.2 Sloped information sets ........................... 48 10.2.3 \setxtinfosetstyle ............................ 48 ii 10.2.4 \setxtinfosetlayer ............................ 49 10.3 \xtCInfoset: curved version .............................. 50 10.3.1 Curved information sets with \xtCInfoset: basics . 50 10.3.2 Skewed \xtCInfoset: full function ..................... 50 10.4 \xtCInfosetO: curved oval version .......................... 52 10.4.1 Curved bubble type information sets with \xtCInfosetO: basics . 52 10.4.2 Skewed \xtCInfosetO: full function .................... 53 10.5 Fine-tuning \xtCInfosetO: Not for most users .................... 53 10.5.1 \xtCInfosetOTurnX: too high or too low midpoint factor . 53 10.5.2 Scaling information sets according to the value of TikZ scale . 55 11 Continuum of branches .................................... 56 11.1 \istrootcntm: standard continuum version ..................... 56 11.1.1 \istrootcntm: basics ............................ 56 11.1.2 \cntmdistance ................................ 58 11.1.3 \cntmdistance*: combined with \xtdistance . 58 11.1.4 \cntmpreset: controlling continuum triangles . 59 11.1.5 \cntmpreset*: simple triangles with no background color . 60 11.2 \istrootcntmA: continuum arc version ........................ 61 11.2.1 \istrootcntmA: basics ........................... 61 11.2.2 \istrootcntmA and \istbA ......................... 62 11.2.3 \cntmApreset: controlling continuum arcs and wedges . 63 11.3 \istrootocntm and \istrootocntmA: oval continuum versions . 64 11.4 Doing some chores: not for most users ........................ 65 11.4.1 \cntmistb: controlling outermost branches . 65 11.4.2 \cntmAistb: controlling outermost branches . 66 11.4.3 \xtShowEndPoints* ............................. 67 11.5 Information sets for continua of branches ....................... 68 11.5.1 Information sets for continuum triangles . 68 11.5.2 \cntmAInfoset for continuum arcs ..................... 68 11.5.3 \cntmAInfosetO: oval version ....................... 69 11.5.4 Fine-tuning \cntmAInfosetO: Not for most users . 70 11.6 Transition from obsolete macros \istcntm and \istcntmarc . 70 12 Arrows ............................................. 72 12.1 Using TikZ arrow options with istgame ........................ 72 12.1.1 TikZ arrow option -> ............................ 72 12.1.2 Fine-tuning with \setistgameshorten: Not for most users . 72 12.2 Middle arrows for a branch ............................... 73 12.2.1 A middle arrow for each \istb ....................... 73 12.2.2 Middle arrow tip styles ........................... 73 12.2.3 \setxtarrowtips: controlling middle arrow tips via ->- . 74 12.3 Middle arrow for simple tress ............................. 74 12.3.1 \xtShowMidArrows and \xtHideMidArrows . 74 12.3.2 \setxtshowmidarrows: controlling \xtShowMidArrows . 75 12.4 Arrows for simple trees ................................. 76 12.4.1 \xtShowArrows and \xtHideArrows .................... 76 12.4.2 \setxtshowarrows: controlling \xtShowArrows . 76 12.4.3 Arrows and continua of branches: examples (Not for most users) . 77 13 Supplementary macros .................................... 78 13.1 Supplementary macros to important labels ...................... 78 13.2 More supplementary macros .............................. 79 13.2.1 \xtTimeLineH and \xtTimeLineV ..................... 79 13.2.2 \xtCommentTo and \xtCommentFrom .................... 81 14 Representing subgames .................................... 82 14.1 \xtSubgameBox (experimental) ............................