[Tex/LaTex] tables inside tables in latex

tables

For explaining an example in my paper, I need to have 6 tables and I need to make them as a package. I tried to make a table with small tabled indide in excel and then convert it with a tool to latex but output is not desirable.

Could you help me to maybe edit this and get my desirable output.
I need to pack 6 5*5 tables so that the first row of each table includes two cells (last 4 cells are merged).

\begin{tabular}{ | l | l | l | l | l | l | l | l | l | l | l | l | l | }
\hline
     &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
     & node's id & node's list &  &  &  &  & node's id & node's list &  &  &  &  \\ \hline
     & 1 & 1 & 1 & 1 & 1 &  & 1 & 2 & 2 & 2 & 2 &  \\ \hline
     & 2 & 1 & 1 & 1 & 1 &  & 3 & 2 & 2 & 2 & 2 &  \\ \hline
     & 3 & 1 & 1 & 1 & 1 &  & 4 & 2 & 2 & 2 & 2 &  \\ \hline
     & 4 & 1 & 1 & 1 & 1 &  & 5 & 2 & 2 & 2 & 2 &  \\ \hline
     & 5 & 1 & 1 & 1 & 1 &  &  &  &  &  &  &  \\ \hline
     &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
     & node's id & node's list &  &  &  &  & node's id & node's list &  &  &  &  \\ \hline
     & 2 & 3 & 3 & 3 & 3 &  & 1 & 4 & 4 & 4 & 4 &  \\ \hline
     & 3 & 3 & 3 & 3 & 3 &  & 2 & 4 & 4 & 4 & 4 &  \\ \hline
     & 4 & 3 & 3 & 3 & 3 &  & 3 & 4 & 4 & 4 & 4 &  \\ \hline
     & 5 & 3 & 3 & 3 & 3 &  & 5 & 4 & 4 & 4 & 4 &  \\ \hline
     &  &  &  &  &  &  &  &  &  &  &  &  \\ \hline
     & node's id & node's list &  &  &  &  & node's id & node's list &  &  &  &  \\ \hline
     & 1 & 5 & 5 & 5 & 5 &  & 1 & 6 & 6 & 6 & 6 &  \\ \hline
     & 3 & 5 & 5 & 5 & 5 &  & 3 & 6 & 6 & 6 & 6 &  \\ \hline
     & 4 & 5 & 5 & 5 & 5 &  & 4 & 6 & 6 & 6 & 6 &  \\ \hline
     & 5 & 5 & 5 & 5 & 5 &  & 5 & 6 & 6 & 6 & 6 &  \\ \hline
\end{tabular}

Best Answer

You can put several tabulars in one table. For the line break just insert a blank line.

% arara: pdflatex

\documentclass{article} 
\usepackage{booktabs}
\usepackage{caption}

\begin{document}
\begin{table}
    \caption{6 tables}
    \centering
    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}\hfil % you can also leave this away, try \hfill or \hspace{'some length'em}
    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}\vspace{2ex} % optional

    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}\hfil
    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}\vspace{2ex}

    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}\hfil
    \begin{tabular}{*{5}{l}}
        \toprule
        1.1 & \multicolumn{4}{l}{merged cell}\\\midrule
        2.1 & 2.2 & 2.3 & 2.4 & 2.5\\
        3.1 & 3.2 & 3.3 & 3.4 & 3.5\\
        4.1 & 4.2 & 4.3 & 4.4 & 4.5\\
        5.1 & 5.2 & 5.3 & 5.4 & 5.5\\
        \bottomrule
    \end{tabular}
\end{table} 
\end{document}

enter image description here


If you need captions for each tabular, please have a look on the package subcaption. You will have to wrap every tabular in a subfigure-environment then.

Related Question