可在一个页面内安装长表格

可在一个页面内安装长表格

我有以下代码用于将表格包含在我的论文中:

\documentclass[11pt]{article}
\usepackage{rotating}

\usepackage{longtable}
\usepackage[labelfont=bf, labelsep=newline, justification=centering, textfont=it]{caption}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{booktabs, makecell, siunitx}
\usepackage{eqparbox}
\pagenumbering{gobble}
\usepackage{booktabs}
\usepackage[referable,para]{threeparttablex}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{interval}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}

\usepackage{pgffor}
\newcommand\Quad[1][1]{\foreach \Quaddy in {1,...,#1}{\quad}\ignorespaces}
\captionsetup[table]{labelfont=sc,skip=1.4pt,labelsep=newline}

\sisetup{group-separator={,}, table-format=1.3, table-space-text-post=***, 
table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\newcommand\mytab[1]{%
   \smash[b]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina}

\begin{document}
\begin{table}[!htbp]
\setlength{\tabcolsep}{4pt}
\centering
\normalsize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{threeparttable}
\caption{OLS estimation - Dependent variable std\_gpa \label{OLSstd}}
\begin{tabular}{l*{5}{d{3.5}}}
\toprule \toprule
                                            &\mc{(1)}                   &\mc{(2)}                       &\mc{(3)}                   &\mc{(4)} &\mc{(5)}     \\
\midrule      

autonuni    &       0.020         &       0.019         &       0.013         &       0.011         &       0.011         \\
            &     (0.013)         &     (0.013)         &     (0.013)         &     (0.013)         &     (0.013)         \\
female      &                     &       0.168\sym{***}&       0.129\sym{***}&       0.127\sym{***}&       0.138\sym{***}\\
            &                     &     (0.046)         &     (0.042)         &     (0.044)         &     (0.041)         \\
z\_age       &                     &      -1.142\sym{**} &      -1.070\sym{**} &      -1.122\sym{**} &      -0.977\sym{*}  \\
            &                     &     (0.564)         &     (0.518)         &     (0.519)         &     (0.521)         \\
z\_age2      &                     &       1.113\sym{*}  &       1.044\sym{*}  &       1.098\sym{**} &       0.957\sym{*}  \\
            &                     &     (0.570)         &     (0.523)         &     (0.523)         &     (0.525)         \\
school\_scientlic&                     &      -0.083         &      -0.081         &      -0.089         &      -0.091\sym{*}  \\
            &                     &     (0.057)         &     (0.056)         &     (0.056)         &     (0.053)         \\
school\_otherlic&                     &      -0.179\sym{***}&      -0.173\sym{***}&      -0.178\sym{***}&      -0.169\sym{***}\\
            &                     &     (0.039)         &     (0.039)         &     (0.037)         &     (0.040)         \\
school\_techvoc&                     &      -0.332\sym{***}&      -0.338\sym{***}&      -0.338\sym{***}&      -0.345\sym{***}\\
            &                     &     (0.066)         &     (0.065)         &     (0.060)         &     (0.059)         \\
z\_e         &                     &                     &      -0.026         &      -0.024         &      -0.023         \\
            &                     &                     &     (0.019)         &     (0.019)         &     (0.019)         \\
z\_a         &                     &                     &      -0.040\sym{*}  &      -0.042\sym{*}  &      -0.038         \\
            &                     &                     &     (0.023)         &     (0.023)         &     (0.023)         \\
z\_c         &                     &                     &       0.094\sym{***}&       0.093\sym{***}&       0.091\sym{***}\\
            &                     &                     &     (0.017)         &     (0.017)         &     (0.017)         \\
z\_n         &                     &                     &      -0.034         &      -0.029         &      -0.028         \\
            &                     &                     &     (0.024)         &     (0.023)         &     (0.022)         \\
z\_o         &                     &                     &       0.037\sym{**} &       0.036\sym{**} &       0.037\sym{**} \\
            &                     &                     &     (0.018)         &     (0.017)         &     (0.017)         \\
edufat\_high &                     &                     &                     &       0.037         &       0.026         \\
            &                     &                     &                     &     (0.040)         &     (0.039)         \\
edufat\_l    &                     &                     &                     &      -0.042         &      -0.048         \\
            &                     &                     &                     &     (0.053)         &     (0.055)         \\
edumot\_high &                     &                     &                     &      -0.039         &      -0.048         \\
            &                     &                     &                     &     (0.050)         &     (0.050)         \\
edumot\_l    &                     &                     &                     &       0.099         &       0.085         \\
            &                     &                     &                     &     (0.062)         &     (0.059)         \\
occupfat\_d2 &                     &                     &                     &      -0.059         &      -0.055         \\
            &                     &                     &                     &     (0.054)         &     (0.055)         \\
occupfat\_d3 &                     &                     &                     &      -0.164\sym{***}&      -0.159\sym{**} \\
            &                     &                     &                     &     (0.059)         &     (0.059)         \\
occupfat\_d4 &                     &                     &                     &       0.084         &       0.087         \\
            &                     &                     &                     &     (0.157)         &     (0.155)         \\
occupfat\_d5 &                     &                     &                     &      -0.282\sym{***}&      -0.288\sym{***}\\
            &                     &                     &                     &     (0.070)         &     (0.073)         \\
occupmot\_d2 &                     &                     &                     &      -0.062         &      -0.051         \\
            &                     &                     &                     &     (0.038)         &     (0.038)         \\
occupmot\_d3 &                     &                     &                     &      -0.150\sym{**} &      -0.135\sym{*}  \\
            &                     &                     &                     &     (0.068)         &     (0.069)         \\
occupmot\_d4 &                     &                     &                     &       0.063         &       0.061         \\
            &                     &                     &                     &     (0.054)         &     (0.054)         \\
occupmot\_d5 &                     &                     &                     &       0.024         &       0.027         \\
            &                     &                     &                     &     (0.181)         &     (0.178)         \\
jobsectfat\_d2&                     &                     &                     &      -0.011         &      -0.015         \\
            &                     &                     &                     &     (0.060)         &     (0.061)         \\
jobsectfat\_d3&                     &                     &                     &      -0.035         &      -0.041         \\
            &                     &                     &                     &     (0.077)         &     (0.076)         \\
jobsectfat\_d4&                     &                     &                     &      -0.037         &      -0.034         \\
            &                     &                     &                     &     (0.044)         &     (0.045)         \\
jobsectmot\_d2&                     &                     &                     &       0.063         &       0.072         \\
            &                     &                     &                     &     (0.119)         &     (0.117)         \\
jobsectmot\_d3&                     &                     &                     &       0.211         &       0.184         \\
            &                     &                     &                     &     (0.155)         &     (0.155)         \\
jobsectmot\_d4&                     &                     &                     &      -0.029         &      -0.018         \\
            &                     &                     &                     &     (0.043)         &     (0.044)         \\
resid\_provme&                     &                     &                     &                     &       0.002         \\
            &                     &                     &                     &                     &     (0.033)         \\
resid\_othersicily&                     &                     &                     &                     &      -0.084         \\
            &                     &                     &                     &                     &     (0.062)         \\
resid\_rc    &                     &                     &                     &                     &       0.004         \\
            &                     &                     &                     &                     &     (0.079)         \\
resid\_provrc&                     &                     &                     &                     &      -0.175\sym{***}\\
            &                     &                     &                     &                     &     (0.062)         \\
resid\_othercalabria&                     &                     &                     &                     &      -0.374\sym{***}\\
            &                     &                     &                     &                     &     (0.093)         \\
resid\_otheritaly&                     &                     &                     &                     &       0.035         \\
            &                     &                     &                     &                     &     (0.227)         \\
\midrule
\(N\)       &        \mc{3242}         &        \mc{3242}         &        \mc{3242}         &       \mc{3242} &       \mc{3242}         \\
\bottomrule \bottomrule
\end{tabular}
\begin{tablenotes}
\small
      \item[]{{\it{Notes}:} TBW   \\
      *** $p<0.01$\\
      **{\phantom{*}} $p<0.05$ \\
      *{\phantom{**}} $p<0.10$ }\\
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}

我无法将其放在一页内或分成两页,尽管第一种选择对我来说更方便。有人能帮忙吗?

答案1

如果表格中使用易于阅读的字体大小(\normalsize, \small),那么它就太大了,无法放在一页中。该表格可以分成两页,您需要:

  • 移除table浮动
  • 在前导加载ltablex包中

考虑到这一点,您的代码示例变成:

\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}

\usepackage[labelfont=bf, textfont=it,
            labelsep=newline, 
            justification=centering]{caption}
\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{adjustbox}  % it load graphicx 
%\usepackage{graphicx}
\usepackage{rotating}
\usepackage{booktabs, longtable, ltablex, makecell, multirow}  % <---
\usepackage[referable,para]{threeparttablex}

\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{interval}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}

