我如何创建带有标题的两部分表格?

我如何创建带有标题的两部分表格?

你能帮我创建一个类似的表格吗? 在此处输入图片描述

我不知道如何做类似的事情,特别是因为我找不到有关这两个表格的标题的信息。

编辑:我尝试过这种方法:

\documentclass{article}
\usepackage{array}
\usepackage{makecell}

\begin{document}
\begin{table}
        \centering
        \begin{tabular}{|c|>{\centering\arraybackslash}p{11cm} |}
            \hline
             &  EfficientFace module \\ \hline 
            Stage1 & \makecell{Reshape \\ Conv1D [k=3, d=64, s=1] + BN1D + ReLU \\ Conv1D [k=3, d=64, s=1] + BN1D + ReLU}  \\ \hline
            Stage2 & \makecell{Conv1D [k=3, d=128, s=1] + BN1D + ReLU \\ Conv1D [k=3, d=128, s=1] + BN1D + ReLU} \\ \hline
            Predict & Global Average Pooling + Linear \\ \hline
        \end{tabular}
        
        \begin{tabular}{|c|>{\centering\arraybackslash}p{11cm} |}
            \hline
            Stage1 & \makecell{Conv1D [k=3, d=64] + BN1D + ReLU + MaxPool1d [2x1] \\ Conv1D [k=3, d=128] + BN1D + ReLU + MaxPool1d [2x1]}  \\ \hline
            Stage2 & \makecell{Conv1D [k=3, d=256] + BN1D + ReLU + MaxPool1d [k=2] \\ Conv1D [k=3, d=128] + BN1D + ReLU + MPool1D [k=2]} \\ \hline
            Predict & Global Average Pooling + Linear \\ \hline
        \end{tabular}
        
        \caption{Architecture of the visual and audio modules}
        \label{tab:modules_architecture}
    \end{table}

\end{document}

我得到了类似的东西:

在此处输入图片描述

答案1

作为一种快速破解方法,您可以使用单个表并将标题作为行插入到该表中:

\documentclass{article}

\usepackage{tabularx}
\usepackage{multirow}

\begin{document}

\begin{table}
    \centering
    \begin{tabularx}{\linewidth}{|c|X|}
        \multicolumn{2}{c}{first title}\\
        \hline
               &  EfficientFace module \\ \hline 
        \multirow{3}{*}{Stage1} & Reshape \\ 
               & Conv1D [k=3, d=64, s=1] + BN1D + ReLU \\ 
               & Conv1D [k=3, d=64, s=1] + BN1D + ReLU \\ \hline
        \multirow{2}{*}{Stage2} & Conv1D [k=3, d=128, s=1] + BN1D + ReLU \\ 
        & Conv1D [k=3, d=128, s=1] + BN1D + ReLU \\ \hline
        Predict & Global Average Pooling + Linear \\ \hline
        \multicolumn{2}{c}{}\\
        \multicolumn{2}{c}{second title}\\
        \hline
        \multirow{2}{*}{Stage1} & Conv1D [k=3, d=64] + BN1D + ReLU + MaxPool1d [2x1] \\ 
        & Conv1D [k=3, d=128] + BN1D + ReLU + MaxPool1d [2x1]  \\ \hline
        \multirow{2}{*}{Stage2} & Conv1D [k=3, d=256] + BN1D + ReLU + MaxPool1d [k=2] \\ 
        & Conv1D [k=3, d=128] + BN1D + ReLU + MPool1D [k=2] \\ \hline
        Predict & Global Average Pooling + Linear \\ \hline
    \end{tabularx}
    \caption{Architecture of the visual and audio modules}
        \label{tab:my_label}
\end{table}

\end{document}

在此处输入图片描述

答案2

像这样?

在此处输入图片描述

使用包tblrtabularray代码使上面的表格简洁明了。表格写成两个表:

\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{table}[htb]
    \centering
Architecture of the visual branch
\par\smallskip    
\begin{tblr}{hline{1,2,4-Z}, vlines,
             colspec = {c X[l,m]},
             cell{2}{1} = {r=2}{},
             cell{1,2}{2} = {c=1}{c},
            rowsep=3pt
             }
        &  EfficientFace module                         \\ 
Stage1  &   Reshape     \\[-1ex]
        &   {Conv1D [k=3, d=64, s=1] + BN1D + ReLU \\ 
             Conv1D [k=3, d=64, s=1] + BN1D + ReLU}     \\ 
Stage2  &   {Conv1D [k=3, d=128, s=1] + BN1D + ReLU \\ 
             Conv1D [k=3, d=128, s=1] + BN1D + ReLU}    \\ 
Predict &   Global Average Pooling + Linear             \\
    \end{tblr}
     
\bigskip
Architecture of the audio branch
\par\smallskip
\begin{tblr}{hlines, vlines,
             colspec = {c X[l,m]},
             rowsep=3pt
             }
Stage1  &   {Conv1D [k=3, d=64] + BN1D + ReLU + MaxPool1d [2x1] \\ 
             Conv1D [k=3, d=128] + BN1D + ReLU + MaxPool1d [2x1]}   \\  
Stage2  &   {Conv1D [k=3, d=256] + BN1D + ReLU + MaxPool1d [k=2] \\ 
             Conv1D [k=3, d=128] + BN1D + ReLU + MPool1D [k=2]}     \\ 
Predict & Global Average Pooling + Linear                           \\
    \end{tblr}
\caption{Architecture of the visual and audio modules}
\label{tab:my_label}
    \end{table}
\end{document}

相关内容