# How to use pstricks with expex to draw arrows in examples?

I'm using the expex package to write examples (in linguistics articles). This package, according to the documentation, allows one to draw arrows (to represent movement in syntax). There is a section about pstricks to do this p. 74 of the documentation on the expex package.

Here is a minimal working example (copied and pasted from the expex documention) that I cannot get to compile and I don't understand why.

\documentclass{article}

\usepackage{pstricks} % Apparently this is required to draw arrow with Expex (see p.74 of Expec doc)
\usepackage{expex}  % package for glosses
\lingset{everygla=,aboveglftskip=0pt,*=?*, textoffset=!-.6em, everyglb=\footnotesize, everyglft=\slshape} % changes style of glosses

\begin{document}

\ex
This is a "control item", showing that the problem really comes from adding the stuff to draw arrows.
\xe

\ex
%\pss{angle=-90,nodesep=0pt,arrows=->,dima=.2em,labelsep=.25ex,linearc=.7ex}
\def\\#1(#2){\rnode{#2}{\strut #1}} %
%
\vrule height0pt depth5.3ex width0pt
\\Whom(A) did John persuade \\t(B) [ PRO to visit \\whom(C) ]
\ncbar[armA=3.5ex,offsetB=\lingdima]{B}{A}
\bput{0}{$M_{sp}=2$}
\ncbar[armA=4.5ex,offsetB=-\lingdima]{C}{A}
\bput{0}(1.2){$M_{sp}=6$}
\xe

\end{document}


The result should look like this. (This snapshot is taken from the expex documentation p 74.)

• Welcome to TeX.SX! If I add \usepackage{pst-node} to the file, then it compiles, but it does not produce the desired result. Mar 3 '15 at 3:48

If using TikZ is an option, this can be easily done:

The code:

\documentclass{article}
\usepackage{expex}
\usepackage{tikz}
\usepackage{xparse}

\lingset{everygla=,aboveglftskip=0pt,*=?*, textoffset=!-.6em, everyglb=\footnotesize, everyglft=\slshape}

\newcommand\Tikzmark[2]{%
\tikz[remember picture]\node[inner sep=0pt,outer sep=0pt] (#1) {#2};%
}

\NewDocumentCommand\DrawArrow{O{}mmmmO{3}}{
\tikz[remember picture,overlay]
\draw[->,rounded corners,line width=0.8pt,shorten >= 2pt,shorten <= 2pt,#1]
(#2) -- ++(0,-#6\ht\strutbox) coordinate (aux) -- node[#4] {#5} (#3|-aux) -- (#3);
}

\begin{document}

\ex
W\Tikzmark{enda}{h}\Tikzmark{endb}{o}m(A) did John persuade \Tikzmark{starta}{t}(B) [ PRO to visit w\Tikzmark{startb}{h}om(C) ]
\xe
\DrawArrow{starta}{enda}{above}{$M_{sp}=2$}
\DrawArrow{startb}{endb}{above,pos=0.15}{$M_{sp}=6$}[3.5]

\end{document}


You use \Tikzmark to place some marks and then \DrawArrow to draw the arrow between the marks.

The \DrawArrow command has syntax

\DrawArrow[<tikz options>]{<start-mark>}{<end-mark>}{<options for the node>}{<label>}[<vertical shift>]