乳胶中的表内表

乳胶中的表内表

为了解释我论文中的例子,我需要有 6 个表格,我需要将它们打包成一个包。我尝试在 excel 中制作一个带有小表格的表格,然后使用工具将其转换为 latex,但输出不理想。

您能否帮助我编辑此内容并获得我想要的输出。我需要打包 6 个 5*5 表格,以便每个表格的第一行包含两个单元格(最后 4 个单元格合并)。

\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}

答案1

您可以将多个tabulars 放在一个 中table。换行符只需插入一个空行即可。

% 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}

在此处输入图片描述


如果您需要每个标题tabular,请查看包装。然后subcaption您必须将每个包装tabular在环境中。subfigure

答案2

像这样?

\documentclass{article}
\newcommand{\mc}[2]{\multicolumn{#1}{|c|}{#2}}
\begin{document}
  \begin{tabular}{ |*{11}{l|}}
\cline{1-5}\cline{7-11}
      node's id & \mc{4}{node's list} & \qquad\qquad &
                 node's id & \mc{4}{node's list}
                                  \\ \cline{1-5}\cline{7-11}
      1 & 1 & 1 & 1 & 1 & & 1 & 2 & 2 & 2 & 2 \\ \cline{1-5}\cline{7-11}
      2 & 1 & 1 & 1 & 1 & & 3 & 2 & 2 & 2 & 2 \\ \cline{1-5}\cline{7-11}
      3 & 1 & 1 & 1 & 1 & & 4 & 2 & 2 & 2 & 2 \\ \cline{1-5}\cline{7-11}
      4 & 1 & 1 & 1 & 1 & & 5 & 2 & 2 & 2 & 2 \\ \cline{1-5}\cline{7-11}
      5 & 1 & 1 & 1 & 1 & &   &   &   &   &      \\ \cline{1-5}\cline{7-11}
        \multicolumn{11}{l}{}      \\ \cline{1-5}\cline{7-11}
      node's id & \mc{4}{node's list}  &   & node's id & \mc{4}{node's list}
                                  \\ \cline{1-5}\cline{7-11}
      2 & 3 & 3 & 3 & 3 & &  1 & 4 & 4 & 4 & 4  \\ \cline{1-5}\cline{7-11}
      3 & 3 & 3 & 3 & 3 & &  2 & 4 & 4 & 4 & 4  \\ \cline{1-5}\cline{7-11}
      4 & 3 & 3 & 3 & 3 & &  3 & 4 & 4 & 4 & 4  \\ \cline{1-5}\cline{7-11}
      5 & 3 & 3 & 3 & 3 & &  5 & 4 & 4 & 4 & 4  \\ \cline{1-5}\cline{7-11}
        \multicolumn{11}{l}{}      \\ \cline{1-5}\cline{7-11}
      node's id & \mc{4}{node's list}  &   & node's id & \mc{4}{node's list}
                                  \\ \cline{1-5}\cline{7-11}
      1 & 5 & 5 & 5 & 5 & &   1 & 6 & 6 & 6 & 6   \\ \cline{1-5}\cline{7-11}
      3 & 5 & 5 & 5 & 5 & &   3 & 6 & 6 & 6 & 6   \\ \cline{1-5}\cline{7-11}
      4 & 5 & 5 & 5 & 5 & &   4 & 6 & 6 & 6 & 6   \\ \cline{1-5}\cline{7-11}
      5 & 5 & 5 & 5 & 5 & &   5 & 6 & 6 & 6 & 6   \\ \cline{1-5}\cline{7-11}
\end{tabular}
\end{document}

在此处输入图片描述

相关内容