I am trying to give a very simple analogy to what I am trying to do with LaTeX
. I simply want to write two vectors, one below or next the other, and then, use nodes to link the last two elements of the first vector and the last element from the second vector.
Here is the code I am using
\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows}% For nice arrow tips
% One style for all TikZ pictures for working with overlays:
\tikzset{every picture/.style=remember picture}
% Define a TikZ node for math content:
\newcommand{\mathnode}[1]{%
\mathord{\tikz[baseline=(#1.base), inner sep = 0pt]{\node (#1) {$#1$};}}}
\begin{document}
$\begin{bmatrix}
1 \\ \mathnode{2\rho \pi \\ 3}
\end{bmatrix}$
\\
$\begin{bmatrix}
1 \\ 2\rho \pi \\ \mathnode{3}
\end{bmatrix}$
% Now we draw connections between defined nodes:
\begin{tikzpicture}[overlay]
\path [>=stealth, <->, shorten <= 3pt, shorten >=3 pt]
(N1) edge [bend left=60] (N2);
\end{tikzpicture}
\end{document}
How can I modify the mathnode declaration, to give a name to the node, and to be able to fill each node separately ?
Please, any suggestions?
Thanks.
Best Answer
I don't quite understand the output you have in mind, but I definitely would go through the tikz
matrix
way, by putting two matrices of nodes in the same tikzpicture, without usingremember picture
noroverlay
.For example:
Produces: