# Increase space between two tables in minipage and TikZ overlay

Sorry but this is the MWE I could post. I also attached the image. The top image is what I am getting and the bottom one is what I desire. I manage to create nodes but do not know how to connect them. I tried this \draw[-latex] (16.south) |- (28.south); but that did not give me good output. Also I put a mini page with two tables. The gap between them is less however I desire bigger gap as shown in the desired output

\documentclass{article}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{tabularx}
\usepackage{placeins}
\usepackage{tikz}
\usepackage{pgf,pgffor}
\usetikzlibrary{calc}

\usetikzlibrary{fit,shapes.geometric}
\newcounter{nodemarkers}
\newcommand\circletext[1]{%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-a) at (0,1.5ex) {};%
#1%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-b) at (0,0){};%
\tikz[overlay,remember picture,inner sep=2pt]
\node[draw,ellipse,fit=(marker-\arabic{nodemarkers}-a.center) (marker-\arabic{nodemarkers}-b.center)] {};%
\stepcounter{nodemarkers}%
}

\newcommand\fb\FloatBarrier % to put float barriers

% Introduce a new counter for counting the nodes needed for circling
\newcounter{nodecount}
% Command for making a new node and naming it according to the nodecount counter
% Some options common to all the nodes and paths
\tikzstyle{every picture}+=[remember picture,baseline]
\tikzstyle{every node}+=[inner sep=0pt,anchor=base,
minimum width=1cm,align=center,text depth=0.5ex,outer sep=1pt]
\tikzstyle{every path}+=[thick, rounded corners]

\begin{document}
\fb
\begin{table}[ht]
\begin{minipage}[b]{1\linewidth}
\begin{tabular}{l l c l}
& \tabnode{}& \tabnode{}&  \tabnode{} \\
& \tabnode{A} & \tabnode{D} &  \tabnode{G} \\
I & \tabnode{B} & \tabnode{E} & \tabnode{H}  \\
& \tabnode{C} & \tabnode{F} & \tabnode{I}  \\
& & & \\
& & & \\
& & & \\
& & & \\
II & \tabnode{One} & \tabnode{Two }& \tabnode{Three}   \\
& & & \\
& & & \\
III & \tabnode{First}& \tabnode{Second }& \tabnode{Third}  \\
\end{tabular}
\hspace{5cm}
\begin{tabular}{l l c l}
& \tabnode{}& \tabnode{}&  \tabnode{} \\
I & \tabnode{X} & \tabnode{Y} & \tabnode{Z}  \\
& & & \\
& & & \\
II & \tabnode{x} & \tabnode{y }& \tabnode{z}   \\
& & & \\
& & & \\
III & \tabnode{Xx }& \tabnode{Yy }& \tabnode{Zz}  \\
\end{tabular}
\end{minipage}
\end{table}

\begin{tikzpicture}[overlay]
\draw [Green] (4.west) -- (1.north west) -- (1.north east) -- (10.south east) -- (10.south west) -- cycle;
\draw [red] (5.west) -- (2.north west) -- (2.north east) -- (11.south east) -- (11.south west) -- cycle;
\draw [blue] (6.west) -- (3.north west) -- (3.north east) -- (12.south east) -- (12.south west) -- cycle;

\draw [Green] (16.west) -- (16.north west) -- (16.north east) -- (16.south east) -- (16.south west) -- cycle;
\draw [red] (17.west) -- (17.north west) -- (17.north east) -- (17.south east) -- (17.south west) -- cycle;
\draw [blue] (18.west) -- (18.north west) -- (18.north east) -- (18.south east) -- (18.south west) -- cycle;

\draw [Green] (28.west) -- (28.north west) -- (28.north east) -- (28.south east) -- (28.south west) -- cycle;
\draw [red] (29.west) -- (29.north west) -- (29.north east) -- (29.south east) -- (29.south west) -- cycle;
\draw [blue] (30.west) -- (30.north west) -- (30.north east) -- (30.south east) -- (30.south west) -- cycle;

\draw[-latex] (16.south) |- (28.south);
\end{tikzpicture}
\end{document}


-
Thanks for posting a complete document. However, the current MWE that you posted is not compilable. Please correct. – Peter Grill Mar 19 '12 at 16:54
I added a working example now. – Aku Mar 19 '12 at 18:12
\path[-latex] (16.south) edge [bend right,Green] (28.south); this worked great for connecting the node, I am not sure if this is the best way to do but it worked. – Aku Mar 19 '12 at 18:35

I think you can simplify a little further for that kind of tables which has different node shapes and colors. You can enter the table contents into a matrix and manipulate the styles of rows and columns. Moreover, you can inject individual styles to the cells via the use of |[node style options]|. The advantage of the is that everything takes place in one tikzpicture and you don't need to tame anything. Here is an example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\tikzset{rn1/.style={   text width=1.5 ex, minimum width=8ex,rounded corners },
rn2/.style={minimum width=10mm, rounded corners},
mymatrix/.style={
nodes in empty cells,
matrix of nodes,
row sep=2mm,
column sep=3mm
}
}
\begin{tikzpicture}
\matrix[mymatrix,
row 1/.style={rn1,anchor=center},
row 3/.style={rn2}
] (L) {
I  &|[draw=green]| A B C &|[draw=red]| E F G & |[draw=blue]| H J I\\
II & One & Two & Three\\
III &|[draw=green]| First &|[draw=red]|  Second & |[draw=blue]| Third\\
};
\matrix[mymatrix,row 3/.style={rn2}] (R) at (8cm,0) {% We shift it to the right
I  &X &Y & Z\\
II & x & y & z\\
III &|[draw=green]| Xx &|[draw=red]|  Yy & |[draw=blue]| Zz\\
};
\draw[bend right,green] (L-3-2) to (R-3-2);
\draw[bend right,red] (L-3-3) to (R-3-3);
\draw[bend right,blue] (L-3-4) to (R-3-4);
\end{tikzpicture}
\end{document}


The text width option is actually for a line break after approx. one character such that A B C is typed in 3 lines.

-

I get errors running your MWE, perhaps my instalation is a bit old, but on the face of it

 \end{tabular}
\hspace{2in}
\begin{tabular}{l l c l}


is what you are asking for, and will separate the tables.

-
\hspace worked great however I still do not know how to connect the nodes with freestyle line as shown in the attached image – Aku Mar 19 '12 at 18:13