3

Good day, hi, I am having some difficulty with including graphics in a table. If you happen to have some spare time, please kindly enlighten me on the following problem

I would like to know how to allow the table to align properly, i.e., the second column is equally spaced and I would like to use multirow on the the third column but failed. Could you please provide advice or guidance on the issue? Thanks a million in advance.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{multirow}

\begin{document}
\begin{tabular}{ |l|l|l|l| }
\hline
\multicolumn{4}{ |c| }{Convergence} \\
\hline
Time & \multicolumn{2}{ |c| }{Information} & Graph \\ \hline
\multirow{3}{*}{1} & Vertice & 1 &  \begin{tikzpicture}
[scale=.3,auto=left]
\node (n1) at (10.6,4.9) [draw, circle,fill=green!20] {1};
\node (n2) at (4,0.8) [draw, circle,fill=blue!20] {2};
\node (n3) at (3.8,11.4) [draw, circle,fill=green!20] {3};
\node (n4) at (0.1,6.4) [draw, circle,fill=green!20] {4};
\node (n5) at (3.6,3.4) [draw, circle,fill=blue!20] {5};
\node (n6) at (7.4,2.3) [draw, circle,fill=blue!20] {6};
\node (n7) at (9,10.4) [draw, circle,fill=green!20] {7};
\node (n8) at (18,10.8) [draw, circle,fill=green!20] {8};

\foreach \from/\to in {n6/n2,n2/n5,n5/n6}
\draw[blue] (\from) -- (\to);
\foreach \from/\to in {n1/n8,n8/n7,n7/n1,n3/n7,n4/n3}
\draw[green] (\from) -- (\to);
\foreach \from/\to in {n6/n1,n5/n4,n2/n4,n1/n5}
\draw[red] (\from) -- (\to);

\end{tikzpicture} \\ \cline{2-1} \cline{3-1}& ${P(1)}$ & 0.5 &   \\ \cline{2-2} \cline{3-2} & Chance & 0.5 &   \
\hline
\multirow{3}{*}{1} & Vertice & 1 & 0.5  \\
& ${P(1)}$ & 0.5 & 0.5 \\
& Chance & 0.5 & 0.5 \
\hline
\end{tabular}
\end{document}

5

This could be an option; in particular, no need for \multirow, no vertical rules (they are not really needed here) and better spacing and rules (thanks to the booktabs package):

\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{booktabs}
\usepackage{array}

\begin{document}

\begin{tabular}{ l  l  l >{\centering\arraybackslash}m{7cm} }
\toprule
\multicolumn{4}{ c }{Convergence} \\
\midrule
Time & \multicolumn{2}{ c }{Information} & Graph \\ 
\cmidrule(r){1-1}\cmidrule(lr){2-3}\cmidrule(l){4-4}
 & Vertice & 1 &  \\[1cm] 
1 & ${P(1)}$ & 0.5 & 
 \raisebox{-2.3cm}[0pt][0pt]{%
  \begin{tikzpicture}[scale=.3,auto=left]
  \node (n1) at (10.6,4.9) [draw, circle,fill=green!20] {1};
  \node (n2) at (4,0.8) [draw, circle,fill=blue!20] {2};
  \node (n3) at (3.8,11.4) [draw, circle,fill=green!20] {3};
  \node (n4) at (0.1,6.4) [draw, circle,fill=green!20] {4};
  \node (n5) at (3.6,3.4) [draw, circle,fill=blue!20] {5};
  \node (n6) at (7.4,2.3) [draw, circle,fill=blue!20] {6};
  \node (n7) at (9,10.4) [draw, circle,fill=green!20] {7};
  \node (n8) at (18,10.8) [draw, circle,fill=green!20] {8};
  %
  \foreach \from/\to in {n6/n2,n2/n5,n5/n6}
  \draw[blue] (\from) -- (\to);
  \foreach \from/\to in {n1/n8,n8/n7,n7/n1,n3/n7,n4/n3}
  \draw[green] (\from) -- (\to);
  \foreach \from/\to in {n6/n1,n5/n4,n2/n4,n1/n5}
  \draw[red] (\from) -- (\to);
  \end{tikzpicture}} \\[1cm] 
& Chance & 0.5 &  \\[1cm]
\cmidrule(r){1-1}\cmidrule(lr){2-3}\cmidrule(l){4-4}
& Vertice & 1 & 0.5  \\
1 & ${P(1)}$ & 0.5 & 0.5 \\
& Chance & 0.5 & 0.5 \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

  • AWESOME!!!!!!!! God bless you, have a nice day sir!!!!!!! Thanks a whole lot! – Vincent Benedict Victor Aug 9 '13 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.