
Estou tentando traçar uma linha entre o nó S e a matriz, mas não consegui fazê-la funcionar. O que estou fazendo de errado?
MWE:
\documentclass[a4paper,12pt]{article}
\usepackage{fontspec,tikz, tikz-qtree, multicol,avm,array}
\usetikzlibrary{matrix, positioning, trees, calc, arrows, fit,tikzmark,positioning}
\begin{document}
\begin{multicols}{2}
\begin{tikzpicture}
\begin{scope}
\Tree [.\tikzmark{S}{S} [.NP [.Det the ]
[.N cat ] ]
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ]
[.N; mat ] ] ] ] ]
\end{scope}
\end{tikzpicture}
\columnbreak
\begin{avm}
\scriptsize
\[{} \tikzmark{PRED}{PRED} `avoid <SUBJ, OBJ>'; TNS $\neq$ PAST \cr
TOPIC \[ PRED `kind<COMP>' \cr
DEF +; LOC FAR; NUM SG \cr
COMP \[ PRED `of <OBJ>' \cr
OBJ \[ PRED `cake'\] \] \]\tikzmark{topic} \cr
SUBJ \[ PRED `pro'; NUM SG; PERS 1; CASE NOM\] \cr
OBJ \[ $\qquad$ \]\tikzmark{object} \cr
ADJ \[ PRED `usually'\] \]
\end{avm}
\begin{tikzpicture}[remember picture,overlay]
\draw[->] (pic cs:S)--(pic cs:PRED);
\draw[-] (pic cs:topic) to[out=0,in=0,looseness=2] (pic cs:object);
\end{tikzpicture}
\end{multicols}
\end{document}
Responder1
Isso se deve à forma como tikz-qtree
funciona. A longa explicação pode ser encontrada emminha respostapara\draw alinhamento ao conectar nós usando tikz-qtree, centralizando a linha
Recortar e colar meu código dessa resposta é metade da solução aqui. A outra metade é retirar o \tikzmark
da árvore. Infelizmente, \tikzmark
sofre do mesmo problema que o tikz-qtree
(conforme explicado nessa resposta), por isso precisaria de um ajuste semelhante. Felizmente, isso não é necessário. Como a tikz-qtree
está dentro de um tikzpicture
ambiente, podemos usar o tikz
sistema comum de rotulagem de nós para nos referirmos aos nós em a tikzpicture
. ( tikzmark
foi desenvolvido paraforaa tikzpicture
e na verdade não deve ser usado internamente, pois sofre com osíndrome de tikzpicture aninhada.)
\documentclass[a4paper,12pt]{article}
%\url{https://tex.stackexchange.com/q/219072/86}
\usepackage{fontspec,tikz, tikz-qtree, multicol,avm,array}
\usetikzlibrary{matrix, positioning, trees, calc, arrows, fit,tikzmark,positioning}
\makeatletter
\def\unwind@subpic#1{%
% is #1 the current picture?
\edef\subpicid{#1}%
\ifx\subpicid\pgfpictureid
% yes, we're done
\else
% does #1 have a parent picture?
\expandafter\ifx\csname pgf@sh@pi@#1\endcsname\relax
% no, the original node was not inside the current picture
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\pgfsys@getposition{\pgfpictureid}\pgf@shape@current@pos
\pgf@process{\pgfpointorigin\pgf@shape@current@pos}%
\advance\pgf@xa by-\pgf@x%
\advance\pgf@ya by-\pgf@y%
\pgf@process{\pgfpointorigin\subpic@parent@pos}%
\advance\pgf@xa by \pgf@x%
\advance\pgf@ya by \pgf@y%
\pgf@x=\pgf@xa
\pgf@y=\pgf@ya
\else
% yes, apply transform, save picture location, and move up to parent picture
\pgfsys@getposition{\csname pgf@sh@pi@#1\endcsname}\subpic@parent@pos%
{%
\pgfsettransform{\csname pgf@sh@nt@#1\endcsname}%
\pgf@pos@transform{\pgf@x}{\pgf@y}%
\global\pgf@x=\pgf@x
\global\pgf@y=\pgf@y
}%
\unwind@subpic{\csname pgf@sh@pi@#1\endcsname}%
\fi
\fi
}
\def\pgf@shape@interpictureshift#1{%
\def\subpic@parent@pos{\pgfpointorigin}%
\unwind@subpic{\csname pgf@sh@pi@#1\endcsname}%
}
\makeatother
\begin{document}
\begin{multicols}{2}
\begin{tikzpicture}[remember picture]
\begin{scope}
\Tree [. \node (S) {S}; [.NP [.Det the ]
[.N cat ] ]
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ]
[.N; mat ] ] ] ] ]
\end{scope}
\end{tikzpicture}
\columnbreak
\begin{avm}
\scriptsize
\[{} \tikzmark{PRED}{PRED} `avoid <SUBJ, OBJ>'; TNS $\neq$ PAST \cr
TOPIC \[ PRED `kind<COMP>' \cr
DEF +; LOC FAR; NUM SG \cr
COMP \[ PRED `of <OBJ>' \cr
OBJ \[ PRED `cake'\] \] \]\tikzmark{topic} \cr
SUBJ \[ PRED `pro'; NUM SG; PERS 1; CASE NOM\] \cr
OBJ \[ $\qquad$ \]\tikzmark{object} \cr
ADJ \[ PRED `usually'\] \]
\end{avm}
\begin{tikzpicture}[remember picture,overlay]
\draw[->] (S)--(pic cs:PRED);
\draw[-] (pic cs:topic) to[out=0,in=0,looseness=2] (pic cs:object);
\end{tikzpicture}
\end{multicols}
\end{document}
Responder2
Funciona depois que você muda para o pdfLaTeX. Para isso, é necessário remover fontspec
dos pacotes carregados.
Com o XeLaTeX notei que o problema persistia.