\usepackage{pgffor}
\newcommand\Quad[1][1]{\foreach \Quaddy in {1,...,#1}{\quad}\ignorespaces}

\usepackage{siunitx}
\sisetup{group-separator={,}, 
         table-format=1.3, 
         table-space-text-post=***,
         table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}

\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\newcommand\mytab[1]{%
   \smash[b]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina}

\begin{document}

\setlength{\tabcolsep}{4pt}
\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{ThreePartTable}
\begin{TableNotes}[flushleft]\footnotesize
\note:TBW   \\
    \item[*]    $p<0.5$
    \item[**]   $p<0.1$
    \item[***]  $p<0.01$
\end{TableNotes}
%
    \begin{tabularx}{\linewidth}{X *{5}{d{3.5}}}
\caption{OLS estimation - Dependent variable std\_gpa \label{OLSstd}}   \\
    \toprule
    &   \mc{(1)}    &   \mc{(2)}    &   \mc{(3)}    &   \mc{(4)}    &   \mc{(5)}    \\
    \midrule
\endfirsthead
\caption[]{OLS estimation - Dependent variable std\_gpa \label{OLSstd} (continue)}   \\
    \toprule
    &   \mc{(1)}    &   \mc{(2)}    &   \mc{(3)}    &   \mc{(4)}    &   \mc{(5)}    \\
    \midrule
\endhead
    \bottomrule
    \insertTableNotes   \\
    \multicolumn{6}{r}{\textit{Continue on next page}}
\endfoot
    \bottomrule
    \insertTableNotes
\endlastfoot
%%%% table body
autonuni    &  0.020    &  0.019    &  0.013    &   0.011   &   0.011           \\
            & (0.013)   & (0.013)   & (0.013)   &  (0.013)  &  (0.013)          \\
    \addlinespace
female      &           &  0.168\sym{***}  
                                    &   0.129\sym{***}  
                                                &  0.127\sym{***}  
                                                            &   0.138\sym{***}  \\
            &           & (0.046)   &  (0.042)  & (0.044)   &  (0.041)          \\
    \addlinespace
z\_age      &           & -1.142\sym{**} 
                                    & -1.070\sym{**} 
                                                & -1.122\sym{**} 
                                                            & -0.977\sym{*}     \\
            &           & (0.564)   & (0.518)   & (0.519)   & (0.521)           \\
    \addlinespace
z\_age2     &           &  1.113\sym{*}  
                                    &  1.044\sym{*}  
                                                &  1.098\sym{**} 
                                                            &  0.957\sym{*}     \\
            &           & (0.570)   & (0.523)   & (0.523)   & (0.525)           \\
    \addlinespace
school\_scientlic
            &           & -0.083    & -0.081    & -0.089    & -0.091\sym{*}     \\
            &           & (0.057)   & (0.056)   & (0.056)   & (0.053)           \\
    \addlinespace
school\_otherlic    &   & -0.179\sym{***}
                                    & -0.173\sym{***}
                                                & -0.178\sym{***}
                                                            & -0.169\sym{***}   \\
            &           & (0.039)   & (0.039)   & (0.037)   & (0.040)           \\
    \addlinespace
school\_techvoc
            &           & -0.332\sym{***}
                                    & -0.338\sym{***}
                                                & -0.338\sym{***}
                                                            & -0.345\sym{***}   \\
            &           & (0.066)   & (0.065)   & (0.060)   & (0.059)           \\
    \addlinespace
z\_e        &           &           & -0.026    & -0.024    & -0.023            \\
            &           &           & (0.019)   & (0.019)   & (0.019)           \\
    \addlinespace
z\_a        &           &           & -0.040\sym{*}  
                                                & -0.042\sym{*}  
                                                            & -0.038            \\
            &           &           & (0.023)   & (0.023)   & (0.023)           \\
    \addlinespace
z\_c        &           &           & 0.094\sym{***}
                                                & 0.093\sym{***}
                                                            & 0.091\sym{***}    \\
            &           &           & (0.017)   & (0.017)   & (0.017)           \\
    \addlinespace
z\_n        &           &           & -0.034    & -0.029    & -0.028            \\
            &           &           & (0.024)   & (0.023)   & (0.022)           \\
    \addlinespace
z\_o        &           &           &  0.037\sym{**} 
                                                &  0.036\sym{**} 
                                                            &  0.037\sym{**}    \\
            &           &           & (0.018)   & (0.017)   & (0.017)           \\
    \addlinespace
edufat\_high    &       &           &           &  0.037    &  0.026            \\
            &           &           &           & (0.040)   & (0.039)           \\
    \addlinespace
edufat\_l   &           &           &           & -0.042    & -0.048            \\
            &           &           &           & (0.053)   & (0.055)           \\
    \addlinespace
edumot\_high    &       &           &           & -0.039    & -0.048            \\
            &           &           &           & (0.050)   & (0.050)           \\
edumot\_l   &           &           &           & 0.099     &  0.085            \\
            &           &           &           & (0.062)   & (0.059)           \\
    \addlinespace
occupfat\_d2    &       &           &           & -0.059    & -0.055            \\
            &           &           &           & (0.054)   & (0.055)           \\
    \addlinespace
occupfat\_d3    &       &           &           & -0.164\sym{***}
                                                            & -0.159\sym{**}    \\
            &           &           &           & (0.059)   & (0.059)           \\
    \addlinespace
occupfat\_d4    &       &           &           &  0.084    &  0.087            \\
            &           &           &           & (0.157)   & (0.155)           \\
    \addlinespace
occupfat\_d5    &       &           &           & -0.282\sym{***}
                                                            & -0.288\sym{***}   \\
            &           &           &           & (0.070)   & (0.073)           \\
    \addlinespace
occupmot\_d2    &       &           &           & -0.062    & -0.051            \\
            &           &           &           & (0.038)   & (0.038)           \\
    \addlinespace
occupmot\_d3    &       &           &           & -0.150\sym{**} 
                                                            & -0.135\sym{*}     \\
            &           &           &           & (0.068)   & (0.069)           \\
    \addlinespace
occupmot\_d4    &       &           &           &  0.063    &  0.061            \\
            &           &           &           & (0.054)   & (0.054)           \\
    \addlinespace
occupmot\_d5    &       &           &           &  0.024    &  0.027            \\
            &           &           &           & (0.181)   & (0.178)           \\
    \addlinespace
jobsectfat\_d2  &       &           &           & -0.011    & -0.015            \\
            &           &           &           & (0.060)   & (0.061)           \\
    \addlinespace
jobsectfat\_d3  &       &           &           & -0.035    & -0.041            \\
            &           &           &           & (0.077)   & (0.076)           \\
    \addlinespace
jobsectfat\_d4  &       &           &           & -0.037    & -0.034            \\
            &           &           &           & (0.044)   & (0.045)           \\
    \addlinespace
jobsectmot\_d2  &       &           &           &  0.063    &  0.072            \\
            &           &           &           & (0.119)   & (0.117)           \\
    \addlinespace
jobsectmot\_d3  &       &           &           &  0.211    &  0.184            \\
            &           &           &           & (0.155)   & (0.155)           \\
    \addlinespace
jobsectmot\_d4  &       &           &           & -0.029    & -0.018            \\
            &           &           &           & (0.043)   & (0.044)           \\
    \addlinespace
resid\_provme   &       &           &           &           &  0.002            \\
            &           &           &           &           & (0.033)           \\
    \addlinespace
resid\_othersicily  &   &           &           &           & -0.084            \\
            &           &           &           &           & (0.062)           \\
    \addlinespace
resid\_rc   &           &           &           &           &  0.004            \\
            &           &           &           &           & (0.079)           \\
    \addlinespace
resid\_provrc   &       &           &           &           & -0.175\sym{***}   \\
            &           &           &           &           & (0.062)           \\
    \addlinespace
resid\_othercalabria    
            &           &           &           &           & -0.374\sym{***}   \\
            &           &           &           &           & (0.093)           \\
    \addlinespace
resid\_otheritaly   &   &           &           &           & 0.035             \\
            &           &           &           &           & (0.227)           \\
    \midrule
\(N\)       & \mc{3242} & \mc{3242} & \mc{3242} & \mc{3242} & \mc{3242}         \\
    \end{tabularx}
\end{ThreePartTable}
\end{document}

在此处输入图片描述

答案2

将表格放在一页中的唯一替代方法是使用\tiny字体大小代替\normalsize。在这种情况下,你有: 在此处输入图片描述

相关内容