summaryrefslogtreecommitdiff
path: root/macros/xetex/latex/langsci/langsci-tikz.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/xetex/latex/langsci/langsci-tikz.sty
Initial commit
Diffstat (limited to 'macros/xetex/latex/langsci/langsci-tikz.sty')
-rw-r--r--macros/xetex/latex/langsci/langsci-tikz.sty25
1 files changed, 25 insertions, 0 deletions
diff --git a/macros/xetex/latex/langsci/langsci-tikz.sty b/macros/xetex/latex/langsci/langsci-tikz.sty
new file mode 100644
index 0000000000..96bcd05211
--- /dev/null
+++ b/macros/xetex/latex/langsci/langsci-tikz.sty
@@ -0,0 +1,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);
+ }%
+} \ No newline at end of file