编辑(新问题)

编辑(新问题)

哪个包易于使用:forest、qtree 还是其他包,用于绘制像下图这样的有根树? 在此处输入图片描述 (我需要能够画树、画有切口的树、在方程中大量使用树,并且偶尔标记边和顶点。)

如何使用包来绘制图中的有根树?(语义是什么?)

(此外,qtree 和 tikz-qtree 之间有区别吗?或者它们是同一个包?)

答案1

*我认为我不应该回答那些“替我做”的问题(或以使得现有答案无效的方式编辑的问题)。但我很拖延,而且喜欢树,所以我会做那些不该做的事情。*

但是,我严格按照“原样”提供此类答案。我不会对查询、解释要求和微调要求表示同情。我会回答这些问题。如果这些答案恰好对某人有用,那就太好了。如果没有用,那就太糟糕了。

编辑(新问题)

树木

\documentclass[border=10pt]{standalone}
\usepackage{forest}
\usetikzlibrary{shapes.geometric,decorations.markings}
\forestset{
  my tree/.style={
    before typesetting nodes={
      for tree={
        if={>O+tt=!O_=&{content}{}{n}{1}}{
          label/.process={Ow}{content}{left:##1},
        }{
          label/.process={Ow}{content}{right:##1},
       },
        content=,
      },
    },
    where level=0{
      draw,
      baseline,
      diamond,
    }{
      draw,
      fill,
      circle,
    },
    for tree={inner sep=1.5pt, s sep'+=10pt},
  },
  default preamble={my tree},
  cut/.style={
    tikz+={
      \path [decorate, decoration={markings, mark=at position .5 with {\draw [] +(90:2.5pt) -- +(-90:2.5pt);}}] ()  -- (!u);
    }
  }
}
\begin{document}
\begin{forest}
  [
    [[[][]]]
    [[]]
  ]
\end{forest}
\begin{forest}
  [
    [$c_1$, edge label={node [midway, left] {$a_2$}}]
    [$f_2$, edge label={node [midway, right] {$b_1$}}
      [$v_1$
        [, phantom]
        [$v_2$]
      ]
    ]
  ]
\end{forest}
\begin{forest}
  [
    [, cut
      []
    ]
    [, cut]
  ]
\end{forest}
\end{document}

原文(第一个问题)

您的问题的任何答案都不可能令人满意,因为这个问题要求的内容超出了这里所能说的范围,并且无论如何都没有明确定义。

相反,我以树的形式呈现 CTAN 的Tree主题,以说明唯一可能的答案是

这取决于。

什么?

在很多事情上....

树主题

[这个插图回答的一个问题是和是否qtreetikz-qtree同一个包裹。]

事实上,还有更多用于绘制树的软件包,但并非所有软件包都包含在 CTAN 主题中,甚至不在 CTAN 上。其中一些已经过时,许多已被弃用。有些可能根本不起作用。

最容易学吗?

你知道什么?

最容易使用吗?

为了什么目的?多久一次?你的工作流程是怎样的?你喜欢什么?

最好看的?

在谁的眼里?什么样的树?什么样的观众?你喜欢什么?

对于有根的树来说?

根据定义,所有树都有根。无根树(或多根树)不是树,而是图。

你?

我,我会告诉你学习prooftrees。但它画的是一种非常特殊的树。

对于其他树木来说呢?

我,我会告诉你学习森林。但它不是最容易学习或使用的,而且它并不总是能给出最好的结果。有些树它根本画不出来。

\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\usepackage{cfr-lm}
\begin{document}
\begin{forest}
  forked edges,
  before typesetting nodes={
    for tree={
      split option={content}{:}{content,desc},
    },
  },
  desc/.style={
    font=\ttfamily,
    l sep'=0pt,
    delay={append={[{#1}, font=\footnotesize\sffamily, rotate=-90, child anchor=west, no edge]}}
  },
  for tree={
    font=\sffamily\small,
    s sep'-=5pt,
  }
  [CTAN
    [Topic tree
      [{\texttt{(e)epic}, PIC\TeX{} etc.}
        [baum:{Trees, using  PiC\TeX}]
        [ecltree:{Trees using epic  and eepic macros}]
      ]
      [MP
        [drv:{Derivation trees  with METAPOST}]
      ]
      [PS
        [pst-Jtree:{Typeset complex  trees for linguists}]
        [pst-qtree:{Simple syntax  for trees}]
        [pstrees:{Construct linguistics  trees using a  preprocessor}]
        [pst-tree:{Trees, using PSTricks}]
        [pst-tvz:{Draw trees with  more than one  root node, using  PSTricks}]
      ]
      [Ti\emph{k}Z
        [binarytree:{Drawing binary  trees using  Ti\emph{k}Z}]
        [forest:{Drawing  (linguistic) trees}]
        [prooftrees:{Forest-based  proof trees  (symbolic logic)}]
        [tikz-dependency:{A library for  drawing dependency  graphs}]
        [tikz-qtree:{Use existing  qtree syntax for  trees in Ti\emph{k}Z}]
        [ texttt{trees}]
      ]
      [XY
        [xyling:{Draw syntactic  trees, etc., for  linguistics literature,  using xy-pic}]
        [xytree:{Tree macros using XY-Pic}]
      ]
      [Other
        [dirtree:{Display trees  in the style of  windows explorer}]
        [emtrees:{Draw labelled  trees, using em\TeX{}  specials}]
        [qtree:{Draw tree  structures}]
        [treedef:{Macros to typeset  trees in Plain \TeX}]
      ]
      [??
        [adtrees:{Macros for drawing  adpositional trees}]
        [chomsky:{Macros to typeset  parsing trees}]
        [dyntree:{Construct Dynkin  tree diagrams}]
        [eppstein-trees:{Macros for  producing trees}]
        [gl-tree:{Linguistic trees  with a preprocessor}]
        [lingtrees:{Linguistics trees  preprocessor and macros}]
        [linguex:{Format linguists' examples}]
        [prftree:{Macros for building proof trees}]
        [proofs:{Macros for building proof trees}]
        [qobitree:{\LaTeX{} macros for typesetting trees}]
        [RRGtrees:{Linguistic tree diagrams  for Role and Reference  Grammar (RRG)  with \LaTeX}]
        [syntrace:{Labels for tracing in a syntax tree}]
        [synttree:{Typeset syntactic trees}]
        [tree-dvips:{Trees and other linguists' macros}]
        [treesvr:{Tree macros}]
        [treetex-ltx209:{Draw horizontally- or  vertically-oriented trees}]
        [treetex-plain:{Draw trees}]
        [williams:{Miscellaneous macros by Peter Williams}]
        [wotree:{Draw Warnier/Orr diagrams}]
      ]
    ]
  ]
\end{forest}
   
\end{document}

相关内容