2

I am working on forest, and this is the part of the tree I have built so far:

\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}

I am trying to create this part of the tree you see in the attached picture. What is the way to add the symbols shown in the picture to the edges? Also, what is the way to make the edges appear in different colors?

enter image description here

Alan Munn
  • 218,180
AndyCh
  • 23
  • Welcome to TeX.se. Just showing us an image without any code isn't really very helpful. Please edit your question to show as small compilable example document that shows a small tree that you've partially annotated and we'll help you with the rest. – Alan Munn Jul 24 '23 at 13:18
  • Thank you. I have modified the question. Hopefully, it is clearer now. – AndyCh Jul 24 '23 at 15:29
  • 1
    @AndyCh The code helps a bit, but we'd like to be able to copy-paste-compile a complete document. Partly this just makes it easier to help because people don't have to add \documentclass{} etc. and partly it makes it possible to help because people don't have to know where to find wiggly, for example. (Is this in a TikZ library somewhere? One of the decorations ones? pathmorphing? pathreplacing? Or is it something you've defined and I can only guess?) – cfr Jul 24 '23 at 15:57
  • edge={blue, thick} for a thick, blue edge. See page 45 of forest's manual for examples. Do the symbols on the edges have a semantics you want reflected in the code? (To me, they mean parallel lines, but that's obviously not the case here.) Note that you really should not be using two-letter font macros such as \sc in LaTeX. – cfr Jul 24 '23 at 16:03
  • 1
    Does this code give you an error? It looks as if it should. – cfr Jul 24 '23 at 16:05
  • I have added document class and the rest.. Thank you – AndyCh Jul 25 '23 at 06:42
  • Please make your code a minimal working example (MWE). Note that the tabu package is quite outdated. Do you really need it? (But probably unrelated here.) You also load several packages multiple times. It is a good idea to clean up the preamble from time to time ... – Jasper Habicht Jul 25 '23 at 07:03

1 Answers1

4

Trimming your example to just the needed packages, you can define an edge style (here called xedge) that adds the hash mark on the edge and makes it and the rest of the nodes below it gray.

I've replaced \sc with \scshape (see Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX?) I've also added a source to your wiggly style, which is from another answer on the site.

For future questions, please construct minimal examples that actually compile, and give proper code attributions.

\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}

partial output of code

Alan Munn
  • 218,180