Q:

Long-distance movement arrow in gloss

I have a question on drawing an arrow using gb4e. Currently, I am trying to use the method described in the link below. The problem takes place when I draw the long distance arrow like (5). As you can see the picture below, the line cross over the gloss. I would like to draw the horizontal line like the example (1). How can I evacuate the crossing?
Movement arrow in gloss
\documentclass[11pt, dvipdfmx]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1};}

% This code from http://tex.stackexchange.com/q/55068/2693
\tikzset{
    ncbar angle/.initial=90,
    ncbar/.style={
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    ncbar/.default=0.5cm,
}

% Thanks to Paul Gessler adn Percusse for code improvement here
\newcommand{\arrow}[2]{\begin{tikzpicture}[remember picture,overlay]
\draw[->,shorten >=3pt,shorten <=3pt] (#1.base) to [ncbar=\arrowht] (#2.base);
\end{tikzpicture}
\setlength{\arrowht}{0ex}
}
\usepackage{gb4e}
% The following code modified from 
% http://permalink.gmane.org/gmane.comp.tex.linguistics/1036
% This adds some extra space after the first line
\newlength{\arrowht}
\setlength{\arrowht}{0ex}
\newcommand*\cgdepthstrut{{\vrule height 0pt depth \arrowht width 0pt}}
\renewcommand\eachwordone{\cgdepthstrut\rmfamily}
\renewcommand\glt{\vskip -\topsep}
\let\trans=\glt
\newcommand\arrowex{\setlength{\arrowht}{2.5ex}\ex}

\begin{document}
\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \arrowex 
        \gll 
        \ldots dat Jan \tikzmark{een} auto gisteren \tikzmark{t}  gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
        \ldots that John a car yesterday.
        \arrow{t}{een}
\end{xlist}
\end{exe}

\begin{exe}
\ex\label{scramble-dets}
\begin{xlist}
        \ex 
        \gll 
        \ldots dat Jan een auto gisteren t gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
        \ldots that John a car yesterday.
\end{xlist}
\end{exe}

\begin{exe}
\ex[]{
    \gll
    John-wa totetumonaiukurai baka-da.    \\
    John-Top very stupid-cop \\
    `John is very studip.'    
}

\ex[]{
    \gll
    John-wa totetumonaiukurai dousiyoumonai tondemonai sukuigatai baka-da.    \\
    John-Top very very very very stupid-cop \\
    `John is very studip.'    
}

\arrowex[]{
    \gll
    \tikzmark{John}-wa totetumonaiukurai dousiyoumonai tondemonai sukuigatai  \tikzmark{t} baka-da.    \\
    John-Top very very very very stupid-cop \\
    `John is very stupid.'    
    \arrow{t}{John}
}

\end{exe}

\end{document}

A:

There's no way to do this completely automatically, i.e., break up the arrow whenever the gloss line wraps. But it's possible to define two other arrow styles to draw the arrows separately.
I've made two new styles of arrow, lbar and rbar which have the extra segment on either the left or the right of the main connection line.
Then I've modified the \arrow command to take an optional argument [l] or [r] to specify a right or left partial arrow. When no optional argument is specified, the \arrow command works as before.
Then to make partial arrows you just need to mark the relevant parts you want connected. (Note that to have the words in your gloss line up correctly you need an empty group in the gloss line for the trace.)
Here's a full example:
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1};}

% This code adapted from http://tex.stackexchange.com/q/55068/2693
% Two new styles added, one with a bar on the right, one with a bar on the left
\tikzset{
    ncbar angle/.initial=90,
    ncbar/.style={% |_____| shape
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    rbar/.style={% _____| shape
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
    },
    lbar/.style={% |_____ shape
        to path=
          ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$) 
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    ncbar/.default=0.5cm,
}

% Thanks to Paul Gessler and Percusse for code improvement here
\newcommand{\arrow}[3][nc]{%
\setlength{\arrowht}{2.5ex}
\def\rightanchor{base}\let\leftanchor\rightanchor
\if#1r\def\rightanchor{base}\def\leftanchor{base west}\fi
\if#1l\def\rightanchor{base east}\def\leftanchor{base}\fi
\begin{tikzpicture}[remember picture,overlay]
\draw[->,shorten >=3pt,shorten <=3pt] (#2.\rightanchor) to [#1bar=\arrowht] (#3.\leftanchor);
\end{tikzpicture}
\setlength{\arrowht}{0ex}
}
\usepackage{gb4e}
% The following code modified from 
% http://permalink.gmane.org/gmane.comp.tex.linguistics/1036
% This adds some extra space after the first line
\newlength{\arrowht}
\setlength{\arrowht}{0ex}
\newcommand*\cgdepthstrut{{\vrule height 0pt depth \arrowht width 0pt}}
\renewcommand\eachwordone{\cgdepthstrut\rmfamily}
\renewcommand\glt{\vskip -\topsep}
\let\trans=\glt
\newcommand\arrowex{\setlength{\arrowht}{2.5ex}\ex}

\begin{document}
\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \arrowex 
        \gll 
        \ldots dat Jan \tikzmark{een} auto gisteren \tikzmark{t}  gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
        \ldots that John a car yesterday.
        \arrow{t}{een}
\end{xlist}
\end{exe}

\begin{exe}
\arrowex{
    \gll
    \tikzmark{John}-wa totetumonaiukurai dousiyoumonai \tikzmark{tondemonai} \tikzmark{sukuigatai}  \tikzmark{t} baka-da.    \\
     John-Top very very very very {} stupid-cop \\
     \arrow[l]{tondemonai}{John}
     \arrow[r]{t}{sukuigatai}
    \glt `John is very stupid.'   
}

\end{exe}

\end{document}

