我正在尝试重现下面的图片。如您所见,左边距有一些信息:频道、代码类型、发送者等,与后代对齐。
此外,Repertoire of codes and channels
> visual
>上+ verbal
有更多信息placards, banner etc.
相同的信息也出现在-verbal
> figure
> + durative
aso
这是我尝试过的
这是我第一次使用森林包
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage[linguistics]{forest}
\begin{document}
\begin{forest}% should be fit to page
[Repertoriul codurilor și al canalelor
[vizual % this is CHANEL
[+ verbal % this is Code type
[,phantom
[pancarde % has to be aditional info to the tree
[banere % has to be aditional info to the tree
[etc.] % has to be aditional info to the tree
]
]
]
]
[- verbal
[figura % this is the Sender
[+ durativ] % information transmission
[- durativ]
]
[scena
[+ durativ]
[- durativ]
]
]
]
[(olfactiv)]
[(haptic)]
[(gustativ)]
[(acustic)
[+ verbal
[lingvistic
[figura
[+ durativ]
[- durativ]
]
[scena]
]
[paralingvistic
[figura
[+ durativ]
[- durativ]
]
[scena]
]
]
[- verbal
[figura]
[scena]
]
]
];
\end{forest}
\end{document}
答案1
对于侧面的信息,您的想法是正确的,但位于树的错误层级。您需要将幻影分支作为树的最左侧分支,然后为后续标签指定no edge
删除节点之间的线。
对于终端节点下方的额外信息,您只需使用\\
在节点标签中创建新行即可。由于您正在加载库linguistics
,因此节点已经用键指定align=center
,因此节点标签可以\\
在其中。(在我之前的版本中,我用创建这些节点是no edge
因为我认为它们均匀地位于树的底行,但回想起来,我认为这不是最好的方法。)
为了更忠实地重现图像中的树,我还tier=fig
为每个节点添加了一个明确的键,以便所有“发送者”级别的节点都出现在同一级别。
除非您想将字体变小,否则没有好的方法可以使这棵树更紧凑并使其以纵向模式适合页面,使用默认页边距,并且它几乎不适合 A4 页面上 1 厘米的边距,所以我建议使用包lscape
及其landscape
环境将树置于横向。
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc} % not needed with recent TeX distributions
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage[linguistics]{forest}
\usepackage{lscape}
\begin{document}
\begin{landscape} % use this environment to make the tree appear in landscape mode
\begin{forest}% should be fit to page
[Repertoriul codurilor și al canalelor
[chanel,for tree=no edge
[code type
[sender,tier=fig
[information\\transmission % has to be aditional info to the tree
]
]
]
]
[vizual % this is CHANEL
[+ verbal\\pancarde\\banere\\etc.% this is Code type
]
[- verbal
[figura,tier=fig % this is the Sender
[+ durativ] % information transmission
[- durativ]
]
[scena,tier=fig
[+ durativ\\some extra \\information ]
[- durativ]
]
]
]
[(olfactiv)]
[(haptic)]
[(gustativ)]
[(acustic)
[+ verbal
[lingvistic
[figura,tier=fig
[+ durativ]
[- durativ]
]
[scena,tier=fig]
]
[paralingvistic
[figura,tier=fig
[+ durativ]
[- durativ]
]
[scena,tier=fig]
]
]
[- verbal
[figura,tier=fig]
[scena,tier=fig]
]
]
];
\end{forest}
\end{landscape}
\end{document}