I have problems with remembering the coordinates of names defined in nested tikz pictures. Look at the following minimal working example:
\documentclass{article}
\usepackage{tikz-qtree}
\newcommand{\inlinenode}[2]{
There are\\
several line\\
breaks\\
#2\tikz[remember picture]\coordinate (#1);\\
and #1 is not\\
in the center}
\begin{document}
\tikzset{every tree node/.style={align=center,anchor=north}}
\begin{tikzpicture}
\Tree [.{Root}
[.\node{\inlinenode{x1}{$x_1$}}; ]
[.\node (x2) {$x_2$}; ]
]
\path[thick,color=red] (x1) edge (x2);
\end{tikzpicture}
\end{document}

I want to connect x1 with x2 using the red line, which works fine for x2, but the other end is pointing in a weird place instead of to x1.
I have tried running pdflatex multiple times, but then the position of x1 gets even weirder.
What I want to achieve should be visible in the picture above, I want a multiline node with a special word/graphic inside the text and then connecting this word to another node (or even another special word inside another multiline text of a node). Feel free to modify my approach.
I also tried replacing the #2\tikz...\coordinate(#1) with \subnode{#1}{#2} (as in this similar question), but this has the same result.

subnodeis for since it is meant to define things as if there were nesting but without doing the actual nesting. However,tikz-qtreeactually does some nesting internally and this may be messing with how tikzmark and subnode work. If no-one comes up with a better solution in the meantime, I'll do some digging and see if I can figure it out. – Andrew Stacey Jan 13 '14 at 07:57