表格多行多列

表格多行多列

我对这个表格有一个问题:我需要合并 3 列,但我不知道底部需要多少行才能形成一个包含很长的最终文本的唯一单元格。我这样做了,但不起作用。此外,如果可能的话,我更希望用粗线来代替 2 个 \hline。

\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{3}{|c|}{Table1}\\ 
\hline
 & $Y_i_t$ & $I_i_t$\\
 \hline
 \hline
  $Turnout_i_t&-7.02**$&$-0.001***$\\
 \hline
 & (3.025) & (0.000)\\
 \hline
 Compulsory voting dummy_i&$-1865.053***$&-0.490\\
 \hline
  &(279.417)&(0.632)\\
\hline
Net exports_i_t&0&0\\
\hline
&(0.000)&(0.000)\\
\hline
Urban population_i_t&0&\\
\hline
&(0.000)&\\
\hline
Net oda received_i_t&$-4.513**$&\\
\hline
&(1.902)&\\
\hline
gini_i_t&$-14.456**$&\\
\hline
&(6.10)&\\
\hline
\alpha_i&yes&yes\\
\hline
\gamma_t&yes&yes\\
\hline
constant &yes**&yes**\\
\hline
\hline
N&164&164\\
\hline
T&21&21
\hline
R^2 within country&0.54&0.5\\
\hline
\rho (Fraction of \sigma_e due to \alpha_i)&0.920&0.815\\
\hline
\hline
\\multicolumn{3}{|l|}{\multirow{3}{*}{The displayed standard errors are robust and clustered at country level. Level of statistical significance of coefficients:***$(1%), **(5%), *(10%)$}}
\hline
\end{tabular}
\end{center}

答案1

我怀疑你喜欢获得如下所示的表格:

enter image description here

(红线表示页面布局)。由于您没有提供最小的工作示例(一个以 开头但完整的文档,以\documentclass{...}结尾\end{document}),因此我很有可能误解了您的代码。差异可能还在于对表格美观的感知……

我的 mwe 中的表体是:

编辑:显然 op 对帮助我完成/采纳我对他/她的文档的回答不感兴趣……

无论如何,对于任何可能对完整 mwe 感兴趣的人来说,它会生成上面显示的表格:

\documentclass[11pt,a4paper]{article}
\usepackage{array, booktabs}
\usepackage[referable]{threeparttablex}
\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}
    \centering
    \sisetup{input-symbols = ( - ),
              table-space-text-pre=(,
              table-space-text-post = ***,
              table-align-text-post=false,
              group-four-digits,
              table-format=-4.3}
    \renewcommand\arraystretch{0.8}
\begin{threeparttable}
    \caption{Table 1}
    \label{tab: my important table}
\begin{tabular}{r
                S[table-format=-4.3] 
                S[table-format=-1.3]
                }
    \toprule
                & {$Y_{i_t}$}           & {$I_{i_t}$}       \\
    \midrule
Turnout $i_t$   & -7.02\tnote{**}       & -0.001\tnote{***} \\
                & (3.025)               & (0.000)           \\
    \addlinespace
Compulsory voting dummy $i$
                & -1865.053\tnote{***}  &-0.490             \\
                & (279.417)             & (0.632)           \\
    \addlinespace
Net exports $i_t$
                &   0                   &   0               \\
                & (0.000)               & (0.000)           \\
    \addlinespace
Urban population $i_t$
                &   0                   &                   \\
                & (0.000)               &                   \\
    \addlinespace
Net oda received $i_t$
                & -4.513\tnote{**}      &                   \\
                & (1.902)               &                   \\
    \addlinespace
gini $i_t$      & -14.456\tnote{**}     &                   \\
                & (6.10)                &                   \\
    \addlinespace
$\alpha_i$      &   {yes}               &   {yes}           \\
$\gamma_t$      &   {yes}               &   {yes}           \\
constant        &   {yes\tnote{**}}     &   {yes\tnote{**}} \\
    \midrule
N               &   {164}               &   {164}           \\
T               &   {21}                &   {21}            \\
    \midrule
$R^2$ within country
                & 0.54                  & 0.5               \\
$\rho$ (Fraction of $\sigma_e$ due to $\alpha_i)$
                & 0.920                 & 0.815             \\
\midrule
\end{tabular}
\begin{tablenotes}[flushleft, para]\footnotesize
\note
The displayed standard errors are robust and clustered at country level. Level of statistical significance of coefficients:
\item[***]  (\SI{1}{\%}),
\item[**]   (\SI{5}{\%}),
\item[*]    (\SI{10}{\%})
\end{tablenotes}
\end{threeparttable}
    \end{table}

From table \ref{tab: my important table} follows \dots
\end{document}
  • 该包siunitx用于S列,其中数字按小数点对齐
  • 对于水平线,使用包中定义的规则booktabs。规则的厚度,如果默认值不符合您的预期,可以更改,例如\toprule[2pt]\midrule[2pt]
  • 用于表格注释threeparttablex,可以在表格宽度、\note表格下方写标题以及表格中的 s 描述\tnote(用于和 的数值的统计**意义***

相关内容