乳胶桌子设计

乳胶桌子设计

我在表格布局方面遇到了问题。代码如下。当我取消多列和 cline 命令行时,它就可以正常工作。否则它会提供一条错误消息,指出缺少数字,视为零。D l.771 }

有没有什么解决办法?提前致谢。

赛义德

\begin{landscape}
\renewcommand{\baselinestretch}{1}
\begin{table}[!htb]
\renewcommand\thetable{A1}
\caption{\centerline{\bf Table A1}\ 
\centerline{\bf Univariate Comparison of Derivatives Users and Non-users}\vspace{-0.14 mm}}
\label{Table A1}
{\footnotesize This table provide mean and median}\\
\vspace{-4 mm}
\normalsize
\begin{center}
\scalebox{0.92}{
\begin{tabular}{lllllllllllllll}
\hline \hline
& \multicolumn{3}{c}{All firms} &&&&\multicolumn{3}{c}{Derivatives users} &&&&\multicolumn{Derivatives non-users}&&&& \multicolumn{2}{c}{Difference tests} \\
\cline{2-4}
\cline{6-8}
\cline{10-12}
\cline{14-15}
 Variables                          & N    & Mean     & Median &  & N    & Mean    & Median  &  & N   & Mean    & Median  &  & Mean       & Median        \\
                           &      &          &        &  &      &         &         &  &     &         &         &  & t-test     & Wilcoxon test \\

I & 8 & 0.0315   & 04 &  & 31 & 0.0456  & 28  &  & 557 & -0.014  & -0.0131 &  & 0.0596***  & 0.0359***     \\
B             & 2388 & 0.6485   & 0.5405 &  & 11 & 077  & 0.5495  &  & 557 & 34  & 0.5076  &  & -0.0457    & 0.0419***     \\
E        & 2388 & 4.3319   & 4.1561 &  & 1831 & 4.5264  & 11  &  & 557 & 3.7036  & 3.519   &  & 0.8288***  & 0.8621***     \\
S                       & 2388 & 12.8891  & 12.516 &  & 1831 & 13.4206 & 1301245 &  & 557 & 11.1725 & 11.1486 &  & 2.2481***  & 1.9759***     \\
N         & 2388 & 3.10E+00 & 3      &  & 1831 & 3.2501  & 3       &  & 557 & 2.6014  & 2       &  & 0.6487***  & 1***          \\
tio                & 2065 & 0.3366   & 0.0037 &  & 1661 & 0.3057  & 0.005   &  & 404 & 0.4634  & 0.0002  &  & -0.1577    & 0.0048        \\
les to net sales & 2170 & 40.2858  & 41.32  &  & 1750 & 44.1013 & 46.94   &  & 420 & 24.3878 & 12.28   &  & 19.7135*** & 34.66***      \\
Depriciation               & 2200 & 0.0304   & 0.0254 &  & 1764 & 0.0324  & 0.0275  &  & 436 & 0.0227  & 0.0156  &  & 0.0097***  & 0.0119***     \\
Return on assets           & 2388 & 0.0196   & 0.0358 &  & 1831 & 0.0318  & 0.0359  &  & 557 & 0.0198  & 0.0352  &  & 0.0120***  & 0.0007        \\
se                & 2342 & 0.2164   & 0.1629 &  & 1794 & 0.0196  & 0.1546  &  & 548 & 0.2843  & 0.1952  &  & -0.0886*** & -0.0406***   \\
\hline \hline
\end{tabular}
}
\end{center}
\end{table}
\end{landscape}

答案1

嗯,TeX-error 消息可能会令人困惑。您的代码有两个问题:

  1. \multicolumn总是需要三个参数。因此\multicolumn{Derivatives non-users}缺少两个参数。
  2. 该命令\multicolumn{3}{c}{some text}告诉 TeX 创建一个横跨三列的单元格。这意味着你必须删除两个&s。

以下编译成功:

\begin{tabular}{lllllllllllllll}
\hline \hline
& \multicolumn{3}{c}{All firms} &&\multicolumn{3}{c}{Derivatives users} &&\multicolumn{3}{c}{Derivatives non-users}&& \multicolumn{2}{c}{Difference tests} \\
\cline{2-4}
\cline{6-8}
\cline{10-12}
\cline{14-15}
 Variables                          & N    & Mean     & Median &  & N    & Mean    & Median  &  & N   & Mean    & Median  &  & Mean       & Median        \\
                           &      &          &        &  &      &         &         &  &     &         &         &  & t-test     & Wilcoxon test \\

