森林边缘的特殊符号/颜色

森林边缘的特殊符号/颜色

我正在研究森林,这是迄今为止我构建的树的一部分:

\documentclass[twoside]{article}
\usepackage{tipa}
\usepackage{setspace}
\usepackage{upgreek}
\usepackage{float}
\usepackage{libertine}
\usepackage[toc,page]{appendix}
\usepackage{mathrsfs}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}
\makeatother
\usepackage{tikz}
\usepackage[linguistics]{forest}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{amsmath,textcomp}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\forestset{%
  /tikz/squiggly/.style={decorate, decoration={snake, amplitude=.5mm, segment length=2mm}},
  wiggly/.style={edge=squiggly},
  move me/.style n args=2{%
    before drawing tree={%
      x+=#1,
      y+=#2,
    },
  },
}

 \usepackage[table]{xcolor}

\let\oldemptyset\emptyset
\let\emptyset\varnothing
\usepackage{lscape}
%\include{SpectorMacros}
%\usepackage{pict2e}
%\usepackage{graphics}
\usepackage{qtree}
%\usepackage{pslatex}
\usepackage{natbib}
\usepackage[hang]{footmisc}
\usepackage{ragged2e}
\usepackage{multicol}
\usepackage{amssymb}
\usepackage{tree-dvips}
%\addtolength{\oddsidemargin}{-.25in}
%   \addtolength{\evensidemargin}{-.25in}
%   \addtolength{\textwidth}{.50in}
%
%   \addtolength{\topmargin}{-.25in}
%   \addtolength{\textheight}{.5in}
\usepackage{fullpage}
\usepackage{float}
\restylefloat{table}
%\usepackage[margin=1.25 in]{geometry}
\usepackage[normalem]{ulem}
%\usepackage[T1]{fontenc}
%\usepackage{ae,aecompl}
\usepackage{tcolorbox}
\usepackage{tabu}
\usepackage{pifont}
\usepackage{multirow}
\usepackage[shortlabels]{enumitem}
\usepackage{bold-extra}
\usepackage{tabularx}


    \begin{forest}
      for tree={
        minimum height=0.8cm, % Adjust the height as needed
        minimum width=2.1cm,   % Adjust the width as needed
        where n children=0{
          wiggly,
          tier=terminus
        }{align=center},
      }
      [Agr 
        [T 
          [Asp 
            [Voice 
              [$v$ 
                [$\sqrt{\text{WRITE}}$ 
                  [\textgamma r{a}f] 
                ]  
                [$v$ 
                  [$\emptyset$]       
                ]     
              ]   
              [Voice\\{[}{\sc nonact}{]}, edge label = {node [midway]  }
                [$\emptyset$]   
              ]  
            ] 
            [Aspect\\{[}$-${\sc pfv}{]} 
               [$\emptyset$]  
            ] 
          ]  
          [T\\{[}$+${\sc pst}{]} 
             [$\emptyset$] 
          ]  
        ] 
        [{Agr\\{[}$+${\sc auth},$+${\sc part},{\sc -pl}{]}} 
          [omun] 
        ] 
      ] 
    \end{forest}

我正在尝试创建您在附图中看到的树的这一部分。如何将图片中显示的符号添加到边缘?此外,如何使边缘显示不同的颜色?

在此处输入图片描述

答案1

将您的示例修剪为仅需要的包,您可以定义一个边缘样式(此处称为xedge),它在边缘上添加井号标记并使其和其下方的其余节点变为灰色。

我已将其替换\sc\scshape(见双字母字体样式命令 (\bf,\it,...) 会在 LaTeX 中复活吗?)我还为你的wiggly风格添加了一个来源,它来自另一个答案在网站上。

对于以后的问题,请构建最小实际编译的示例,并给出适当的代码归属。

\documentclass{article}
\usepackage[linguistics]{forest}
\usetikzlibrary{decorations.pathmorphing}
\def\textgamma{$\gamma$}
\forestset{
grayed/.style={for tree={gray,edge=gray}},
xedge/.style={grayed,edge path={\noexpand\path[\forestoption{edge}](!u.parent anchor)-- node[sloped,rotate=90,text={black}] {=} (.child anchor)\forestoption{edge label};}},
% following style from https://tex.stackexchange.com/a/326392/
  /tikz/squiggly/.style={decorate, decoration={snake, amplitude=.5mm, segment length=2mm}},
  wiggly/.style={edge=squiggly},
  move me/.style n args=2{%
    before drawing tree={%
      x+=#1,
      y+=#2,
    },
  },
}

\begin{document}
\begin{forest}
      for tree={
        minimum height=0.8cm, % Adjust the height as needed
        minimum width=2.1cm,   % Adjust the width as needed
        where n children=0{
          wiggly,
          tier=terminus
        }{align=center},
      }
      [Agr 
        [T 
          [Asp 
            [Voice 
              [$v$ 
                [$\sqrt{\text{WRITE}}$ 
                  [\textgamma r{a}f] 
                ]  
                [$v$,xedge 
                  [$\emptyset$]       
                ]     
              ]   
              [Voice\\{[}{\scshape nonact}{]}, xedge 
                [$\emptyset$]   
              ]  
            ] 
            [Aspect\\{[}$-${\scshape pfv}{]} 
               [$\emptyset$]  
            ] 
          ]  
          [T\\{[}$+${\scshape pst}{]} 
             [$\emptyset$] 
          ]  
        ] 
        [{Agr\\{[}$+${\scshape auth},$+${\scshape part},$-${\scshape pl}{]}} 
          [omun] 
        ] 
      ]
\end{forest}
\end{document}

代码部分输出

相关内容