长表中的水平和垂直标题

长表中的水平和垂直标题

这是我的 Stata 代码的输出。我的表格有两个主要问题。首先,我想包含水平垂直标题,就像所需图片中那样;其次,我想让我的长表格与纸张边距相配

我的代码:

   \documentclass[12pt]{article}
\usepackage[a4paper,
        hmargin=15mm, vmargin={1cm,2cm}]{geometry}
 \usepackage[USenglish]{babel}
\usepackage{microtype}
 \usepackage[hang, font=small, 
        labelfont=bf,textfont=it]{caption}
\usepackage{tabularray}
 \UseTblrLibrary{booktabs, siunitx}



\begin{document}


 \begin{table}[htbp]\centering
 \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Table4\_PUSH\_PULL\_FACTORS\_FULL\_CONTROLS}
\begin{tabular}{l*{12}{c}}
\hline\hline
            &\multicolumn{1}{c}{(1)}         &\multicolumn{1}{c}{(2)}         &\multicolumn{1}{c}{(3)}         &\multicolumn{1}{c}{(4)}         &\multicolumn{1}{c}{(5)}         &\multicolumn{1}{c}{(6)}         &\multicolumn{1}{c}{(7)}         &\multicolumn{1}{c}{(8)}         &\multicolumn{1}{c}{(9)}         &\multicolumn{1}{c}{(10)}         &\multicolumn{1}{c}{(11)}         &\multicolumn{1}{c}{(12)}         \\
\hline

ONE BELT, ONE ROAD POSITION&    0.819\sym{*}  &    0.528         &    1.025\sym{*}  &    0.466         &    0.305         &    0.349         &    0.804\sym{***}&    0.699\sym{**} &    0.627         &    0.680\sym{**} &    0.574\sym{*}  &    0.644\sym{**} \\
            &   (1.95)         &   (1.32)         &   (1.85)         &   (1.19)         &   (0.82)         &   (0.93)         &   (2.66)         &   (2.38)         &   (1.62)         &   (2.33)         &   (1.94)         &   (2.15)         \\
[1em]
FTA WITH CHINA  &    0.379         &    0.434         &   -0.256         &    0.387         &    0.470         &    0.395         &    0.491         &    0.536\sym{*}  &    0.127         &    0.499         &    0.514\sym{*}  &    0.514\sym{*}  \\
            &   (0.98)         &   (1.18)         &  (-0.48)         &   (1.04)         &   (1.24)         &   (1.09)         &   (1.61)         &   (1.70)         &   (0.33)         &   (1.62)         &   (1.78)         &   (1.71)         \\
[1em]
BIT WITH CHINA  &    1.061\sym{**} &    1.140\sym{***}&    0.000         &    1.189\sym{***}&    1.183\sym{***}&    1.138\sym{***}&    0.918\sym{***}&    0.957\sym{***}&    1.691\sym{***}&    0.980\sym{***}&    0.997\sym{***}&    0.953\sym{***}\\
            &   (2.49)         &   (2.72)         &      (.)         &   (2.84)         &   (2.98)         &   (2.88)         &   (2.88)         &   (3.03)         &   (3.58)         &   (3.20)         &   (3.29)         &   (3.19)         \\
[1em]
FINANCIAL CRISES&    0.087\sym{***}&                  &                  &                  &                  &                  &    0.050\sym{***}&                  &                  &                  &                  &                  \\
            &   (3.54)         &                  &                  &                  &                  &                  &   (2.67)         &                  &                  &                  &                  &                  \\
 [1em]
IDEAL POINT DISTANCE FROM CHINA&   -0.616\sym{*}  &   -0.419         &   -0.735\sym{*}  &   -0.427         &   -0.363         &   -0.363         &   -0.204         &   -0.162         &   -0.329         &   -0.181         &   -0.178         &   -0.212         \\
            &  (-1.95)         &  (-1.53)         &  (-1.86)         &  (-1.47)         &  (-1.32)         &  (-1.36)         &  (-0.97)         &  (-0.76)         &  (-1.18)         &  (-0.89)         &  (-0.88)         &  (-1.06)         \\
