我正在为我的论文文档构建一个层次结构图,其中包含大量子节点和父节点,但它们超出了纸张的大小,因此我无法看到图表的一半内容。我使用的代码如下:
\documentclass[12pt,oneside]{mitthesis}
\usepackage{geometry}
\usepackage{forest}
\begin{document}
\noindent\begin{forest}
for tree={
parent anchor=south,
child anchor=north,
align=left,
edge path={
\noexpand\path [\forestoption{edge}] (!u.parent anchor) -- +(0,-5pt) -| (.child anchor)\forestoption{edge label};
},
}
[Text Summarization
[Extractive\\Summarization
[Similarity
[Topic
[Explicit]
[Implicit]]
[Cluster, tier=other
[Gold Method]
[test]]
]
[Lexical Chain
[LexGraph]
[LexRank]
]
[Classification, tier=other
[Supervised]
[Unsupervised]
]
[Feature\\Selection
[Graph Based]
[Swarm Based]
[Document Categorization]
]
[Feature\\Extraction
[Sentence\\Segmentation]
[Fuzzy Logic]
[Sentence Ranking]
]
]
[Abstractive\\Summarization]
]
\end{forest}
\end{document}
我想在单个页面上显示所有内容,但对于mitthesis
页面格式,任何帮助都将不胜感激。
答案1
您可以使用横向模式的纸张旋转树。但是,您仍需要做很多工作才能使树适合纸张。您可以使其变小并降低可读性,或者您可以调整节点的级别,使层次关系不那么明显。
相反,我建议采用不同类型的树结构。例如,您可以将树设置为我认为的“目录树”或“进程树”:
\documentclass[12pt,oneside,a4paper]{book}
\usepackage{geometry}
\usepackage{forest}
\forestset{
dir tree/.style={
for tree={
parent anchor=south west,
child anchor=west,
anchor=mid west,
inner ysep=1pt,
grow'=0,
align=left,
edge path={
\noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) ++(1em,0) |- (.child anchor)\forestoption{edge label};
},
font=\sffamily,
if n children=0{}{
delay={
prepend={[,phantom, calign with current]}
}
},
fit=band,
before computing xy={
l=2em
}
},
}
}
\begin{document}
\noindent
\begin{forest}
dir tree
[Text Summarization
[Extractive Summarization
[Similarity
[Topic
[Explicit]
[Implicit]
]
[Cluster
[Gold Method]
[test]
]
]
[Lexical Chain
[LexGraph]
[LexRank]
]
[Classification
[Supervised]
[Unsupervised]
]
[Feature Selection
[Graph Based]
[Swarm Based]
[Document Categorization]
]
[Feature Extraction
[Sentence Segmentation]
[Fuzzy Logic]
[Sentence Ranking]
]
]
[Abstractive Summarization]
]
\end{forest}
\end{document}
这种方法可以轻松地将树放在 A4 纸上,保持标准字体大小并清晰地表示层次关系。