![创建箭头(无箭头头)并在文本框内书写](https://linux22.com/image/457263/%E5%88%9B%E5%BB%BA%E7%AE%AD%E5%A4%B4%EF%BC%88%E6%97%A0%E7%AE%AD%E5%A4%B4%E5%A4%B4%EF%BC%89%E5%B9%B6%E5%9C%A8%E6%96%87%E6%9C%AC%E6%A1%86%E5%86%85%E4%B9%A6%E5%86%99.png)
答案1
如果您愿意使用 LuaLaTeX(也可以与 MiKTeX 一起使用),则可以为此使用 TikZ 库graph
+ :graphdrawing
%!TeX lualatex
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}
\graph [binary tree layout,level distance=30mm] {
some writing some writing some writing -- {
{more writing 1},
{more writing 2},
{more writing 3}
}
};
\end{tikzpicture}
\end{document}
查看TikZ 用户手册,第 27 章,算法图形绘制简介了解更多信息。
但是,也有建议,不需要 LuaLaTeX 但也可以与 XeLaTeX 的 PDFLaTeX 一起使用,例如使用 TikZ 库树:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}
\node {some writing some writing some writing}
[grow via three points={
one child at (-3,-2) and two children at (-3,-2) and (0,-2)}]
child {node {more writing 1}}
child {node {more writing 2}}
child {node {more writing 3}};
\end{tikzpicture}
\end{document}
请参阅第 76 章,树库的 TikZ 用户手册了解更多信息。
答案2
使用forest
包及其库(作为包选项加载),绘制图表非常简单。下面的 MWE(最小工作示例),您可以使用 pdfLateX、XeLaTeX 或 LuaLaTeX 进行编译:
\documentclass{article}
\usepackage{lipsum} % for dummy text
\usepackage[linguistics]{forest}
\begin{document}
\lipsum[11]
\begin{figure}[ht]
\centering
\begin{forest}
for tree = {l sep=13mm}
[some writing some writing some writing
[more writing 1]
[more writing 2]
[more writing 3]
]
\end{forest}
\end{figure}
\lipsum[66]
\end{document}
答案3
这是使用 的替代方法forest
。您可以更改l sep
(级别分离)以增加或减少垂直间距,并更改s sep
(兄弟分离)以更改水平间距。
\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={parent anchor=south, child anchor=north, l sep=1.5cm, s sep=1cm}
[Some writing some writing some writing
[more writing 1]
[more writing 2]
[more writing 3]
]
\end{forest}
\end{document}
该forest
软件包有许多改变树外观的选项。添加级别也很容易。只需在方括号中添加节点即可。例如:
[Some writing some writing some writing
[more writing 1
[more 11a][more 1b]
]
[more writing 2
[more 2a][more 2]
]
[more writing 3
[more 3a][more 3b][more 3c]
]
]