帮助长桌

帮助长桌

我正在处理文档中的长表格。我是 LaTeX 新手,因此根据我的 MWE,我可能做错了一些事情。问题是:我希望这个表格(由两部分组成)出现在一页中,或者如果它被拆分,则在下一页中显示(...cont.)或类似内容。

\documentclass[12pt,fleqn]{article}           % fleqn: align equations left
\usepackage{geometry}                                     % Custom margins 
for single page, etc.
\usepackage{fullpage}                                     % Use the full page
\usepackage{setspace}                                     % Enables custom margins, doublespacing, etc.
\usepackage{pdflscape}                                    % Use: \begin{landscape} ... \end{landscape}
\usepackage{lmodern}                                      % Latin Modern fonts
\usepackage{bm}
\usepackage{parskip}
\usepackage[labelfont=bf]{caption}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{datetime}
\usepackage{longtable}
\usepackage{lscape} % To create a table in a landscape environment
\usepackage{rotating} % To use sideways table
\usepackage{rotfloat} % Use H with a sideways table
\usepackage{mathtools}
\usepackage{bibentry}
\usepackage{graphics}
\usepackage{threeparttable}
\usepackage{array}
%\usepackage{hyperref}
\usepackage{rotating} % To rotate a table
\usepackage{tablefootnote}
\setlength{\parindent}{2em}
%\renewcommand{\baselinestretch}{2.0}

% Font/text:
\usepackage[latin9]{inputenc}                             % Font definition and input type
\usepackage[T1]{fontenc}                                  % Font output type 
%\usepackage{textcomp}                                     % Supports many additional symbols
\usepackage{amsmath}                                      % Math equations, etc.
\usepackage{amsthm}                                       % Math theorems, etc.
\usepackage{amsfonts}                                     % Math fonts (e.g. script fonts)
\usepackage{amssymb}                                      % Math symbols such as infinity
\DeclareMathOperator*{\Max}{Max}                          % Better looking max function
\DeclareMathOperator*{\Min}{Min}                          % Better looking min function
\usepackage{color}                                        % Enables colored text
\definecolor{darkblue}{rgb}{0.0,0.0,0.66}                 % Custom color: dark blue
\usepackage[hyperfootnotes=false,bookmarksopen]{hyperref} % Enable hyperlinks, expand menu subtree
\hypersetup{                                              % Custom hyperlink settings
    pdffitwindow=false,                                   % true: window fit to page when opened
    pdfstartview={XYZ null null 1.00},                    % Fits the default zoom of the page to 100%
    pdfnewwindow=true,                                    % Links in new window
    colorlinks=true,                                      % false: boxed links; true: colored links
    linkcolor=darkblue,                                   % Color of internal links
    citecolor=darkblue,                                   % Color of links to bibliography
    urlcolor=darkblue  }                                  % Color of external links
%\usepackage{kpfonts}    % for nice fonts

% Images:
\usepackage{graphicx}                                     % Allows more types of images to be included
\usepackage[position=bottom]{subfig}                      % Enables arrayed images
\usepackage[section]{placeins}                            % Forces floats to stay in section
\usepackage{float}                                        % Used with restylefloat
\restylefloat{figure}                                     % "H" forces a figure to be "exactly here"
\usepackage[justification=centering]{caption}             % Center captions

% Tables/arrays:
\usepackage{booktabs,tabularx}                           % Table format - increases table spacing
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}    % Spacing for tables increased
\renewcommand{\arraystretch}{1}                          % Spaces arrays at 1x
\usepackage{dcolumn}                                     % Align decimals in tables (as option)
%\newcolumntype{.}{D{.}{.}{-1}}                           % Align decimals e.g. \begin{tabular}{c...}

% Miscellaneous:
\interfootnotelinepenalty=10000                           % Footnotes won't break across pages
\usepackage[semicolon]{natbib}                            % Bibliography and citation formating
\usepackage{datetime}                                     % Custom date format for date field
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR}    % Defining month year date format
%\usepackage{tikz}                                        % Timelines and other drawings
%\usetikzlibrary{decorations}                             % Formating for Tikz
%\usepackage{xr}
%\externaldocument{under_estout}

% *****************************************************************
% Estout related things
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}}% Thanks to David Carlisle

\let\estinput=\input% define a new input command so that we can still flatten the document

\newcommand{\estwide}[3]{
        \vspace{.75ex}{
            \begin{tabular*}
            {\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular*}
            }
        }   

