将两个表格设置为双列模式的页面宽度

将两个表格设置为双列模式的页面宽度

在此处输入图片描述

我想生成上图那种表格,一共两个表格,以双列模式占据页面宽度,当我使用下面的代码时,结果跟我想象的不一样,显示在不同行,有没有什么办法可以像图中这样显示?谢谢!

\begin{table*}[t]
    \begin{minipage}[t]{0.3\linewidth}
        \begin{center}
            \begin{tabular}{|c|c|c|}
                \hline
            nums    & W         & L       \\ \hline
                1 (k/ms) & 0  & 0  \\ \hline
                2 (k/ms)  & 0  & 0   \\ \hline
                3 (k/ms) & 0  & 0  \\ \hline
                Total (k/ms) & 0  & 0   \\ \hline
            \end{tabular}
            \caption{Process.}
            \label{table:formatting}
        \end{center}
    \end{minipage}%
    
    
    \begin{minipage}[t]{0.7\linewidth}
        \begin{center}
            \begin{tabular}{|c|c|c|c|}
                \hline
                & \begin{tabular}[c]{@{}c@{}}L1 WB\\ \& Alg.1\end{tabular} & \begin{tabular}[c]{@{}c@{}}sender\\ \& g++\end{tabular} & \begin{tabular}[c]{@{}c@{}}sender\\ only\end{tabular} \\ \hline
                D & 0\%                                                  & 0\%                                                 & 0\%                                               \\ \hline
                L  & 06\%                                                  & 0\%                                                & 0\%                                              \\ \hline
                C & 0\%                                                 & 0\%                                                & 0\%                                              \\ \hline
            \end{tabular}
            \caption{Algorithm 1.}
            \label{table:formatting}
        \end{center}
    \end{minipage}%

    
    \caption{Example sequences }
\end{table*}

答案1

您的代码很好。只需要进行三处小改动。逐一尝试,看看效果。

\documentclass[12pt,a4paper]{article}

\usepackage{showframe}

\begin{document}
    
    \begin{table*}[t]
%       \begin{minipage}[t]{0.3\linewidth}
        \begin{minipage}{0.3\linewidth} %changed <<<<<<<<<<<<
            \begin{center}
                \begin{tabular}{|c|c|c|}
                    \hline
                    nums    & W         & L       \\ \hline
                    1 (k/ms) & 0  & 0  \\ \hline
                    2 (k/ms)  & 0  & 0   \\ \hline
                    3 (k/ms) & 0  & 0  \\ \hline
                    Total (k/ms) & 0  & 0   \\ \hline
                \end{tabular}
                \caption{Process.}
                \label{table:formatting}
            \end{center}
        \end{minipage}% 
    %% remove blank lines <<<<<<<<<<<<<<<<
%       \begin{minipage}[t]{0.7\linewidth}
        \begin{minipage}{0.7\linewidth} %changed <<<<<<<<<<<
            \begin{center}
                \begin{tabular}{|c|c|c|c|}
                    \hline
                    & \begin{tabular}[c]{@{}c@{}}L1 WB\\ \& Alg.1\end{tabular} & \begin{tabular}[c]{@{}c@{}}sender\\ \& g++\end{tabular} & \begin{tabular}[c]{@{}c@{}}sender\\ only\end{tabular} \\ \hline
                    D & 0\%                                                  & 0\%                                                 & 0\%                                               \\ \hline
                    L  & 06\%                                                  & 0\%                                                & 0\%                                              \\ \hline
                    C & 0\%                                                 & 0\%                                                & 0\%                                              \\ \hline
                \end{tabular}
                \caption{Algorithm 1.}
                \label{table:formatting}
            \end{center}
        \end{minipage}%
        \caption{Example sequences }
    \end{table*} 
    
\end{document}

米

相关内容