[1em]
 REGIME TYPE     &   -0.016         &    0.013         &    0.131\sym{**} &    0.008         &    0.027         &    0.023         &   -0.008         &    0.006         &    0.030         &   -0.000         &    0.017         &    0.014         \\
            &  (-0.49)         &   (0.46)         &   (2.30)         &   (0.28)         &   (0.97)         &   (0.80)         &  (-0.28)         &   (0.25)         &   (0.71)         &  (-0.00)         &   (0.65)         &   (0.55)         \\
 [1em]
 LEADER IDEOLOGY &   -0.127         &   -0.098         &   -0.009         &   -0.025         &   -0.073         &   -0.072         &   -0.121         &   -0.110         &   -0.153         &   -0.087         &   -0.117         &   -0.112         \\
            &  (-1.06)         &  (-0.88)         &  (-0.05)         &  (-0.22)         &  (-0.69)         &  (-0.68)         &  (-1.26)         &  (-1.15)         &  (-1.06)         &  (-0.90)         &  (-1.24)         &  (-1.19)         \\
[1em]
AFRICA DUMMY    &   -1.140\sym{**} &   -0.965\sym{*}  &    0.000         &   -0.886\sym{*}  &   -1.061\sym{**} &   -1.023\sym{**} &   -0.893\sym{**} &   -0.827\sym{**} &   -1.426\sym{**} &   -0.791\sym{*}  &   -0.979\sym{**} &   -0.918\sym{**} \\
            &  (-2.10)         &  (-1.89)         &      (.)         &  (-1.69)         &  (-2.13)         &  (-2.05)         &  (-2.26)         &  (-2.05)         &  (-2.33)         &  (-1.94)         &  (-2.50)         &  (-2.34)         \\
 [1em]
 GDP GROWTH      &    0.013         &    0.001         &   -0.049         &    0.010         &    0.008         &    0.007         &   -0.000         &   -0.007         &   -0.015         &   -0.001         &   -0.001         &   -0.001         \\
            &   (0.57)         &   (0.04)         &  (-1.40)         &   (0.45)         &   (0.35)         &   (0.32)         &  (-0.01)         &  (-0.37)         &  (-0.63)         &  (-0.09)         &  (-0.07)         &  (-0.08)         \\
 [1em]
GDP             &   -0.000         &    0.000\sym{**} &   -0.000         &    0.000         &    0.000\sym{*}  &    0.000         &   -0.000         &    0.000         &   -0.000         &    0.000         &    0.000         &    0.000         \\
            &  (-0.10)         &   (2.30)         &  (-0.49)         &   (1.27)         &   (1.65)         &   (0.48)         &  (-0.29)         &   (0.62)         &  (-0.14)         &   (0.27)         &   (0.31)         &   (0.40)         \\
  [1em]
   LOG GDPPC       &   -0.201         &   -0.228\sym{*}  &    0.269         &   -0.144         &   -0.149         &   -0.178         &   -0.057         &   -0.005         &    0.134         &    0.021         &    0.005         &   -0.030         \\
            &  (-1.13)         &  (-1.66)         &   (1.13)         &  (-1.02)         &  (-1.08)         &  (-1.29)         &  (-0.43)         &  (-0.04)         &   (0.69)         &   (0.17)         &   (0.05)         &  (-0.25)         \\
[1em]
 CIRI HUMAN RIGHTS INDEX&    0.105         &   -0.019         &   -0.317\sym{**} &    0.006         &   -0.080         &   -0.066         &    0.023         &   -0.042         &   -0.126         &   -0.011         &   -0.085         &   -0.072         \\
            &   (0.81)         &  (-0.19)         &  (-2.18)         &   (0.06)         &  (-0.89)         &  (-0.72)         &   (0.27)         &  (-0.56)         &  (-1.08)         &  (-0.14)         &  (-1.20)         &  (-1.01)         \\