\newcommand{\estauto}[3]{
        \vspace{.75ex}{
            \begin{tabular}{l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[2.75ex]
            \end{tabular}
            }
        }

% Allow line breaks with \\ in specialcells
    \newcommand{\specialcell}[2][c]{%
    \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
\newcommand{\figtext}[1]{
    \vspace{-1.9ex}
    \captionsetup{justification=justified,font=footnotesize}
    \caption*{\hspace{6pt}\hangindent=1.5em #1}
    }
\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}

\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

% Add significance note with \starnote
\newcommand{\starnote}{\figtext{* p < 0.1, ** p < 0.05, *** p < 0.01}}
\newcommand{\errornote}{\figtext{Clustered robust standard errors in parentheses}}

% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx} % centering in tables
    \sisetup{
        detect-mode,
        tight-spacing       = true,
        group-digits        = false ,
        input-signs     = ,
        input-symbols       = ( ) [ ] - + *,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        table-align-text-post   = false
        }

% *****************************************************************
% *****************************************************************
% *****************************************************************
% DOCUMENT BEGINS HERE
% *****************************************************************
% *****************************************************************
% *****************************************************************

\begin{document}

\begin{table}[!ht]
\centering{ 
\caption{Marginal effects and OLS estimates for alternative control groups}
\label{tab10}
\begin{flushleft}
\textit{Panel A: control group from 55 to 59 years old}
\end{flushleft}

    \begin{threeparttable} 
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{6}{S
S
S
S}}
\toprule
                                        &\multicolumn{2}{c}{\textit{Attend}}&\multicolumn{2}{c}{\textit{Labor}}\\\cmidrule(lr){2-3} \cmidrule(lr){4-5}
                    &\multicolumn{1}{c}{Primary}&\multicolumn{1}{c}{Secondary}&\multicolumn{1}{c}{Primary}&\multicolumn{1}{c}{Secondary}\\
\midrule
Treatment           &      -0.009         &       0.003         &       0.004         &       0.016         \\
                    &     (0.009)         &     (0.019)         &     (0.052)         &     (0.048)         \\
2008 year dummy     &      -0.007         &       0.025         &       0.008         &      -0.037         \\
                    &     (0.008)         &     (0.021)         &     (0.061)         &     (0.048)         \\
Treatment*year dummy&       0.012         &       0.013         &      -0.001         &      -0.055         \\
                    &     (0.009)         &     (0.027)         &     (0.069)         &     (0.066)         \\
\midrule
Treatment-on-treated&\multicolumn{1}{c}{0.005}         &\multicolumn{1}{c}{0.038}         &\multicolumn{1}{c}{0.007}         &\multicolumn{1}{c}{-0.092}         \\
F-test              &\multicolumn{1}{c}{1.087}         &\multicolumn{1}{c}{3.615}         &\multicolumn{1}{c}{0.027}         &\multicolumn{1}{c}{3.511}         \\
p-value             &\multicolumn{1}{c}{0.298}         &\multicolumn{1}{c}{0.058}         &\multicolumn{1}{c}{0.870}         &\multicolumn{1}{c}{0.062}         \\
\midrule
Observations        &\multicolumn{1}{c}{605}         &\multicolumn{1}{c}{833}         &\multicolumn{1}{c}{529}         &\multicolumn{1}{c}{833}         \\
\(R^{2}\)           &\multicolumn{1}{c}{0.044}         &\multicolumn{1}{c}{0.067}         &\multicolumn{1}{c}{0.424}         &\multicolumn{1}{c}{0.375}         \\
\bottomrule
\end{tabular}
}
\end{threeparttable}}
\end{table}
\begin{table}[!ht]
\centering{ 
\begin{flushleft}
\textit{Panel B: control group from 50 to 59 years old}
\end{flushleft}

    \begin{threeparttable} 
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{4}{S
S
S
S
S
S}}
\toprule
                                        &\multicolumn{2}{c}{\textit{Attend}}&\multicolumn{2}{c}{\textit{Labor}}\\\cmidrule(lr){2-3} \cmidrule(lr){4-5}
                    &\multicolumn{1}{c}{Primary}&\multicolumn{1}{c}{Secondary}&\multicolumn{1}{c}{Primary}&\multicolumn{1}{c}{Secondary}\\
\midrule
Treatment           &      -0.008         &      -0.010         &      -0.009         &      -0.003         \\
                    &     (0.008)         &     (0.016)         &     (0.045)         &     (0.043)         \\
2008 year dummy     &      -0.003         &       0.010         &      -0.094\sym{**} &      -0.041         \\
                    &     (0.004)         &     (0.012)         &     (0.044)         &     (0.035)         \\
Treatment*year dummy&       0.009         &       0.028         &       0.094         &      -0.050         \\
                    &     (0.006)         &     (0.021)         &     (0.058)         &     (0.057)         \\
\midrule
Treatment-on-treated&\multicolumn{1}{c}{0.005}         &\multicolumn{1}{c}{0.038}         &\multicolumn{1}{c}{-0.000}         &\multicolumn{1}{c}{-0.092}         \\
F-test              &\multicolumn{1}{c}{1.161}         &\multicolumn{1}{c}{4.095}         &\multicolumn{1}{c}{0.000}         &\multicolumn{1}{c}{3.463}         \\
p-value             &\multicolumn{1}{c}{0.282}         &\multicolumn{1}{c}{0.044}         &\multicolumn{1}{c}{0.995}         &\multicolumn{1}{c}{0.063}         \\
\midrule
Observations        &\multicolumn{1}{c}{910}         &\multicolumn{1}{c}{1,336}         &\multicolumn{1}{c}{803}         &\multicolumn{1}{c}{1,336}         \\
\(R^{2}\)           &\multicolumn{1}{c}{0.033}         &\multicolumn{1}{c}{0.053}         &\multicolumn{1}{c}{0.393}         &\multicolumn{1}{c}{0.364}         \\
\bottomrule
\end{tabular}
}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item Clustered standard errors in parentheses

\item \textit{* p < 0.1, ** p < 0.05, *** p < 0.01}
\end{tablenotes}
\end{threeparttable}
%   \figsource{Own elaboration based on EH2007 and EH2008}
}
\end{table}

\end{document}

相关内容