1

私の latex ファイルには、2 つのページに分割する必要がある長いテーブルがいくつかあり、パッケージ longtable を使用しています。テーブルを常にページの先頭から開始したいので、コマンド「\afterpage」も使用しますが、機能しません。実際、私の表は複数のページに分割されていますが、2 番目の表はページの先頭から始まりますが、3 番目の表はそうではありません。また、テキスト内でそれらを移動しようとしましたが、それも役に立ちません。どんな助けでも大歓迎です!

コード:

\documentclass[a4paper, 12pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, amsmath, amsthm, amsfonts, wasysym, ulsy}
\usepackage[onehalfspacing]{setspace}
\usepackage[titletoc,title,header,page]{appendix}
\usepackage{mathtools}
\usepackage{braket}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{float}
\usepackage[hang,small,bf]{caption}
\usepackage{subcaption}
\usepackage[top=3cm, bottom=3.5cm, left=3cm, right=2.5cm]{geometry}
\usepackage{booktabs}
\usepackage{afterpage}
\usepackage[round, sort, authoryear, longnamesfirst]{natbib} %longnamesfirst
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{emptypage}
\usepackage{enumitem}
\usepackage[frame]{crop}
\usepackage{grffile}
\usepackage[T1]{fontenc}
\usepackage{quoting}
%\usepackage{subfig}        
\usepackage[]{moresize}
\usepackage{cmap}
\usepackage{comment}
\newcommand\cites[1]{\citeauthor{#1}'s (\citeyear{#1})}

%\renewenvironment{comment}{}{} 
\newcommand {\red} {\color{red}}
%\newcommand {\black} {\color{black}}
%\newcommand{\blue}{\color{blue}}
\newcommand{\green}{\color{green}}
\definecolor{deepblue}{RGB}{0,129,188}
\newcommand{\pink}{\color{magenta}}
\newcommand {\tsum} {\sum}
\newcommand {\tint} {\int}
\newcommand {\dsum} {\sum}
\newcommand {\bb} {\st\color{red}}

%\input{tcilatex}

%figures
\usepackage{graphicx}
%\graphicspath{{Figures/}}
\usepackage{epstopdf}
\usepackage[export]{adjustbox}

\usepackage[official]{eurosym}

\usepackage{array}
\usepackage{dsfont}
\usepackage{bbm}

%\usepackage{ulem}
\usepackage{rotating}
\usepackage{dcolumn}
\usepackage{longtable}

\usepackage{lscape}
\usepackage{lipsum}

\usepackage{chngcntr}

%colors
\usepackage{color}
\newcommand{\black}{\color{black}}
\newcommand{\blue}{\color{blue}}


\makeatletter
\ifcsname phantomsection\endcsname
\newcommand*{\qrr@gobblenexttocentry}[5]{}
\else
\newcommand*{\qrr@gobblenexttocentry}[4]{}
\fi
\newcommand*{\addsubsection}{%
    \addtocontents{toc}{\protect\qrr@gobblenexttocentry}%
    \subsection}
\makeatother


\counterwithout{footnote}{chapter}

\newcommand\blfootnote[1]{%
    \begingroup
    \renewcommand\thefootnote{}\footnote{#1}%
    \addtocounter{footnote}{-1}%
    \endgroup
}

\newcommand\Tstrut{\rule{0pt}{2.6ex}}         % = `top' strut
\newcommand\Bstrut{\rule[-0.9ex]{0pt}{0pt}}   % = `bottom' strut

\newcounter{hypothesis}
\newcommand{\hyp}[1]{\refstepcounter{hypothesis}\label{#1}}


\usepackage[citebordercolor={1 1 1}, linkbordercolor={1 1 1}, urlbordercolor={1 1 1}, pagebackref]{hyperref}



\newtheorem{prop}{Proposition}[chapter]
\newtheorem{ass}{Assumption}[chapter]


\allowdisplaybreaks[0]
\renewcommand\floatpagefraction{1}
\renewcommand\topfraction{1}
\renewcommand\bottomfraction{1}
\setlength{\floatsep}{6pt}
\setlength{\textfloatsep}{12pt}

\setlength{\headheight}{30pt}

\fancypagestyle{MainBodyHeader}{
    \fancyhf{}
    \renewcommand{\headrulewidth}{0.4pt}
    \fancyfoot[LE,RO]{\thepage}
    %\fancyhead[LE]{\textit{ \nouppercase{\leftmark}} }
    \fancyhead[LE]{\textit{ \leftmark} }
    \fancyhead[RO]{\textit{ \nouppercase{\rightmark}} }
}

\fancypagestyle{PlainHeader}{
    \fancyhf{}
    \renewcommand{\headrulewidth}{0pt}
    \fancyfoot[LE,RO]{\thepage}
    %\fancyhead[LE]{\textit{ \nouppercase{\leftmark}} }
}

\raggedbottom


\begin{document}

\section{Introduction}
hello 


\section{Tables and figures}


    \begin{longtable}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
        \caption{Marginal Effects}\label{does_tab1} 
        \\[-1.8ex]\hline 
        \hline \\[-1.8ex] 
        & \multicolumn{3}{c}{\textit{Dependent variable:}} \\ 
        \cline{2-4} 
        \\[-1.8ex] & \multicolumn{3}{c}{P(Y=1)} \\ 
        \\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)}\\ 
        \hline \\[-1.8ex] 
        a   & 0.042^{***} & 0.035^{***} & 0.036^{***} \\ 
        & (0.006) & (0.008) & (0.008) \\ 
        b & 0.022^{***} & 0.013^{***} & 0.026^{***} \\ 
        & (0.005) & (0.005) & (0.008) \\ 
        c & 0.033^{***} & 0.036^{***} & 0.037^{***} \\ 
        & (0.001) & (0.007) & (0.007) \\ 
        d & -0.047^{***} & -0.037^{***} & -0.050^{***} \\ 
        & (0.006) & (0.009) & (0.012) \\ 
        e &  &  & 0.00004 \\ 
        &  &  & (0.00003) \\ 
        f &  &  & -0.0001^{*} \\ 
        &  &  & (0.0001) \\ 
        \vspace{0.2cm}
        g & $No$ & $Yes$& $Yes$\\
        \vspace{0.2cm}
        h & $No$ & $Yes$ & $Yes$ \\
        \vspace{0.2cm}
        Constant &  &  &  \\ 
        &  &  &  \\ 
        \hline \\[-1.8ex] 
        Observations & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{49,785} \\ 
        Log Likelihood & \multicolumn{1}{c}{-21,475.640} & \multicolumn{1}{c}{-19,457.520} & \multicolumn{1}{c}{-18,845.390} \\ 
        Akaike Inf. Crit. & \multicolumn{1}{c}{42,961.280} & \multicolumn{1}{c}{39,495.040} & \multicolumn{1}{c}{38,274.780} \\ 
        \hline 
        \hline \\[-1.8ex] 
        \multicolumn{4}{p{.9\linewidth}}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01. \footnotesize long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long }  \\
        \hline \\[-1.8ex] 
    \end{longtable} 

\afterpage{
    \begin{longtable}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
    \caption{Marginal Effects}\label{does_tab2} 
    \\[-1.8ex]\hline 
    \hline \\[-1.8ex] 
    & \multicolumn{3}{c}{\textit{Dependent variable:}} \\ 
    \cline{2-4} 
    \\[-1.8ex] & \multicolumn{3}{c}{P(Y=1)} \\ 
    \\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)}\\ 
    \hline \\[-1.8ex] 
    a   & 0.042^{***} & 0.035^{***} & 0.036^{***} \\ 
    & (0.006) & (0.008) & (0.008) \\ 
    b & 0.022^{***} & 0.013^{***} & 0.026^{***} \\ 
    & (0.005) & (0.005) & (0.008) \\ 
    c & 0.033^{***} & 0.036^{***} & 0.037^{***} \\ 
    & (0.001) & (0.007) & (0.007) \\ 
    d & -0.047^{***} & -0.037^{***} & -0.050^{***} \\ 
    & (0.006) & (0.009) & (0.012) \\ 
    e &  &  & 0.00004 \\ 
    &  &  & (0.00003) \\ 
    f &  &  & -0.0001^{*} \\ 
    &  &  & (0.0001) \\ 
    \vspace{0.2cm}
    g & $No$ & $Yes$& $Yes$\\
    \vspace{0.2cm}
    h & $No$ & $Yes$ & $Yes$ \\
    \vspace{0.2cm}
    Constant &  &  &  \\ 
    &  &  &  \\ 
    \hline \\[-1.8ex] 
    Observations & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{49,785} \\ 
    Log Likelihood & \multicolumn{1}{c}{-21,475.640} & \multicolumn{1}{c}{-19,457.520} & \multicolumn{1}{c}{-18,845.390} \\ 
    Akaike Inf. Crit. & \multicolumn{1}{c}{42,961.280} & \multicolumn{1}{c}{39,495.040} & \multicolumn{1}{c}{38,274.780} \\ 
    \hline 
    \hline \\[-1.8ex] 
    \multicolumn{4}{p{.9\linewidth}}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01. \footnotesize long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text}  \\
    \hline \\[-1.8ex] 
