7

This is what I want to achieve

Linking from the 'mu's to 'a'

and this:

Linking from 'O' to 'l'

But all I've been able to make with tikz-qtree is the following:

\documentclass[12pt,a4]{article}
\usepackage[utf8]{inputenc}
\usepackage{tipa,tikz,tikz-qtree}
\begin{document}

\begin{tikzpicture} [baseline]
\tikzset{frontier/.style={distance from root=90pt}}
\Tree
[.$\sigma$ [.O [ p ] ]
[.R [.$\mu$ a ] [.$\mu$ : ] ] ]
\end{tikzpicture}
\begin{tikzpicture} [baseline]
\tikzset{frontier/.style={distance from root=90pt}}
\Tree
[.$\sigma$ [.O [ p ] ]
[.R [.$\mu$ a ]  ] ]
\end{tikzpicture}

And this:

\begin{tikzpicture}[baseline]
\tikzset{frontier/.style={distance from root=90pt}}
\Tree
[.$\sigma$ [.O [ l ] ]
[.R [.$\mu$ a ] [.$\mu$ l ] ] ]
\end{tikzpicture}
\begin{tikzpicture} [baseline]
\tikzset{frontier/.style={distance from root=90pt}}
\Tree
[.$\sigma$ [.O [ : ] ]
[.R [.$\mu$ a ] [ l ] ] ]
\end{tikzpicture}
\end{document}

Which renders:

enter image description here

and

enter image description here

The important part here is the linking from the leaves to more than one parent (it would be nice if I had the option of making the line dashed too). Now, pst-asr doesn't quite achieve what I want it to. It's important that I have the moras ('mu's). (Also it's a pstricks package, which means I must typeset it in DVIPSPDF.) I have tried a bit of the forest-package (especially forest-GP1), but I can't make that work as I want either. Lastly, some have recommended xyling, but I find that package very difficult to use.

Any recommendations?

Thanks.

3 Answers 3

7

Actually, you were definitely on the right track: some minor additions to your code work nicely. This builds on the fact that tikz-qtree.sty can use \nodes, which can be named and the names used as coordinates for \drawing. The second example is a little more complex in that a line is drawn between two trees, requiring \begin{scope}...\end{scope} for the two trees so that they can appear next to each other. You can adjust the position of the second tree by changing the xshift amount.

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}

\begin{tikzpicture} [baseline]
\begin{scope}
\Tree
[.$\sigma$ [.O [ p ] ]
[.R [.$\mu$ \node[red](a){a}; ] \node(m){$\mu$}; ] ]
\draw (m.south) -- (a.north);
\end{scope}
\begin{scope}[xshift=0.65in]
\tikzset{frontier/.style={distance from root=90pt}}
\Tree
[.$\sigma$ [.O [ p ] ]
[.R [.$\mu$ a ]  ] ]
\end{scope}
\end{tikzpicture}

\begin{tikzpicture}[baseline]
\begin{scope}
\Tree
[.$\sigma$ [.O [ l ] ]
[.R [.$\mu$ a ] [.$\mu$ \node(l){l}; ] ] ]
\end{scope}
\begin{scope}[xshift=0.75in]
\Tree
[.$\sigma$ [.\node(O){O};  ]
[.R [.$\mu$ a ] [ l ] ] ]
\draw[dashed] (O.south) -- (l.north);
\end{scope}
\end{tikzpicture}

\end{document}

Which yields this:

Up-to-date output.

4
  • I failed to notice the request for dashed lines using the \draw command allows a good deal of flexibility. I also added a touch of color to one of the \nodes, again as a demonstration of what can be done.
    – sgmoye
    Apr 24, 2015 at 16:43
  • Rather than use overlay and remember picture it's probably a bit simpler to use TiKZ's scope mechanism to place the trees side by side.
    – Alan Munn
    Apr 24, 2015 at 18:00
  • @Alan Munn -- You're quite right, of course. I had originally wanted to keep the OP's code as intact as possible. I have made the change and the result is definitely cleaner. Thanks.
    – sgmoye
    Apr 24, 2015 at 20:25
  • You need to adapt your explanation too. :)
    – Alan Munn
    Apr 24, 2015 at 20:44
