2

In reference to this question:

Movement arrows in gloss (part II)

I have two problems:

  1. My backward arrow ist too far down (cf. example 1).
  2. Up to now, my glosses go down (cf. "[VF" in example 1).

and therefore I have one and a half questions:

  1. How can I change the backward arrow to be beneath the text (so that both arrows are equal)?
  2. Does the changes for question 1. solve my problem 2.?

Thank you for your attention.

    \documentclass[11pt]{article}
    \usepackage{tikz}
    \usetikzlibrary{calc}
    \usepackage{gb4e}           

    \newlength{\arrowht}
    \setlength{\arrowht}{-2.5ex}
    \newcommand*\exdepthstrut{{\vrule height 0pt depth -\arrowht width 0pt}}
    \newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1\exdepthstrut};}

    % This code from https://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 and 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}
    }

    \begin{document}
    \begin{exe}
        \ex Example 1
            \gll ~\tikzmark{lachend} ~sagte sie \tikzmark{t} das\\
                [VF ][LSK][ MF {} {} ]\\
                \arrow{t}{lachend}  
                \ex Example 2
            \gll  und ~hob sie t ~~auf schrecklich weinend\\
                {}  [LSK][ MF \tikzmark{t} ][RSK][ \tikzmark{NF} {} ]\\
                \arrow{t}{NF}   
    \end{exe}
              \end{document} 

enter image description here

K.B.
  • 33

1 Answers1

2

Edit: after while I figured out that source of problem is definition of \exdepthstrut. With change of height and depth, as well to accordingly change anchors of arrows I obtain the following result:

enter image description here

Corrected MWE is:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{gb4e}

\newlength{\arrowht}
\setlength{\arrowht}{-2.5ex}% <-- changed
\newcommand*\exdepthstrut{{\vrule height 0.75\arrowht depth -0.25\arrowht width 0pt}}% <-- changed
\newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1\exdepthstrut};}
% 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=\arrowht,% <-- changed
}
% Thanks to Paul Gessler and Percusse for code improvement here
\newcommand{\arrow}[2]{\begin{tikzpicture}[remember picture,overlay]
\draw[->,shorten >=1ex,shorten <=1ex] ([yshift=1.25ex] #1.south) to [ncbar] ([yshift=1.25ex] #2.south);% <-- changed
\end{tikzpicture}
}

\begin{document}
\begin{exe}
    \ex Example 1
        \gll ~\tikzmark{lachend} ~sagte sie \tikzmark{t} das\\
            ~[VF ][LSK][ MF {} {} ]\\
            \arrow{t}{lachend}
            \ex Example 2
        \gll  und ~hob sie t ~~auf schrecklich weinend\\
            {}  [LSK][ MF \tikzmark{t} ][RSK][ \tikzmark{NF} {} ]\\
            \arrow{t}{NF}
\end{exe}
\end{document}
Zarko
  • 296,517
  • Thanks, this solves my first problem. The second remains: the glosses go down. Is it possible to deactivate this function? – K.B. Feb 20 '17 at 16:39
  • @K.B., see edit of my answer, hopefully now is what you after – Zarko Feb 20 '17 at 17:57