创建具有多行和多列的表格

创建具有多行和多列的表格

我怎样才能在乳胶中得到如下图所示的表格?

在此处输入图片描述

这是我使用的代码

\documentclass[final,1p,times,authoryear]{elsarticle}

\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularx} 
\usepackage{amsmath}%
\begin{document}
\begin{table}[h]
  \caption{Augmented DickeyFuller and KPSS Test Statistics for (Transformed) Sectoral Indices(y)}
    \label{tab:Augmented DickeyFuller and KPSS Test Statistics for (Transformed) Sectoral Indices(y)}
    \renewcommand{\arraystretch}{1.2}
         \renewcommand*\TPTnoteLabel[1]{\parbox[b]{3em}{\hfill#1\,}}
          \begin{adjustbox}{max width=\textwidth}
    \centering 
        \begin{tabular}{l c c c c c c}
        \hline
        &&&\multicolumn{3}{c}{}\\ \cline{2-3}
         \textit{ }  \textbf{variables}& \textbf{Levin, Lin and Chu (LLC)}& \textbf{ADF-Fisher chi-square }\\
        \hline
         \cline{1-2}
        \textbf{Banking-industry specific variables}& &&&&& \\
                &&\\
        \hline
        Log of Loans-to-Assets&-2.14&151.23&&&& \\
                &\textit{(0.05)}&\textit{(0.02)}\\
        \hline
         Log of Credit quality&-0.486&144.13&&&& \\
                &\textit{(0.04)}&\textit{(0.01)}\\
        \hline
       Log of Diversification& 2.441&112.23&&&& \\
                &\textit{(0.02)}&\textit{(0.04)}\\
        \hline
        Log of Return on Assets&-3.235&1.140\\
                &\textit{(0.01)}&\textit{(0.03)}\\
        \hline
        \textbf{Macroeconomic variables}&Fisher-ADF&&&&&\\
          &&\\
        \hline
       Real GDP growth&-1.66&&&&&\\
                 &\textit{(0.048)}&\\
                \hline
                \Delta infl (inflation)&-4.62&&&&&\\
                 &\textit{(0.145)}&\\
        \hline
                \Delta Ur (unemployment rate)&-1.45&&&&&\\
                 &\textit{(0.014)}&\\
                \hline
                Exchange rate &-0.76&&&&&\\
                 &\textit{(0.042)}&\\
                 \hline
        \textbf{Household-level indicators}&Fisher-ADF&&&&&\\
                &&\\
                \hline
       Income&1.30&&&&&\\
                 &\textit{(0.001)}&\\
                \hline
                Family size&-1.07&&&&&\\
                 &\textit{(0.007)}&\\
        \hline
                Age&-3.02&&&&&\\
                 &\textit{(0.002)}&\\
                \hline
                Education &-1.91&&&&&\\
                 &\textit{(0.000))}&\\
                 \hline
    \end{tabular}
        \end{adjustbox}
\end{table}
\end{document}

答案1

我会按照以下形式重新设计您的表格:

在此处输入图片描述

(红线表示文字边框)

在您的文档中我添加了包booktabsmakecell和。tabularxsiunitx

\documentclass[final,1p,times,authoryear]{elsarticle}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx}%

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}[h]
    \centering
\caption{Augmented Dickey Fuller and KPSS Test Statistics for (Transformed) Sectoral Indices (y)}
\label{tab:statistics}
\renewcommand{\arraystretch}{1.2}
\sisetup{input-symbols={( - )},
         table-space-text-pre={(},
         table-space-text-post ={)},
         }
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                            l
                       *{2}{S[table-format=-1.3]
                            @{\hspace{-1em}}
                             S[table-format=1.2]}
                                }
    \toprule
\thead[l]{variables\\Banking-industry specific variables}
    &   \multicolumn{2}{c}{\thead{Levin, Lin and\\ Chu (LLC)}}
        &   \multicolumn{2}{c}{\thead{ADF-Fisher\\ chi-square}}    \\
     \cmidrule(r){1-1}\cmidrule(r){2-3}\cmidrule{4-5}
Log of Loans-to-Assets  &-2.14  & (0.05)    & 151.23    & (0.02)    \\
Log of Credit quality   &-0.486 & (0.04)    & 144.13    & (0.01)    \\
Log of Diversification  & 2.441 & (0.02)    & 112.23    & (0.04)    \\
Log of Return on Assets &-3.235 & (0.01)    & 1.140     & (0.03)    \\
    \midrule
\textbf{Macroeconomic variables}
                        &       &           &
                                    \multicolumn{2}{c}{Fisher-ADF}  \\
    \midrule
Real GDP growth         &       &           & -1.66     & (0.048)   \\
$\Delta$ infl (inflation)
                        &       &           & -4.62     & (0.145)   \\
$\Delta$ Ur (unemployment rate)
                        &       &           & -1.45     & (0.014)   \\
Exchange rate           &       &           & -0.76     & (0.042)   \\
    \midrule
\textbf{Household-level indicators}
                        &       &           &
                                    \multicolumn{2}{c}{Fisher-ADF}  \\
    \midrule
Income                  &       &           & 1.30      & (0.001)   \\
Family size             &       &           & -1.07     & (0.007)   \\
Age                     &       &           & -3.02     & (0.002)   \\
Education               &       &           & -1.91     & (0.000)   \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{document}

关于桌子的设计值得一看哪些表格是真实存在的:-)。

相关内容