8

This is a lot easier to do with forest. You can use the phantom option to put trees side by side, and since each syllable is a daughter of the phantom node, you can name nodes for the multi-domainance branches. Since these lines are drawn with regular TikZ commands, you need to make the relevant daughter phantom too. You can add any decorations to the line (e.g. [dashed]) with regular TiKZ options. Here are your two examples worked out.

First I've set a style called syll which makes the node connections tight as we are used to seeing in linguistics. Furthermore, because we want segments to line up with each other and branches to extend to the segmental layer, I've assigned all daughterless nodes to the seg tier. I've also created a couple of macros for syllables and moras.

\documentclass{article}
\usepackage{forest}
\newcommand{\syl}{$\sigma$}
\newcommand{\mor}{$\mu$}
\forestset{syll/.style=
   {for tree={parent anchor=south,child anchor=north,
              align=center,inner sep=0pt,
              where n children=0{tier=seg}{}}}}
\begin{document}
\begin{forest}syll
[,phantom, s sep=1em
[\syl [O [p,tier=seg ]]
      [R [\mor [a,name=aa] ] [\mor,name=M [,phantom] ]]]
[\syl [O [p,tier=seg ]]
      [R [\mor [a] ]]]
]
\draw (M.south) -- (aa.north);
\end{forest}

\begin{forest}syll
[,phantom, s sep=1em
[\syl [O [l ]]
      [R [\mor [a]] [\mor [l,name=LL]]]]
[\syl [O,name=O [,phantom] ]
      [R [\mor [a] [l]]]]
]
\draw[dashed] (O.south) -- (LL.north);
\end{forest}


\end{document}

output of code

6

You can achieve what you want in pst-asr, and if you use XeTeX you go fine (which is anyway recommended for linguistics). I'm not In front of my computer now, so code and output later!

EDIT

Here is the code.

\documentclass{article}

\usepackage{pst-asr}
    \psset{everyasr=\tiershortcuts}
    \newpsstyle{dashed}{linestyle=dashed,dash=3pt 2pt}

\begin{document}

\newtier{con}
\psset{con=7ex (O)}
\newtier{sig}
\psset{sig=13ex (O)}
\asr[reptype=nots, sy=2ex ($\mu$)] |
    \@(0,ph){p}
    \@(1,ph){a}
    \@(3,ph){p}
    \@(4,ph){a}
    \@(1,sy){$\mu$}\-(1,ph)
    \@(2,sy){$\mu$}\-(1,ph)
    \@(4,sy){$\mu$}\-(4,ph)
    \@(0,con){O}\-(0,ph)
    \@(1,con){R}\-(1,sy)\-(2,sy)
    \@(3,con){O}\-(3,ph)
    \@(4,con){R}\-(4,sy)
    \@(.5,sig){$\sigma$}\-(0,con)\-(1,con)
    \@(3.5,sig){$\sigma$}\-(3,con)\-(4,con)
\endasr

\bigskip

\asr[reptype=nots, sy=2ex ($\mu$)] |
    \@(0,ph){l}
    \@(1,ph){a}
    \@(2,ph){l}
    \@(4,ph){a}
    \@(5,ph){l}
    \@(1,sy){$\mu$}\-(1,ph)
    \@(2,sy){$\mu$}\-(2,ph)
    \@(4,sy){$\mu$}\-(4,ph)
    \@(0,con){O}\-(0,ph)
    \@(1,con){R}\-(1,sy)\-(2,sy)
    \@(3,con){O}\-[style=dashed](2,ph)
    \@(4,con){R}\-(4,sy)\-(5,ph)
    \@(.5,sig){$\sigma$}\-(0,con)\-(1,con)
    \@(3.5,sig){$\sigma$}\-(3,con)\-(4,con)
\endasr

\end{document}

And the output.

output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.