I & 8 & 0.0315   & 04 &  & 31 & 0.0456  & 28  &  & 557 & -0.014  & -0.0131 &  & 0.0596***  & 0.0359***     \\
B             & 2388 & 0.6485   & 0.5405 &  & 11 & 077  & 0.5495  &  & 557 & 34  & 0.5076  &  & -0.0457    & 0.0419***     \\
E        & 2388 & 4.3319   & 4.1561 &  & 1831 & 4.5264  & 11  &  & 557 & 3.7036  & 3.519   &  & 0.8288***  & 0.8621***     \\
S                       & 2388 & 12.8891  & 12.516 &  & 1831 & 13.4206 & 1301245 &  & 557 & 11.1725 & 11.1486 &  & 2.2481***  & 1.9759***     \\
N         & 2388 & 3.10E+00 & 3      &  & 1831 & 3.2501  & 3       &  & 557 & 2.6014  & 2       &  & 0.6487***  & 1***          \\
tio                & 2065 & 0.3366   & 0.0037 &  & 1661 & 0.3057  & 0.005   &  & 404 & 0.4634  & 0.0002  &  & -0.1577    & 0.0048        \\
les to net sales & 2170 & 40.2858  & 41.32  &  & 1750 & 44.1013 & 46.94   &  & 420 & 24.3878 & 12.28   &  & 19.7135*** & 34.66***      \\
Depriciation               & 2200 & 0.0304   & 0.0254 &  & 1764 & 0.0324  & 0.0275  &  & 436 & 0.0227  & 0.0156  &  & 0.0097***  & 0.0119***     \\
Return on assets           & 2388 & 0.0196   & 0.0358 &  & 1831 & 0.0318  & 0.0359  &  & 557 & 0.0198  & 0.0352  &  & 0.0120***  & 0.0007        \\
se                & 2342 & 0.2164   & 0.1629 &  & 1794 & 0.0196  & 0.1546  &  & 548 & 0.2843  & 0.1952  &  & -0.0886*** & -0.0406***   \\
\hline \hline
\end{tabular}

答案2