[1em]
 VARIABILITY OF CAPITAL ACCOUNT POLICY&                  &    3.567\sym{***}&                  &                  &                  &                  &                  &    2.567\sym{***}&                  &                  &                  &                  \\
            &                  &   (2.71)         &                  &                  &                  &                  &                  &   (2.82)         &                  &                  &                  &                  \\
  [1em]
  VOLATILITY OF PORTFOLIO OUTFLOWS&                  &                  &    0.367\sym{***}&                  &                  &                  &                  &                  &    0.234         &                  &                  &                  \\
            &                  &                  &   (2.73)         &                  &                  &                  &                  &                  &   (1.62)         &                  &                  &                  \\
[1em]
 SOCIAL UNREST DURING IMF PROGRAMS&                  &                  &                  &    0.011\sym{**} &                  &                  &                  &                  &                  &    0.011\sym{**} &                  &                  \\
            &                  &                  &                  &   (2.02)         &                  &                  &                  &                  &                  &   (2.39)         &                  &                  \\
 [1em]
 WTO COMPLAINTS AGAINST THE U.S.&                  &                  &                  &                  &   -0.064         &                  &                  &                  &                  &                  &   -0.034         &                  \\
            &                  &                  &                  &                  &  (-0.93)         &                  &                  &                  &                  &                  &  (-0.70)         &                  \\
[1em]
IMF GOVERNANCE DEFICIT&                  &                  &                  &                  &                  &    0.062         &                  &                  &                  &                  &                  &    0.321         \\
            &                  &                  &                  &                  &                  &   (0.22)         &                  &                  &                  &                  &                  &   (1.26)         \\
       [1em]
         Constant        &   -0.532         &   -0.164         &   -2.045         &   -0.697         &    0.052         &    0.229         &                  &                  &                  &                  &                  &                  \\
            &  (-0.41)         &  (-0.15)         &  (-1.02)         &  (-0.58)         &   (0.05)         &   (0.22)         &                  &                  &                  &                  &                  &                  \\
          \hline
     /               &                  &                  &                  &                  
 &                  
   &                  &                  &                  &                  &                  &                  
 &                  \\
            cut1            &                  &                  &                  &                  
   &                  &                  &    0.273         &    0.662         &    1.580         
  &    0.828         &    0.106         &   -0.080         \\
              &                  &                  &                  &                  &                  
  &                         &   (0.26)         &   (0.64)         &   (1.01)         &   (0.77)         &   (0.11)         &  (-0.08)         \\
     [1em]
      cut2            &                  &                  &                  &                  &                  &                  &    1.454         &    1.944\sym{*}  &    2.940\sym{*}  &    2.112\sym{*}  &    1.353         &    1.171         \\
            &                  &                  &                  &                  &                  
  &                  &   (1.39)         &   (1.85)         &   (1.88)         &   (1.95)         &   (1.41)         &   (1.22)         \\
            \hline
            Observations    &      144         &      149         &       63         &      153         &      153         &      151         &      142         &      146         &       82         &      150         &      150         &      148         \\
 Pseudo \(R^{2}\)&    0.346         &    0.299         &    0.244         &    0.293         &    0.268         &    0.260         &    0.259         &    0.260         &    0.215         &    0.262         &    0.244         &    0.243         \\
