TransWikia.com

Place forest side by side with text/equations

TeX - LaTeX Asked on June 21, 2021

I would like to place the tree on the right side of the page and make the list come upwards so that they stand side by side. Have been trying several things but could not work it out. Any help is very much appreciated.

documentclass[12pt, tikz]{article}
usepackage{answers}
usepackage{setspace}
usepackage{graphicx}
usepackage{slashbox}
usepackage{enumitem}
usepackage[colorlinks]{hyperref}
usepackage{multicol}
usepackage{booktabs}
usepackage{amsmath}
usepackage{mathrsfs}
usepackage[table,x11names]{xcolor}
usepackage[margin=1in]{geometry}
usepackage{float}
usepackage{amsmath,amsthm,amssymb}
usepackage[utf8]{inputenc}
usepackage {tikz}
usetikzlibrary{trees}
usepackage{tikz-timing}[2014/10/29]
usetikztiminglibrary[rising arrows]{clockarrows}
usetikzlibrary {positioning}
usepackage{xcolor}
definecolor {processblue}{cmyk}{0.96,0,0,0}
usepackage{caption}
usepackage{array}
newcolumntype{?}{!{vrule width 2pt}}
usepackage[spanish, es-tabla]{babel}
makeatletter
renewcommand{@seccntformat}[1]{}
makeatother
setlengthparindent{24pt}
usepackage{forest}
usetikzlibrary{arrows.meta}

 
begin{document}


begin{forest}
for tree = {
    circle, draw, 
    minimum size=1.5em,
    inner sep=2pt,
%
    s sep=3mm,
    l sep=7mm,
    edge={-Straight Barb} % arrows head defined in 'arrows.meta'
            }
[A
    [B
        [F]
    ]
    [C
        [D
            [G
                [F
                    [H]
                ]
                [H]
            ]
        ]
        [E
            [F]
        ]
    ]
]
end{forest}


begin{aligned}
&[(A,0)]
&[ ]
&
&[(B,11), (C,26)]
&[(A,0)]
&
&[(C,26), (F,74)]
&[(B,11), (A,0)]
&
&[(D,31), (E,38), (F,74)]
&[(C, 26), (B,11), (A,0)]
&
&[(E,38), (G,46), (F,74)]
&[(D,31), (C, 26), (B,11), (A,0)]
&
&[(G,46), (F,74), (F,109)]
&[(E,38), (D,31), (C, 26), (B,11), (A,0)]
&
&[(F,53), (H,61), (F,74), (F,109)]
&[(G,46), (E,38), (D,31), (C, 26), (B,11), (A,0)]
&
&[(H,61), (H,73), (F,74), (F,109)]
&[(F,53), (G,46), (E,38), (D,31), (C, 26), (B,11), (A,0)]
end{aligned}


end{document}

One Answer

Here is the classic way to do that if I have understood well the question.

documentclass[12pt, tikz]{article}

usepackage[utf8]{inputenc}

usepackage{amsmath}

usepackage{multicol}

usepackage{tikz}
usetikzlibrary{arrows.meta}

usepackage{forest}

 
begin{document}

begin{multicols}{2}
$begin{aligned}
&[(A,0)]
&[ ]
&
&[(B,11), (C,26)]
&[(A,0)]
&
&[(C,26), (F,74)]
&[(B,11), (A,0)]
&
&[(D,31), (E,38), (F,74)]
&[(C, 26), (B,11), (A,0)]
&
&[(E,38), (G,46), (F,74)]
&[(D,31), (C, 26), (B,11), (A,0)]
&
&[(G,46), (F,74), (F,109)]
&[(E,38), (D,31), (C, 26), (B,11), (A,0)]
&
&[(F,53), (H,61), (F,74), (F,109)]
&[(G,46), (E,38), (D,31), (C, 26), (B,11), (A,0)]
&
&[(H,61), (H,73), (F,74), (F,109)]
&[(F,53), (G,46), (E,38), (D,31), (C, 26), (B,11), (A,0)]
end{aligned}$


begin{forest}
for tree = {
    circle, draw, 
    minimum size=1.5em,
    inner sep=2pt,
%
    s sep=3mm,
    l sep=7mm,
    edge={-Straight Barb} % arrows head defined in 'arrows.meta'
            }
[A
    [B
        [F]
    ]
    [C
        [D
            [G
                [F
                    [H]
                ]
                [H]
            ]
        ]
        [E
            [F]
        ]
    ]
]
end{forest}
end{multicols}

end{document}

enter image description here

Answered by projetmbc on June 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP