长桌的问题

长桌的问题

我想在 LaTeX 中打印一个长表格,也就是说它必须跨页。表格中有太多换行符。我的代码和示例表格已附上。代码如下:

\documentclass[twocolumn]{article}
\usepackage{supertabular, booktabs}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{cuted}
\usepackage{array} 
\usepackage{diagbox} 
\usepackage{multirow} 
\begin{document}
        \begin{strip}
        \centering
        %\setlength{\extrarowheight}{2pt}
        \tablefirsthead{%
            \toprule
            Layer / Operation & Input Shape1 / Output Shape1 & Input Shape2 / Output Shape2 & Layer Type & Kernel Size & No.of Kernels &  Strides & Stride Size &  Padding & Activations &  Calculation & No.of Parameters\\ \midrule \\
        }
        \tablehead{%
            %\hline\multicolumn{4}{|l|}{\small\sl continued from previous page}\\
                    Layer / Operation & Input Shape1 / Output Shape1 & Input Shape2 / Output Shape2 & Layer Type & Kernel Size & No.of Kernels &  Strides & Stride Size &  Padding & Activations &  Calculation & No.of Parameters\\ \midrule \\
        }
        \tabletail{%
            \bottomrule
            \multicolumn{5}{c}{\small continued on next page} \\
            \bottomrule \\
        }
        \tablelasttail{%
            \bottomrule \\
        }
        \tablecaption{Publication Distribution with the Design Space}
        \label{tab: designSpace} 
        \begin{supertabular}{@{}|p{\dimexpr 0.06\textwidth-\tabcolsep \relax}|p{\dimexpr 0.10\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.08\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.07\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.08\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.08\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.08\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.08\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.10\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.12\textwidth-2\tabcolsep \relax}|p{\dimexpr 0.12\textwidth-2\tabcolsep \relax}
                |p{\dimexpr
        0.08\textwidth-\tabcolsep\relax              }|@{}}
            %\begin{supertabular*}{p{0.20\textwidth}p{0.22\textwidth}p{0.20\textwidth}p{0.18\textwidth}p{ 0.20\textwidth}}
            Input      & (256 x 256 x 1)   & (128 x 128 x 1)   & Input   & - & - & - & - & - & - & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} \\   
        \hline
        Conv1\_1 & (256 x 256 x 64) & (128 x 128 x 64) & Conv2D &  (3, 3)   & 64 & 1 & - & 'same'   & ReLU & (9 * 1 + 1) * 64 & 640 \\      
        \end{supertabular}
    \end{strip}     
\end{document}

样本图像为

在此处输入图片描述

答案1

我建议切换到单列模式开始supertabular材料。您还需要确保列宽之和不超过\textwidth

在此处输入图片描述

\documentclass[twocolumn]{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{afterpage} % for '\afterpage' macro
\usepackage{supertabular, booktabs, ragged2e} 
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{\dimexpr #1\relax}}

\begin{document}

\afterpage{%
\clearpage % flush any accumulated floats
\onecolumn % switch to one-column mode

\setlength\tabcolsep{3pt} % default value: 6pt

\tablefirsthead{%
  \toprule
  Layer\slash Opera\-tion & Input shape1\slash Output shape1 & Input shape2\slash Output shape2 & Layer type & Kernel size & No.of kernels &  Strides & Stride size &  Pad\-ding & Activations &  Calculation & No.\ of parameters\\ 
  \midrule 
  }
  
\tablehead{%
  %\multicolumn{12}{@{}l}{\small\slshape continued from previous page}\\[1ex]
  \toprule
  Layer\slash Opera\-tion & Input shape1\slash Output shape1 & Input shape2\slash Output shape2 & Layer type & Kernel size & No.of kernels &  Strides & Stride size &  Pad\-ding & Activations &  Calculation & No.of parameters\\ 
  \midrule 
  }
  
\tabletail{%
  \midrule
  \multicolumn{12}{r@{}}{\small continued on next page} \\
  }
  
\tablelasttail{%
  \bottomrule 
  }
        
\tablecaption{Publication distribution with the design space}
  \label{tab: designSpace} 
        
\begin{supertabular}{@{}
        P{0.09\textwidth-1\tabcolsep}
        P{0.10\textwidth-2\tabcolsep}
        P{0.10\textwidth-2\tabcolsep}
        P{0.09\textwidth-2\tabcolsep}
        P{0.07\textwidth-2\tabcolsep}
        P{0.07\textwidth-2\tabcolsep}
        P{0.08\textwidth-2\tabcolsep}
        P{0.07\textwidth-2\tabcolsep}
        P{0.08\textwidth-2\tabcolsep}
        P{0.09\textwidth-2\tabcolsep}
        P{0.08\textwidth-2\tabcolsep}
        P{0.08\textwidth-1\tabcolsep} @{}}

Input    & (256 $\times$ 256 $\times$ 1) & (128 $\times$ 128 $\times$ 1) & Input & -- & -- & -- & -- & -- & -- & 0 & 0 \\   
\midrule
Conv1\_1 & (256 $\times$ 256 $\times$ 64) & (128 $\times$ 128 $\times$ 64) & Conv2D &  (3, 3)   & 64 & 1 & -- & `same'   & ReLU & (9 $\times$ 1 + 1) $\times$ 64 & 640 \\      

\end{supertabular}

\twocolumn% back to two-column mode
}% end of scope of '\afterpage' directive

\end{document}

相关内容