\hline\hline
  \multicolumn{13}{l}{\footnotesize \textit{t} statistics in parentheses}\\
  \multicolumn{13}{l}{\footnotesize \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
 \end{tabular}
 \end{table}
 \end{document}

所需表格:

在此处输入图片描述

在此处输入图片描述

答案1

您的表格太大了,无法放在一页上,并且表格中的字体大小难以辨认。解决方案是将横向的长表格分成两页。

无关:

  • 通过使用tabularray(您已经加载)表格代码更简单
  • 我将使用S列类型(在siunitx由同名的 TblrLibrary 加载的包中定义)来表示带有数字的列,

编辑(1):

  • 为了使第一列中的文本更窄并且使其在单元格中分成最多两行,我会将此列中的字体更改为\scshape
  • 在第一列单元格中,文本分成两行,我将手动设置多行单元格\SetCell[r=2]{l} text in cell

编辑(2):

  • 添加了“出勤”和“有序出勤”标题行
  • 在阴影行中添加了中间表格标题
\documentclass[12pt]{article}
\usepackage[a4paper,
        hmargin=15mm, vmargin={1cm,2cm}]{geometry}
\usepackage[USenglish]{babel}
\usepackage{microtype}

\usepackage{pdflscape}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{xcolor}
\usepackage{tabularray}
    \UseTblrLibrary{booktabs, siunitx}
\ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {6}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff


\begin{document}
    \begin{landscape}
    \small
\sisetup{
    input-open-uncertainty =,
    input-close-uncertainty=,
    table-align-text-after=false,
    table-align-text-before=false,
    table-format={(}-1.3{**}
        }

\begin{longtblr}[
caption = {Push and pull factors \dots},
 note{} = {Standard errors in parentheses:\newline
          *:    $p<0.10$,\quad
          **:   $p<0.05$,\quad
          ***:  $p<0.01$.},
                ]{
    rowhead= 2,
    colsep = 2pt,
    colspec= {@{} X[l,h, font=\scshape\linespread{0.84}\selectfont]
                  *{12}{S}
              @{}},
    row{1} = {font=\small\bfseries},
    row{4-Z} = {rowsep = 0pt},
    row{eachtwo} = {abovesep=1ex},
                 }
    \toprule
\SetCell[r=2]{c}
    &   \SetCell[c=6]{c}
        {{{DV= ATTENDANCE (probit)}}}  
        &   &   &   &   &   &   \SetCell[c=6]{c}
                                {{{DV = ORDERED ATTENDANCE (ordered probit)}}} % 
                                &   &   &   &   &           \\
    \cmidrule[0.6pt, r]{2-7}
    \cmidrule[0.6pt, l]{8-13}
    &{{{(1)}}}  &{{{(2)}}}  &{{{(3)}}}  &{{{(4)}}}  &{{{(5)}}}  &{{{(6)}}}
    &{{{(7)}}}  &{{{(8)}}}  &{{{(9)}}}  &{{{(10)}}} &{{{(11)}}} &{{{(12)}}} \\
    \midrule
%%%%
\SetCell[c=13]{c, font=\itshape, bg=gray8}    Pull Factors
    &   &   &   &   &   &   &   &   &   &   &   &            \\
%%%%
\SetCell[r=2]{l}    One belt, one road position
    & 0.819\TblrNote{*}
            & 0.528 & 1.025\TblrNote{*}
                            & 0.466 & 0.305 & 0.349
    & 0.804\TblrNote{***}
            & 0.699\TblrNote{**}
                    & 0.627 & 0.680\TblrNote{**}
                                    & 0.574\TblrNote{*}
                                            & 0.644\TblrNote{**}    \\
    &(1.95) &(1.32) &(1.85) &(1.19) &(0.82) &(0.93)
    &(2.66) &(2.38) &(1.62) &(2.33) &(1.94) &(2.15)                 \\
\SetCell[r=2]{l}    FTA with China
    & 0.379 & 0.434 &-0.256 & 0.387 & 0.470 & 0.395
    & 0.491 & 0.536\TblrNote{*}
                    & 0.127 & 0.499 & 0.514\TblrNote{*}
                                            & 0.514\TblrNote{*}     \\
    &(1.95) &(1.32) &(1.85) &(1.19) &(0.82) &(0.93)
    &(2.66) &(2.38) &(1.62) &(2.33) &(1.94) &(2.15)                 \\
\SetCell[r=2]{l}    BIT with China
    & 1.061\TblrNote{**}
            &1.140\TblrNote{***}
                    & 0.000 & 1.189\TblrNote{***}
                                    & 1.183\TblrNote{***}
                                            & 1.138\TblrNote{***}
    & 0.918\TblrNote{***}
            & 0.957\TblrNote{***}
                    & 1.691\TblrNote{***}
                            & 0.980\TblrNote{***}
                                    & 0.997\TblrNote{***}
                                            & 0.953\TblrNote{***}   \\
    &(2.49) &(2.72) &(0.0)  &(2.84) &(2.98) &(2.88)
    &(2.88) &(3.03) &(3.58) &(3.20) &(3.29) &(3.19)                 \\
%%%%%
    \midrule
\SetCell[r=2,c=13]{c, font=\itshape, bg=gray8}    Push Factors 
    &   &   &   &   &   &   &   &   &   &   &   \\
    &   &   &   &   &   &   &   &   &   &   &   \\
%%%%%
Financial crises
    & 0.087\TblrNote{***}
            &       &       &       &       &
    & 0.050\TblrNote{***}
            &       &       &       &       &                       \\
    &(3.54) &       &       &       &       &
    &(2.67) &       &       &       &       &                       \\
\SetCell[r=2]{l}    Variability of capital account policy
    &       & 3.567\TblrNote{***}
                    &       &       &       &
    &       & 2.567\TblrNote{***}
                    &       &       &       &                               \\
    &       &(2.71) &       &       &       &
    &       &(2.82) &       &       &       &                               \\
    
\SetCell[r=2]{l}    Volatility of portfolio outflows
    &       &       & 0.367\TblrNote{***}
                            &       &       &
    &       &       & 0.234 &       &       &                               \\
    &       &       &(2.73) &       &       &
    &       &       &(1.62) &       &       &                               \\
\SetCell[r=2]{l}    Social unrest during IMF programs
    &       &       &       & 0.011\TblrNote{**}
                                    &       &
    &       &       &       & 0.011\TblrNote{**}
                                    &       &                               \\
    &       &       &       &(2.02) &       &
    &       &       &       &(2.39) &       &                               \\
\SetCell[r=2]{l}    WTO complaints against the U.S.
    &       &       &       &       &-0.064 &
    &       &       &       &       &-0.034 &                               \\
    &       &       &       &       &(-0.93)&
    &       &       &       &       &(-0.70)&                               \\
\SetCell[r=2]{l}    IMF governance deficit
    &       &       &       &       &       & 0.062
    &       &       &       &       &       & 0.321                         \\
    &       &       &       &       &       &(0.22)
    &       &       &       &       &       &(1.26)                         \\
%%%%%
    \midrule
\SetCell[c=13]{c, font=\itshape, bg=gray8}    Controls
    &   &   &   &   &   &   &   &   &   &   &   \\
%%%%%
\SetCell[r=2]{l}    Ideal point distance from China
    & -0.616\TblrNote{*}
            &-0.419 & -0.735\TblrNote{*}
                            &-0.427 &-0.363 &-0.363
    &-0.204 &-0.162 &-0.329 &-0.181 &-0.178 &-0.212                 \\
    &(-1.95)&(-1.53)&(-1.86)&(-1.47)&(-1.32)&(-1.36)
    &(-0.97)&(-0.76)&(-1.18)&(-0.89)&(-0.88)&(-1.06)                \\
\SetCell[r=2]{l}    Regime type
    &-0.016 & 0.013 & 0.131\TblrNote{**}
                            & 0.008 & 0.027 & 0.023
    &-0.008 & 0.006 & 0.030 &-0.000 & 0.017 & 0.014                 \\
    &(-0.49)&(0.46) &(2.30) &(0.28) &(0.97) &(0.80)
    &(-0.28)&(0.25) &(0.71) &(-0.00)&(0.65) &(0.55)                 \\
\SetCell[r=2]{l}    Leader ideology
    &-0.127 &-0.098 &-0.009 &-0.025 &-0.073 &-0.072
    &-0.121 &-0.110 &-0.153 &-0.087 &-0.117 &-0.112                 \\
    &(-1.06)&(-0.88)&(-0.05)&(-0.22)&(-0.69)&(-0.68)
    &(-1.26)&(-1.15)&(-1.06)&(-0.90)&(-1.24)&(-1.19)                \\
\SetCell[r=2]{l}    Africa dummy
    & -1.140\TblrNote{**}
            & -0.965\TblrNote{*}
                    & 0.000 & -0.886\TblrNote{*}
                                    & -1.061\TblrNote{**}
                                            & -1.023\TblrNote{**}
    & -0.893\TblrNote{**}
            & -0.827\TblrNote{**}
                    & -1.426\TblrNote{**}
                            & -0.791\TblrNote{*}
                                    & -0.979\TblrNote{**}
                                            & -0.918\TblrNote{**}   \\
    &(-2.10)&(-1.89)& (.)   &(-1.69)&(-2.13)&(-2.05)
    &(-2.26)&(-2.05)&(-2.33)&(-1.94)&(-2.50)&(-2.34)                \\
\SetCell[r=2]{l}    GDP growth
    & 0.013 & 0.001 &-0.049 & 0.010 & 0.008 & 0.007
    &-0.000 &-0.007 &-0.015 &-0.001 &-0.001 &-0.001         \\
    &(0.57) &(0.04) &(-1.40)&(0.45) &(0.35) &(0.32)
    &(-0.01)&(-0.37)&(-0.63)&(-0.09)&(-0.07)&(-0.08)        \\
\SetCell[r=2]{l}    GDP &-0.000 & 0.000\TblrNote{**}
                    &-0.000 & 0.000 & 0.000\TblrNote{*}
                                            & 0.000
    &-0.000 & 0.000 &-0.000 & 0.000 & 0.000 &    0.000                      \\
    &(-0.10)&(2.30) &(-0.49)&(1.27) &(1.65) &(0.48)
    &(-0.29)&(0.62) &(-0.14)&(0.27) &(0.31) &(0.40)                         \\
\SetCell[r=2]{l}    LOG GDPPC
    &-0.201 &-0.228\TblrNote{*}
                    & 0.269 &-0.144 &-0.149 &-0.178
    &-0.057 &-0.005 & 0.134 & 0.021 & 0.005 &-0.030                         \\
    &(-1.13)&(-1.66)&(1.13) &(-1.02)&(-1.08)&(-1.29)
    &(-0.43)&(-0.04)&(0.69) &(0.17) &(0.05) &(-0.25)                        \\
\SetCell[r=2]{l}    Ciri human rights index
    & 0.105 &-0.019 &-0.317\TblrNote{**}
                            & 0.006 &-0.080 &-0.066
    & 0.023 &-0.042 &-0.126 &-0.011 &-0.085 &-0.072                         \\
    &(0.81) &(-0.19)&(-2.18)&(0.06) &(-0.89)&(-0.72)
    &(0.27) &(-0.56)&(-1.08)&(-0.14)&(-1.20)&(-1.01)                        \\
\SetCell[r=2]{l}    Constant
    &-0.532 &-0.164 &-2.045 &-0.697 & 0.052 & 0.229
    &       &       &       &       &       &                               \\
    &(-0.41)&(-0.15)&(-1.02)&(-0.58)&(0.05) & (0.22)
    &       &       &       &       &       &                               \\
    \midrule  
\SetCell[r=2]{l}    cut 1 Constant
    &       &       &       &       &       &
    & 0.273 & 0.662 & 1.580 & 0.828 & 0.106 & -0.080                \\
    &       &       &       &       &       &
    &(0.26) &(0.64) &(1.01) &(0.77) &(0.11) &(-0.08)                \\
\SetCell[r=2]{l}    cut 2 Constant
    &       &       &       &       &       &
    & 1.454 & 1.944\TblrNote{*}
                    & 2.940\TblrNote{*}
                            & 2.112\TblrNote{*}
                                    & 1.353 & 1.171                 \\
            &                  &                  &                  &                  &
  &                  &   (1.39)         &   (1.85)         &   (1.88)         &   (1.95)         &   (1.41)         &   (1.22)         \\
    \midrule
Observations
    &{{{144}}}  &{{{149}}}  &{{{63}}}  &{{{153}}}  &{{{153}}}  &{{{151}}}
    &{{{142}}}  &{{{146}}}  &{{{82}}}  &{{{150}}}  &{{{150}}}  &{{{148}}}                     \\
Pseudo \(R^{2}\)
    & 0.346 & 0.299 & 0.244 & 0.293 & 0.268 & 0.260
    & 0.259 & 0.260 & 0.215 & 0.262 & 0.244 & 0.243                 \\
    \bottomrule
\end{longtblr}
    \end{landscape}
\end{document}

在此处输入图片描述

相关内容