2

I am trying to get tikz to draw a line between nodes inside an attribute-value matrix defined using the avm package. For this, I am using \tikzmark as described in the answer here: tree-dvips Alternative for Linguistics Document with pdftex

Curiously, this does not work for the AVM below. For whatever reason, the line is drawn two pages above its definition. As should be obvious from the MWE, I'd like to connect the whole SUBJ AVM to the word 'apna'. Anyone have an idea?

EDIT#1: I have slightly changed the MWE and removed unnecessary packages. What's strange is that if I compile the code in a separate file, it draws the line in the right place, but within the larger document the line appears two pages above its definition. What could be causing such behavior?

EDIT#2: @JohnKormylo Thanks! The line is drawn perfectly fine now that I define it inside the figure. No idea why a) this would make any difference in the first place, and b) why I would not have to pay attention to this if I place the code in a separate document.

EDIT#3: A (minor) follow-up question: How do I get the line to connect at type height? In the example above, it is the case that the line connects to the bottom right of the word 'apna', not at the center right.

\documentclass{scrartcl}
\usepackage{avm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning}
\usepackage{tikz-qtree}

\begin{document}

\begin{figure}[h!]
\centering
\begin{avm}
\[ PRED & `gari$<$($\uparrow$~SUBJ)$>$'\\
SUBJ & \[ PRED & `nina'\\
CASE & gen\\
GEND & fem\\
PERS & 3\\
NUM & sg\\
CHECK & \[
NMORPH & obl\\
\]
\]\tikzmark{ante3}\\
ADJUNCT & \{ \[ PRED & `apna'\tikzmark{ana3}\\
GEND & fem\\
NUM & sg\\
CHECK & \[
NMORPH & nom\\
\]\\
ATYPE & reflexive\\
\]
\}\\
CASE & nom\\
GEND & fem\\
PERS & 3\\
NUM & sg\\
NTYPE & common\\
CHECK & \[
NMORPH & nom\\
\]
\]
\end{avm}
\caption{NP f-structure, common noun head, reflexive binding}
\label{fs-poss-bind-ex-3}
\end{figure}

\tikz[remember picture,overlay] 
    \draw[-] (pic cs:ante3) to[out=0,in=0,looseness=2]  (pic cs:ana3);

\end{document}
  • Have you tried compiling your code twice? – Pier Paolo Jan 10 '15 at 16:59
  • Yes, I have. It seems that this is necessary for all things drawn by tikz, correct? – Sebastian Sulger Jan 10 '15 at 17:04
  • 3
    Can you put the second \tikz inside the figure as well, or is that the point? – John Kormylo Jan 11 '15 at 0:49
  • 1
    @JohnKormylo You have found the solution! – Paul Gaborit Jan 11 '15 at 1:34
  • 1
    oops, ([shift={(0pt,0.5ex)}]pic cs:ana3) – John Kormylo Jan 11 '15 at 20:34
2

As requested:

\documentclass{scrartcl}
\usepackage{avm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning}
\usepackage{tikz-qtree}

\begin{document}

\begin{figure}[h!]
\centering
\begin{avm}
\[ PRED & `gari$<$($\uparrow$~SUBJ)$>$'\\
SUBJ & \[ PRED & `nina'\\
CASE & gen\\
GEND & fem\\
PERS & 3\\
NUM & sg\\
CHECK & \[
NMORPH & obl\\
\]
\]\tikzmark{ante3}\\
ADJUNCT & \{ \[ PRED & `apna'\tikzmark{ana3}\\
GEND & fem\\
NUM & sg\\
CHECK & \[
NMORPH & nom\\
\]\\
ATYPE & reflexive\\
\]
\}\\
CASE & nom\\
GEND & fem\\
PERS & 3\\
NUM & sg\\
NTYPE & common\\
CHECK & \[
NMORPH & nom\\
\]
\]
\end{avm}
\caption{NP f-structure, common noun head, reflexive binding}
\label{fs-poss-bind-ex-3}
%
\tikz[remember picture,overlay] 
    \draw[-] (pic cs:ante3) to[out=0,in=0,looseness=2]  (pic cs:ana3);
\end{figure}

\end{document}

table

  • 1
    Just a note for those coming to this answer later: as mentioned in the comments, the necessary change was to include the \tikz drawing commands inside the figure as well. When a float migrates between pages, the tikz commands do not migrate with it, so they end up drawing on whatever page they are executed on. By putting them inside the figure, they are moved along with the rest of the float to the new page. – rdadolf May 19 '17 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.