我想将树放在页面的右侧,并使列表向上移动,以便它们并排放置。尝试了几种方法,但都无法解决。非常感谢任何帮助。
\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
\setlength\parindent{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}
答案1
如果我理解得很好的话,下面是经典的做法。
\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}