
Estoy intentando trazar una línea entre el nodo S y la matriz, pero no he podido hacerlo funcionar. ¿Qué estoy haciendo mal?
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}
Respuesta1
Esto se debe a la forma en que tikz-qtree
funciona. La explicación larga se puede encontrar enmi respuestaa\ dibujar alineación al conectar nodos usando tikz-qtree, centrando la línea
Cortar y pegar mi código de esa respuesta es la mitad de la solución aquí. La otra mitad es para quitar la \tikzmark
del árbol. Desafortunadamente, \tikzmark
sufre el mismo problema que tikz-qtree
(como se explica en esa respuesta), por lo que necesitaría un ajuste similar. Afortunadamente, esto no es necesario. Dado que a tikz-qtree
está dentro de un tikzpicture
entorno, podemos usar el tikz
sistema de etiquetado de nodos ordinario para referirnos a los nodos en a tikzpicture
. ( tikzmark
fue desarrollado paraafueraa tikzpicture
y en realidad no debe usarse en interiores ya que luego sufre elsíndrome de tikzpicture anidado.)
\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}
Respuesta2
Funciona después de cambiar a pdfLaTeX. Para ello, es necesario eliminarlo fontspec
de los paquetes cargados.
Con XeLaTeX noté que el problema persistía.