我正在使用如下树:
\begin{figure}
{\scriptsize
\begin{forest}
for tree={
font=\ttfamily,
grow'=0,
child anchor=west,
parent anchor=south,
anchor=west,
calign=first,
edge path={
\noexpand\path [draw, \forestoption{edge}]
(!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};
},
before typesetting nodes={
if n=1
{insert before={[,phantom]}}
{}
},
fit=band,
before computing xy={l=15pt},
}
[Evaluation Setups, Test Sets and Models
[Closed w/ Closed Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
[Open w/ Closed Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
[Open w/ Open Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
]
\end{forest}
}
\caption{Summary of Experiments}
\end{figure}
改编自:
和:
为什么这个图无法编译?我很确定方括号确实对齐了。
答案1
树可以,
在其节点内进行操作。我不明白使用的建议\
。当然\,
不会做同样的事情!
包含逗号时的唯一问题是 Forest 将节点中的内容读取为以逗号分隔的键列表,形式如下
<node content>, <key>=<value>, <key>=<value>, ...
为了防止 Forest 尝试读取
Evaluation Setups, Test Sets and Models
Evaluation Setups
作为一个应该应用该选项的内容节点Test Sets and Models
,您只需用花括号保护内容即可。
{Evaluation Setups, Test Sets and Models}
但是,我强烈建议使用当前 Forest 提供的更新选项,包括该edges
库。
这大大简化了树的前言并提供了更灵活、更强大的解决方案。
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={%
folder,
font=\ttfamily,
grow'=0,
edge label={node [midway, inner sep=1.25pt, fill] {}},
}
[{Evaluation Setups, Test Sets and Models}
[Closed w/ Closed Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
[Open w/ Closed Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
[Open w/ Open Hyper-Parameters optimised from Test Set 1
[Test Set 1: Textual Patterns Output Test Set
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
[Test Set 2: Freshly Annotated Claim Labels
[Distantly Supervised Classifier]
[Cost Sensitive Classifier]
[Textual Patterns Baseline]
[Naive Baselines]
]
]
]
\end{forest}
\end{document}
答案2
我找到了答案。树无法,
在其节点内获取。解决方案是使用 注释掉它\
。