防止表格跳转到下一页

防止表格跳转到下一页

我正在尝试创建表格附录,但我的第一个表格跳转到第二页。我已经浏览了 将表格/图片放在靠近提及的地方但似乎都不起作用。

\documentclass[12pt]{article}
\addtolength{\parskip}{\baselineskip}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
\setlength{\parindent}{0.25in} 


%Tables preamble
\usepackage[none]{hyphenat}
\usepackage{float}
\usepackage[thinlines]{easytable}
\usepackage{longtable}
\usepackage{array,booktabs, makecell, multirow}
\renewcommand\theadfont{\bfseries\small}
\newcommand\mceight[1]{\multicolumn{8}{l}{#1}}
\newcommand\mctwelve[1]{\multicolumn{12}{c}{#1}}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{tabularx}

\widowpenalty500
\clubpenalty500
\exhyphenpenalty=50 %for line-breaking at an explicit hyphen
\brokenpenalty=4991
\predisplaypenalty=10000
\postdisplaypenalty=1549
\displaywidowpenalty=1602
\floatingpenalty = 20000

\usepackage[labelfont=bf, textfont=bf]{caption}

\section{Appendix}
\subsection{Appendix of Tables}

\newgeometry{margin=0.4in} 

\begin{table}[!htbp]
\caption{Summary statistics 1}
\fontsize{10}{12}\selectfont
\sisetup{detect-all}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    l S[table-format=2.2]     S[table-format=2.0]
    *{3}{S[table-format=2.2]} S[table-format=3.0]} 
\toprule
 & & & \multicolumn{3}{c}{Quantiles} \\
    \cmidrule(lr){4-6}
\textbf{Variable} & \textbf{Mean} & \textbf{Minimum} & \textbf{25th percentile} & \textbf{Median} & \textbf{75th percentile} & \textbf{Maximum} \\ \midrule
\textbf{Panel A: Female labour force} \\ \midrule
\textbf{2004-05} \\ \hdashline
{Hourly wage}  & 12.52 & 0 & 3.75 & 5.48 & 12.5 & 250\ \\ \hdashline
{Age (in years)}&  31.56 & 15 & 22 & 29 & 38 & 60\ \\ \hdashline
{Years of experience} & 7.9 & 0 & 8 & 15 & 25 & 40\ \\ \hdashline
{Years of education} & 17.63 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
\\
\textbf{2011-12} \\ \hdashline
{Hourly wage} & 29.44 & 1 & 10 & 15 & 30 & 328\ \\ \hdashline
{Age (in years)} & 35.06 & 15 & 28 & 35 & 42 & 60\ \\ \hdashline
{Years of education} & 7.13 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
{Years of experience} & 21.93 & 0 & 13 & 23 & 31 & 40\ \\ \hdashline
\bottomrule
\end{tabular*}
\end{table}
\end{document}

答案1

导致您出现问题的原因是使用newgeometry。它总是开始新页面...

删除它并稍微重新设计表格(使列头更短)我得到:

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage[fleqn]{mathtools}
\usepackage{siunitx}
\setlength{\parindent}{0.25in}
\addtolength{\parskip}{\baselineskip}


%Tables preamble
\usepackage[none]{hyphenat}
%\usepackage{float}
%\usepackage[thinlines]{easytable}
\usepackage{array,booktabs, longtable, makecell, multirow,tabularx}
\renewcommand\theadfont{\bfseries\small}
\newcommand\mceight[1]{\multicolumn{8}{l}{#1}}
\newcommand\mctwelve[1]{\multicolumn{12}{c}{#1}}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
%\usepackage{pdflscape}
%\usepackage{afterpage}
\usepackage[labelfont=bf, textfont=bf]{caption}

\begin{document}
\section{Appendix}
\subsection{Appendix of Tables}

%\newgeometry{margin=0.4in}

\begin{table}[htp]
\caption{Summary statistics 1}
\fontsize{10}{12}\selectfont
\sisetup{detect-all}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    l S[table-format=2.2]     S[table-format=2.0]
    *{3}{S[table-format=2.2]} S[table-format=3.0]}
\toprule
 & & & \multicolumn{3}{c}{Quantiles} \\
    \cmidrule(lr){4-6}
\textbf{Variable} & \textbf{Mean} & \textbf{Min} & \textbf{25th percentile} & \textbf{Median} & \textbf{75th percentile} & \textbf{Max} \\ \midrule
\textbf{Panel A: Female labour force} \\ \midrule
\textbf{2004-05} \\ \hdashline
{Hourly wage}  & 12.52 & 0 & 3.75 & 5.48 & 12.5 & 250\ \\ \hdashline
{Age (in years)}&  31.56 & 15 & 22 & 29 & 38 & 60\ \\ \hdashline
{Years of experience} & 7.9 & 0 & 8 & 15 & 25 & 40\ \\ \hdashline
{Years of education} & 17.63 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
\\
\textbf{2011-12} \\ \hdashline
{Hourly wage} & 29.44 & 1 & 10 & 15 & 30 & 328\ \\ \hdashline
{Age (in years)} & 35.06 & 15 & 28 & 35 & 42 & 60\ \\ \hdashline
{Years of education} & 7.13 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
{Years of experience} & 21.93 & 0 & 13 & 23 & 31 & 40\ \\ \hdashline
\bottomrule
\end{tabular*}
\end{table}
\end{document}

离题:我将重新设计表格并更正错误写的一些行,如下所示:

\documentclass[12pt]{article}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage[fleqn]{mathtools}
\usepackage{siunitx}
\setlength{\parindent}{0.25in}
\addtolength{\parskip}{\baselineskip}


%Tables preamble
\usepackage[none]{hyphenat}
%\usepackage{float}
%\usepackage[thinlines]{easytable}
\usepackage{array, booktabs, longtable, 
            makecell, multirow, tabularx, 
            threeparttable}
\renewcommand\theadfont{\bfseries\small}
\newcommand\mceight[1]{\multicolumn{8}{l}{#1}}
\newcommand\mctwelve[1]{\multicolumn{12}{c}{#1}}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
%\usepackage{pdflscape}
%\usepackage{afterpage}
\usepackage[labelfont=bf, textfont=bf]{caption}

\begin{document}
\section{Appendix}
\subsection{Appendix of Tables}

\begin{threeparttable}[ht]
\caption{Summary statistics 1}
\fontsize{10}{12}\selectfont
\sisetup{detect-all}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    l S[table-format=2.2]     S[table-format=2.0]
    *{3}{S[table-format=2.2]} S[table-format=3.0]}
\toprule
 & & & \multicolumn{3}{c}{Quantiles} \\
    \cmidrule{4-6}
\textbf{Variable} & \textbf{Mean}               & \textbf{Min} 
                  & \textbf{25th per. \tnote{a}}& \textbf{Median} 
                  & \textbf{75th per. \tnote{a}}& \textbf{Max}      \\ \midrule
\multicolumn{7}{l}{\textbf{Panel A: Female labour force}}           \\ \midrule
\multicolumn{7}{l}{\textbf{2004-05}}                                \\ 
    \hdashline
Hourly wage         & 12.52 &  0    &  3.75 &  5.48 & 12.5  & 250   \\
Age (in years)      & 31.56 & 15    & 22    & 29    & 38    & 60    \\
Years of experience &  7.9  &  0    &  8    & 15    & 25    & 40    \\
Years of education  & 17.63 &  0    &  0    &  8    & 12    & 16    \\ 
    \midrule
\multicolumn{7}{l}{\textbf{2011-12}}                                \\ 
    \hdashline
Hourly wage         & 29.44 &  1    & 10    & 15    & 30    & 328   \\
Age (in years)      & 35.06 & 15    & 28    & 35    & 42    & 60    \\
Years of education  &  7.13 &  0    &  0    &  8    & 12    & 16    \\
Years of experience & 21.93 &  0    & 13    & 23    & 31    & 40    \\
    \bottomrule
\end{tabular*}
\end{threeparttable}
\begin{tablenotes}[para, flushleft]\scriptsize
\item[a]    per.: percentile
\end{tablenotes}
\end{document}

在此处输入图片描述

相关内容