树未编译

树未编译

我正在使用如下树:

\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

我找到了答案。树无法,在其节点内获取。解决方案是使用 注释掉它\

相关内容