5

I need to do this:

enter image description here

Apologies for the non-digital reference. :)

My attempt with pst-asr is the following. I can't figure out what it wrong with it. Can someone help?

% !TEX TS-program = latex
\documentclass[12pt]{article}
\usepackage{pst-node,pst-asr,graphicx}
\newpsstyle{bigsyls}{extragap=.6ex,unitxgap=true,xgap=3.5ex,ts=0p ($\times$),sy=5.5ex ($\sigma$) .7ex,ph=-4.5ex (pf)}
\newpsstyle{dashed}{linestyle=dashed,dash=3pt 2pt}
\newpsstyle{crossing}{xed=true,xedtype=\xedcirc,style=dashed}
\newpsstyle{dotted}{linestyle=dotted,linewidth=1.2pt,dotsep=1.6pt}
\def\feat#1{$\rm [#1]$}
\def\crossing{\pscircle[linestyle=solid,linewidth=.5pt](0,0){.7ex}}%
\newdimen\dimpuba
\newdimen\dimpubb
\def\TO{\quad$\rightarrow$\quad}
\tiershortcuts

\begin{document}

\newtier{dorsal, high, back, low}
\psset{xgap=1.5in, yunit=3em, ts=0 (Pg), sy=1 ((),
 dorsal=-1 (Dg), high=-2 ([), back=-2.6 ([),
 low=-3.2 ([), sysym=\feat{-cons}, tssym=Place}
\DefList{\dorsalA{0}, \dorsalB{1}, \highoffsetA{-.3}, \highoffsetB{.8},%
\lowoffsetA{0}, \lowoffsetB{1}, \backoffsetA{.3}, \backoffsetB{1.3} }

\asr \X \X |
 \@(\dorsalA,dorsal){Dorsal}
    \-(0,ts)
 \@(\dorsalB,dorsal){Dorsal}
    \-(1,ts)
 \@[\highoffsetA](\dorsalA,high){\feat{$\alpha$high}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
 \@[\lowoffsetA](\dorsalA,low){\feat{$\beta$low}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
 \@[\backoffsetA](\dorsalA,back){\feat{$\gamma$back}}
    \-(\dorsalA, dorsal)    
    \-[style=dotted](\dorsalB, dorsal)
 \@[\highoffsetB](\dorsalB,high){\feat{-$\alpha$high}}
    \-(\dorsalB,dorsal)
    \-[style=dotted](\dorsalA,dorsal)
 \@[\lowoffsetB](\dorsalB,low){\feat{-$\beta$low}}
    \-(\dorsalB, dorsal)
    \-[style=dotted](\dorsalA,dorsal)
 \@[\backoffsetB](\dorsalB,back){\feat{-$\gamma$back}}
    \-(\dorsalB, dorsal)    
    \-[xed=true](\dorsalB,dorsal)
 \endasr

 \end{document}
RobertP.
  • 741
  • Remember that pst-asr requires compilation with latex+dvips not pdflatex but your first line is telling it to use the latter. – Alan Munn Nov 01 '16 at 21:18
  • Oh - can you remind me the right code to do that? – RobertP. Nov 01 '16 at 21:38
  • 1
    Change % !TEX TS-program = pdflatex to % !TEX TS-program = latex. – Alan Munn Nov 01 '16 at 21:46
  • ok, great. I changed the code above. The problem is still there, unfortunately. – RobertP. Nov 01 '16 at 21:58
  • 1
    One problem is the definition of \feat. \feat{$\alpha$high} expands to $\rm [$\alpha$high]$, where \alpha is typeset outside of math mode. This results in the message Missing $ inserted. Define \feat simply as \def\feat#1{[#1]}, or better as \newcommand\feat[1]{[#1]}. Then LaTeX can process a few lines more, but then another error occurs. – gernot Nov 02 '16 at 00:26
  • @gernot Actually in this case it's probably better to remove the $ from inside the argument. This ensures that the - and + (which will also typically be present) are set in math mode. Of course you could also do \feat{$-$voice} as well, but for input simplicity it makes sense in this case to leave math mode in the macro definition. – Alan Munn Nov 02 '16 at 00:44

3 Answers3

7

First off, pst-asr documents require latex+dvips for compilation, and cannot be processed with pdflatex. The line:

 % !TEX TS-program = pdflatex 

needs to be changed to

% !TEX TS-program = latex. 

Second, the definition of \feat wraps the content in math mode, which means you can't embed math code inside it, so as a result:

\feat{-$\alpha$high}  

fails. Unfortunately the error, Missing $ inserted is ironically very unhelpful, since the problem is (from your perspective) in fact extra $ signs, not missing ones. Of course the error does in fact make sense, as Gernot remarks in the comment, since \feat{-$\alpha$high} expands to $\rm -$\alpha$high$ yielding two math mode expressions with an \alpha in the middle, and as a result the \alpha ends up not being in math mode at all, hence the missing $ error.

So instead of the line above you need simply:

\feat{-\alpha high}  

Finally, for reasons I don't really understand (because I never use the package) pst-asr seems to be very sensitive to spaces within its commands. For example:

  \-(\dorsalA, dorsal)

fails, while

 \-(\dorsalA,dorsal)

works. Removing these extra spaces, the document now compiles. The output isn't quite like your picture, but I assume you can figure out how to fix that yourself now that you have working code.

% !TEX TS-program = latex
\documentclass[12pt]{article}
\usepackage{pst-node,pst-asr,graphicx}
\newpsstyle{bigsyls}{extragap=.6ex,unitxgap=true,xgap=3.5ex,ts=0p ($\times$),sy=5.5ex ($\sigma$) .7ex,ph=-4.5ex (pf)}
\newpsstyle{dashed}{linestyle=dashed,dash=3pt 2pt}
\newpsstyle{crossing}{xed=true,xedtype=\xedcirc,style=dashed}
\newpsstyle{dotted}{linestyle=dotted,linewidth=1.2pt,dotsep=1.6pt}
\def\feat#1{$\rm [#1]$} % 
% Since this macro is already in mathmode you don't need $...$ inside its arguments
% i.e., instead of \feat{$\alpha$ voice} use \feat{\alpha voice}

\def\crossing{\pscircle[linestyle=solid,linewidth=.5pt](0,0){.7ex}}%
\newdimen\dimpuba
\newdimen\dimpubb
\def\TO{\quad$\rightarrow$\quad}
\tiershortcuts

\begin{document}

\newtier{dorsal, high, back, low}
\psset{xgap=1.5in, yunit=3em, ts=0 (Pg), sy=1 ((),
 dorsal=-1 (Dg), high=-2 ([), back=-2.6 ([),
 low=-3.2 ([), sysym=\feat{-cons}, tssym=Place}
\DefList{\dorsalA{0}, \dorsalB{1}, \highoffsetA{-.3}, \highoffsetB{.8},%
\lowoffsetA{0}, \lowoffsetB{1}, \backoffsetA{.3}, \backoffsetB{1.3} }

\asr \X \X |
 \@(\dorsalA,dorsal){Dorsal}
    \-(0,ts)
 \@(\dorsalB,dorsal){Dorsal}
    \-(1,ts)
 \@[\highoffsetA](\dorsalA,high){\feat{\alpha high}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
 \@[\lowoffsetA](\dorsalA,low){\feat{\beta low}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
 \@[\backoffsetA](\dorsalA,back){\feat{\gamma back}}
    \-(\dorsalA,dorsal) 
    \-[style=dotted](\dorsalB,dorsal)
 \@[\highoffsetB](\dorsalB,high){\feat{-\alpha high}}
    \-(\dorsalB,dorsal)
    \-[style=dotted](\dorsalA,dorsal)
 \@[\lowoffsetB](\dorsalB,low){\feat{-\beta low}}
    \-(\dorsalB,dorsal)
    \-[style=dotted](\dorsalA,dorsal)
 \@[\backoffsetB](\dorsalB,back){\feat{-\gamma back}}
    \-(\dorsalB,dorsal)    
    \-[xed=true](\dorsalB,dorsal)
 \endasr

 \end{document}

output of code

Alan Munn
  • 218,180
  • It would be better to use \newcommand* than \def, though, wouldn't it? – cfr Nov 02 '16 at 01:26
  • @cfr Yes, but the commands are being taken verbatim from the pst-asr docs, since John Frampton, the author is a plain TeX user. So in the general case yes, but in this case, it's probably safer (in the short run) to keep the macros as they are. Do we have a question about converting plain TeX macros to LaTeX macros I could link to? – Alan Munn Nov 02 '16 at 01:29
  • I was really following up your comment on the question which seemed to address gernot's maths point but not the TeX -> LaTeX point. I don't know if we have a question about conversion. I don't remember one, but it seems as if there should be one somewhere ...? – cfr Nov 02 '16 at 01:32
  • @cfr Yes, I understand, but I'm a bit afraid to imply what might appear (to a beginner) to be a 'general rule' for conversion, since no such rule can actually exist, especially given the existence of delimited macros in TeX. – Alan Munn Nov 02 '16 at 01:36
  • What a stupid mistake! Thank you, @AlanMunn, for your help! – RobertP. Nov 02 '16 at 01:42
5

Here is a solution for creating autosegmental diagrams using the great forest package.

There are two styles in the \forestset block: the asr style makes edges leave from the parent’s south anchor and also sets the tree packing dimensions, and strike adds a double strike-through () to an edge.

I created a phantom (invisible) root node (R) whose children are the two [–cons] nodes, to simulate two separate trees. I then drew the main nodes of each tree and used the strike style on the relevant edges. To create the “multi-dominance” effect, I manually drew dashed lines from the other parent’s south nodes to the named leaves.

%!TEX TS-program = xelatex
\documentclass{article}

\usepackage{forest}

\begin{document}
\forestset{
asr/.style={
  for tree={
    align=center,
    parent anchor=south,
%   child anchor=north,
    s sep=4mm,
    l sep=6mm
  }
},
strike/.style={
  edge label={
    node[midway, sloped, rotate=90] {=}
  }
}
}

\begin{forest}asr
[R,phantom
  [{[–cons]}
    [Place
      [Dorsal
        [{[α high]},strike]
        [{[β low]},strike]
        [{[γ back]},name=g1]
      ]
        { \draw[dashed] (.south) -- (a2); }
        { \draw[dashed] (.south) -- (b2); }
    ]
  ]
  [{[–cons]}
    [Place
      [Dorsal
        [{[α high]},name=a2]
        [{[β low]},name=b2]
        [{[γ back]},strike]
      ]
        { \draw[dashed] (.south) -- (g1); }
    ]
  ]
]
\end{forest}

\end{document}

hftf
  • 2,283
2

Run the document with xelatex (can be choosed from the menu):

\documentclass[12pt]{article}
\usepackage{pst-node,pst-asr,graphicx}
\newpsstyle{bigsyls}{extragap=.6ex,unitxgap=true,xgap=3.5ex,
            ts=0p ($\times$),sy=5.5ex ($\sigma$) .7ex,ph=-4.5ex (pf)}
\newpsstyle{dashed}{linestyle=dashed,dash=3pt 2pt}
\newpsstyle{crossing}{xed=true,xedtype=\xedcirc,style=dashed}
\newpsstyle{dotted}{linestyle=dotted,linewidth=1.2pt,dotsep=1.6pt}
\def\feat#1{\rm [#1]}
\def\crossing{\pscircle[linestyle=solid,linewidth=.5pt](0,0){.7ex}}%
\newdimen\dimpuba
\newdimen\dimpubb
\def\TO{\quad$\rightarrow$\quad}
\tiershortcuts

\begin{document}

\newtier{dorsal, high, back, low}
\psset{xgap=1.5in, yunit=3em, ts=0 (Pg), sy=1 ((),
        dorsal=-1 (Dg), high=-2 ([), back=-2.6 ([),
        low=-3.2 ([), sysym=\feat{-cons}, tssym=Place}
\DefList{\dorsalA{0}, \dorsalB{1}, \highoffsetA{-.3}, \highoffsetB{.8},%
        \lowoffsetA{0}, \lowoffsetB{1}, \backoffsetA{.3}, \backoffsetB{1.3} }

\asr \X \X |
  \@(\dorsalA,dorsal){Dorsal}
    \-(0,ts)
  \@(\dorsalB,dorsal){Dorsal}
    \-(1,ts)
  \@[\highoffsetA](\dorsalA,high){\feat{$\alpha$high}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
  \@[\lowoffsetA](\dorsalA,low){\feat{$\beta$low}}
    \-(\dorsalA,dorsal)
    \-[xed=true](\dorsalA,dorsal)
  \@[\backoffsetA](\dorsalA,back){\feat{$\gamma$back}}
    \-(\dorsalA,dorsal)    
    \-[style=dotted](\dorsalB,dorsal)
  \@[\highoffsetB](\dorsalB,high){\feat{-$\alpha$high}}
    \-(\dorsalB,dorsal)
    \-[style=dotted](\dorsalA,dorsal)
  \@[\lowoffsetB](\dorsalB,low){\feat{-$\beta$low}}
    \-(\dorsalB,dorsal)
    \-[style=dotted](\dorsalA,dorsal)
  \@[\backoffsetB](\dorsalB,back){\feat{-$\gamma$back}}
    \-(\dorsalB,dorsal)    
    \-[xed=true](\dorsalB,dorsal)
\endasr

\end{document}

enter image description here

  • 1
    What exactly is the point of this answer, other than to show that some pstricks code will run with xelatex too? Why not just add a comment to my answer? – Alan Munn Nov 02 '16 at 11:33