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
Thanks for your help
\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{positioning,shapes,shadows,arrows}
\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
\newcommand\tabnode[1]{\addtocounter{nodecount}{1} \tikz \node (\arabic{nodecount}) {#1};}
% 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}
Best Answer
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 onetikzpicture
and you don't need to tame anything. Here is an example:The
text width
option is actually for a line break after approx. one character such thatA B C
is typed in 3 lines.