清理表格排版后(纠正错误\multicolumn和多余的空列,我添加了包booktabs,我(在第一次迭代中)制作了以下 MWE:

\documentclass[12pt]{article}
    \usepackage[hmargin={30mm,30mm},
                height=247mm,
                a4paper]{geometry}
    \usepackage{pdflscape}
    \usepackage{booktabs}
    \usepackage{caption}

    \begin{document}
\begin{landscape}
    \renewcommand{\baselinestretch}{1}
    \begin{table}[h]\centering
\renewcommand\thetable{A1}
\caption{Univariate Comparison of Derivatives Users and Non-users}
    \label{Table A1}
    \begin{tabular}{*{12}{l}}
    \toprule
    &   \multicolumn{3}{c}{All firms} 
        &   \multicolumn{3}{c}{Derivatives users} 
            &   \multicolumn{3}{c}{Derivatives non-users} 
                & \multicolumn{2}{c}{Difference tests} \\
    \cmidrule(r) {2-4}
    \cmidrule(lr){5-7}
    \cmidrule(lr){8-10}
    \cmidrule(l) {11-12}
Variables                          
    &   N   &   Mean    &   Median    
        &   N   & Mean      &   Median   
            &   N       &   Mean    &   Median    
                &   Mean    &   Median          \\
    &   &   &   &   &       &   &   &   &   
        &   t-test  &   Wilcoxon test \\
    \midrule
I & 8   & 0.0315        & 04    & 31    & 0.0456  & 28  
    &   557 & -0.014    & -0.0131   & 0.0596***     & 0.0359***     \\
B & 2388& 0.6485    & 0.5405    & 11    & 077   & 0.5495  
    &   557 & 34        & 0.5076    & -0.0457       & 0.0419***     \\
B & 2388& 0.6485    & 0.5405    &  11   & 077       & 0.5495  
    & 557 & 34  & 0.5076  & -0.0457     & 0.0419***                 \\
E & 2388& 4.3319   & 4.1561 & 1831    & 4.5264    & 11  & 557 
    & 3.7036  & 3.519  & 0.8288***  & 0.8621***                     \\
S & 2388 & 12.8891  & 12.516 & 1831 & 13.4206 & 1301245 & 557 
        & 11.1725   & 11.1486 & 2.2481***  & 1.9759***              \\
N & 2388 & 3.10E+00 & 3     & 1831 & 3.2501  & 3 & 557 
    & 2.6014  & 2   & 0.6487***  & 1***                             \\
tio & 2065 & 0.3366   & 0.0037 & 1661 & 0.3057  & 0.005 & 404 
        & 0.4634  & 0.0002  & -0.1577    & 0.0048                   \\
les to net sales 
    & 2170 & 40.2858  & 41.32 & 1750 & 44.1013 & 46.94 & 420 
        & 24.3878 & 12.28  & 19.7135*** & 34.66***                  \\
Depriciation               
    & 2200 & 0.0304  & 0.0254 & 1764 & 0.0324  & 0.0275  & 436 
        & 0.0227  & 0.0156  & 0.0097***  & 0.0119***                \\
Return on assets           
    & 2388 & 0.0196   & 0.0358 & 1831 & 0.0318 & 0.0359  & 557 
        & 0.0198  & 0.0352  & 0.0120***  & 0.0007                \\
se  & 2342 & 0.2164   & 0.1629 & 1794 & 0.0196  & 0.1546  & 548 
        & 0.2843  & 0.1952  & -0.0886*** & -0.0406***            \\
    \bottomrule
\end{tabular}
    \end{table}
\end{landscape}
    \end{document}

这使:

在此处输入图片描述

这样就解决了您的一些问题。如果需要,MWE 现在可以进一步改进您的表格。例如,使用包S中的列siuntx来更好地对齐列中的数字,makecell使用宏来获得更好的列标题thead等。

如您所见,我省略了表格的缩放(我不知道是否真的有必要),用begin{center} ... \end{center}替换centering

答案3

除了清理指令的使用之外\multicolumn,您还应该认真考虑使用一个工具(在下面的代码中,我建议使用包dcolumn)来将数字列中的数字对齐到各自的小数点标记上。我还建议您使用包booktabs及其线条绘制宏\toprule\cmidrule\midrule\bottomrule

在此处输入图片描述

\documentclass{article}
\usepackage{rotating,booktabs,dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{@{}c@{}}{#1}} % handy shortcut macro
\begin{document}
\begin{sidewaystable}
\renewcommand\thetable{A\arabic{table}}
\caption{Univariate comparison of derivatives users and non-users} 
\label{tab:A1}

{\footnotesize This table provides mean and median}

\medskip
\centering
\begin{tabular}{@{} l *{3}{d{4.0}d{2.4}d{2.4}} *{2}{d{2.7}} @{}}
\toprule
 Variables 
& \multicolumn{3}{c}{All firms} 
& \multicolumn{3}{c}{Derivatives users} 
& \multicolumn{3}{c}{Derivatives non-users}
& \multicolumn{2}{c}{Difference tests} \\
\cmidrule(lr){2-4}
\cmidrule(lr){5-7}
\cmidrule(lr){8-10}
\cmidrule(l){11-12}
& \mc{$N$} & \mc{Mean} & \mc{Median} & \mc{$N$} & \mc{Mean} & \mc{Median} 
& \mc{$N$} & \mc{Mean} & \mc{Median} & \mc{Mean} & \mc{Median} \\
& & & & & & & & & & \mc{t-test} & \mc{Wilcoxon test} \\
\midrule
I                & 8 & 0.0315   & 04 &  31 & 0.0456  & 28  &  557 & -0.014  & -0.0131 &  0.0596^{***}  & 0.0359^{***}     \\
B                & 2388 & 0.6485   & 0.5405 &  11 & 077  & 0.5495  &  557 & 34  & 0.5076  &  -0.0457    & 0.0419^{***}     \\
E                & 2388 & 4.3319   & 4.1561 &  1831 & 4.5264  & 11  &  557 & 3.7036  & 3.519   &  0.8288^{***}  & 0.8621^{***}     \\
S                & 2388 & 12.8891  & 12.516 &  1831 & 13.4206 & \mc{1301245} &  557 & 11.1725 & 11.1486 &  2.2481^{***}  & 1.9759^{***}     \\
N                & 2388 & 3.10 & 3      &  1831 & 3.2501  & 3       &  557 & 2.6014  & 2       &  0.6487^{***}  & 1.^{***}          \\
tio              & 2065 & 0.3366   & 0.0037 &  1661 & 0.3057  & 0.005   &  404 & 0.4634  & 0.0002  &  -0.1577    & 0.0048        \\
les to net sales & 2170 & 40.2858  & 41.32  &  1750 & 44.1013 & 46.94   &  420 & 24.3878 & 12.28   &  19.7135^{***} & 34.66^{***}      \\
Depreciation     & 2200 & 0.0304   & 0.0254 &  1764 & 0.0324  & 0.0275  &  436 & 0.0227  & 0.0156  &  0.0097^{***}  & 0.0119^{***}     \\
Return on assets & 2388 & 0.0196   & 0.0358 &  1831 & 0.0318  & 0.0359  &  557 & 0.0198  & 0.0352  &  0.0120^{***}  & 0.0007        \\
se               & 2342 & 0.2164   & 0.1629 &  1794 & 0.0196  & 0.1546  &  548 & 0.2843  & 0.1952  &  -0.0886^{***} & -0.0406^{***}   \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}

答案4

这里有一个包含相当多包的解决方案:booktabs, caption, makecell, threeparttable, siunitx,……也许你应该检查一些数字。

\documentclass{article}
\usepackage{geometry}
\usepackage{lscape}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{array, booktabs, caption, threeparttable, makecell}
\DeclareCaptionFormat{break}{#1\smallskip\par#3}
\captionsetup{font=bf, format=break}


\begin{document}

\begin{landscape}
  \begin{table}[!htb]
    \centering\setlength\tabcolsep{4pt}
    \renewcommand\arraystretch{1.25}
    \renewcommand\thetable{A1}
    \begin{threeparttable}
      \caption{Univariate Comparison of Derivatives Users and Non-users}
      \label{Table A1}
      %\scalebox{0.92}{
      \begin{tabular}{@{}l*{2}{S[table-format=4.0]S[table-format=2.4]S[table-format=2.4]@{\quad}} S[table-format=3.0] S[table-format=2.4] S[table-format=-1.4] @{\quad}*{2}{@{\enspace}S[table-format=-1.4, table-space-text-post={***}]}@{}}
        \toprule
        & \multicolumn{3}{c}{All firms} &\multicolumn{3}{c}{Derivatives users} &\multicolumn{3}{c}{Derivatives non-users}& \multicolumn{2}{c}{Difference tests} \\
        Variables & {N} & {Mean} & {Median} & {N} & {Mean} & {Median} & {N} & {Mean} & {Median} & {\makecell{Mean & \\t-test}} & {\makecell{Median\\Wilcoxon test}} \\
        \cmidrule(r){2-4}
        \cmidrule(r){5-7}
        \cmidrule(r){8-10}
        \cmidrule{11-12}
        I & 8 & 0.0315 & 04 & 31 & 0.0456 & 28 & 557 & -0.014 & -0.0131 & 0.0596*** & 0.0359*** \\
        B & 2388 & 0.6485 & 0.5405 & 11 & 077 & 0.5495 & 557 & 34 & 0.5076 & -0.0457 & 0.0419*** \\
        E & 2388 & 4.3319 & 4.1561 & 1831 & 4.5264 & 11 & 557 & 3.7036 & 3.519 & 0.8288*** & 0.8621*** \\
        S & 2388 & 12.8891 & 12.516 & 1831 & 13.4206 & 13.01245 & 557 & 11.1725 & 11.1486 & 2.2481*** & 1.9759*** \\
        N & 2388 & 3.10e0 & 3 & 1831 & 3.2501 & 3 & 557 & 2.6014 & 2 & 0.6487*** & 1*** \\
        tio & 2065 & 0.3366 & 0.0037 & 1661 & 0.3057 & 0.005 & 404 & 0.4634 & 0.0002 & -0.1577 & 0.0048 \\
        les to net sales & 2170 & 40.2858 & 41.32 & 1750 & 44.1013 & 46.94 & 420 & 24.3878 & 12.28 & 19.7135*** & 34.66*** \\
        Depreciation & 2200 & 0.0304 & 0.0254 & 1764 & 0.0324 & 0.0275 & 436 & 0.0227 & 0.0156 & 0.0097*** & 0.0119*** \\
        Return on assets & 2388 & 0.0196 & 0.0358 & 1831 & 0.0318 & 0.0359 & 557 & 0.0198 & 0.0352 & 0.0120*** & 0.0007 \\
        se & 2342 & 0.2164 & 0.1629 & 1794 & 0.0196 & 0.1546 & 548 & 0.2843 & 0.1952 & -0.0886*** & -0.0406*** \\
        \bottomrule
      \end{tabular}
      \begin{tablenotes}\footnotesize\medskip\centering
        \item[] This table provide mean and median.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{landscape}

\end{document} 

在此处输入图片描述

相关内容