\end{longtable} 

}

\afterpage{
    \begin{longtable}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
    \caption{Marginal Effects}\label{does_tab3} 
    \\[-1.8ex]\hline 
    \hline \\[-1.8ex] 
    & \multicolumn{3}{c}{\textit{Dependent variable:}} \\ 
    \cline{2-4} 
    \\[-1.8ex] & \multicolumn{3}{c}{P(Y=1)} \\ 
    \\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)}\\ 
    \hline \\[-1.8ex] 
    a   & 0.042^{***} & 0.035^{***} & 0.036^{***} \\ 
    & (0.006) & (0.008) & (0.008) \\ 
    b & 0.022^{***} & 0.013^{***} & 0.026^{***} \\ 
    & (0.005) & (0.005) & (0.008) \\ 
    c & 0.033^{***} & 0.036^{***} & 0.037^{***} \\ 
    & (0.001) & (0.007) & (0.007) \\ 
    d & -0.047^{***} & -0.037^{***} & -0.050^{***} \\ 
    & (0.006) & (0.009) & (0.012) \\ 
    e &  &  & 0.00004 \\ 
    &  &  & (0.00003) \\ 
    f &  &  & -0.0001^{*} \\ 
    &  &  & (0.0001) \\ 
    \vspace{0.2cm}
    g & $No$ & $Yes$& $Yes$\\
    \vspace{0.2cm}
    h & $No$ & $Yes$ & $Yes$ \\
    \vspace{0.2cm}
    Constant &  &  &  \\ 
    &  &  &  \\ 
    \hline \\[-1.8ex] 
    Observations & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{51,878} & \multicolumn{1}{c}{49,785} \\ 
    Log Likelihood & \multicolumn{1}{c}{-21,475.640} & \multicolumn{1}{c}{-19,457.520} & \multicolumn{1}{c}{-18,845.390} \\ 
    Akaike Inf. Crit. & \multicolumn{1}{c}{42,961.280} & \multicolumn{1}{c}{39,495.040} & \multicolumn{1}{c}{38,274.780} \\ 
    \hline 
    \hline \\[-1.8ex] 
    \multicolumn{4}{p{.9\linewidth}}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01. \footnotesize long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text}  \\
    \hline \\[-1.8ex] 
\end{longtable} 

}


\end{document}


4

1 に答える 1