summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/langsci/langsci-tikz.sty
blob: 96bcd05211099770dd5e73189d378b17e97b4fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Experimental feature for pointing out moving things. %%%%
%%%% Buggy? Write to: kopeckyf@hu-berlin.de               %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetikzlibrary{arrows,arrows.meta}
\newcounter{lsConnectTempGroup}
\NewDocumentCommand\ConnectTail{m O{\thelsConnectTempGroup}}{%read: mandatory arg #1, optional argument #2 with the current group counter as its default value.
    \edef\lsConnectTempPosition{#2}%\edef expands the argument, which means reading the current value of the counter.
    {\tikz[remember picture,
           anchor=base, baseline,
           inner xsep=0pt, 
           inner ysep=-.5ex]\node (ConnectTempTail\lsConnectTempPosition) {\strut{}#1};}%\strut for baseline
}
\NewDocumentCommand\ConnectHead{s O{1ex} m O{\thelsConnectTempGroup}}{%read: star #1, optional argument (distance of arrow from text= std. one x-height), mand. arg. (node text), optional argument #2, the group specifier
    \edef\lsConnectTempPosition{#4}%
    \stepcounter{lsConnectTempGroup}%We have a match, let's update the group counter   
    {\tikz[remember picture,
           anchor=base, baseline, 
           inner xsep=0pt, 
           inner ysep=-.5ex] \node (ConnectTempHead\lsConnectTempPosition) {\strut{}#3};%
     \tikz[remember picture] \draw[% we have a tail and a head, let's bring them together
                                \IfBooleanTF#1{{Triangle[]}-}{-{Triangle[]}},% Check if the starred version is used. The starred version is right->left, the normal version left->right
                                overlay] (ConnectTempTail\lsConnectTempPosition.south) -- ++(0,-#2) -| (ConnectTempHead\lsConnectTempPosition.south);
    }%
}