光泽的长距离移动箭头

光泽的长距离移动箭头

我有一个关于使用 gb4e 绘制箭头的问题。目前,我正在尝试使用下面链接中描述的方法。当我绘制长距离箭头(如 (5))时,会出现问题。如下图所示,该线与光泽交叉。我想绘制水平线,如示例 (1)。我该如何消除交叉点?

光泽的运动箭头

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

代码的结果

答案1

没有办法完全自动地完成此操作,即每当光泽线换行时就断开箭头。但可以定义另外两种箭头样式来单独绘制箭头。

我制作了两种新样式的箭头,lbar它们rbar在主连接线的左侧或右侧都有额外的段。

然后我修改了该\arrow命令以接受可选参数[l][r]指定右或左部分箭头。当未指定可选参数时,该\arrow命令的工作方式与以前相同。

然后,要制作部分箭头,您只需标记要连接的相关部分。(请注意,要使光泽线中的单词正确排列,您需要在光泽线中留出一个空组来进行描摹。)

这是一个完整的例子:

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

代码输出

相关内容