I need to add lines or arrows to show the expansion of possibilities as a problem space expand. For example I'm attempting to produce something like this (with the lines added by hand):
I can find examples for adding arrows over the top of an equation How to draw arrows between parts of an equation to show the Math Distributive Property (Multiplication)? and I've started by creating the layout I want using an align block (shown below) and I'm trying to join the sections with arrows as shown in the linked question but I've yet to produce anything useful.
\begin{align*}
&&&&(1, 1, 0, 0)&\\
&&(1, 0, 0, 0)&&(1,0,1,0)&\\
0&&(0, 1, 0, 0)&&(1,0,0,1)&\\
&&(0, 0, 1, 0)&&&\\
&&(0, 0, 0, 1)&&&
\end{align*}
This feels somewhat crude, can anybody help me complete what I started or suggest a more elegant way (perhaps using a table to store the options and then linking the cells)?
Best Answer
A simple manner to achieve the result is using the TikZ tree construction:
gives:
Where:
grow=right
means that the tree grows in the right direction;sibling distance=20pt
means that the distance between childs is20pt
(change this to increase or reduce this distance);level distance=2.65cm
represents the distance of the different levels;edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)}
redefines the path from parent nodes to child nodes (to be a straight line); if you don't use this construction, the path is not perfect because some of the connection do not point to the left of the nodes, but to their center.To have a connection with final arrows, you just have to change:
with:
By using the
\tikzmark
macro as the answer you linked, one might proceed as follows:\vertalignmath
is to have a correct vertical setting;align
block: the markers are placed before and after the elements: it is important to give unique names;\connect
is defined: and then used: to connect in the right way the markers.The complete code:
The result, after at least two compilation runs, is:
In order to have arrows, the
\connect
macro can be changed into:Then the use of:
will generates: