附录中小节标题后的表格被移至下一页,尽管据我所知,它很容易放在包含小节标题的页面上。这样一页就只包含小节标题,然后是下一页上的表格。我想知道如何将表格放在小节标题正下方(即使它仅位于下方几毫米处)。示例:
\documentclass[12pt, a4paper,english,leqno]{article}
\usepackage{eurosym}
\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage{afterpage}
\usepackage{rotating}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[flushmargin]{footmisc}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{calc}
\usepackage{amsfonts,amsmath,amssymb,amsfonts,amsthm}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{delarray}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{color}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{threeparttable}
\usepackage{pgfplotstable}
\usepackage{rotating}
\usepackage{placeins}
\usepackage{pdfpages}
\usepackage{lscape}
\usepackage{float}
\usepackage[export]{adjustbox}[2011/08/13]
\usepackage[unicode=true]{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, anchorcolor=black, citecolor=blue, filecolor=black, menucolor=black, runcolor=black, urlcolor=black}
\clubpenalty = 10000
\widowpenalty = 10000
\usetikzlibrary{arrows,calc}
\floatstyle{plaintop}
\restylefloat{table}
\restylefloat{figure}
\begin{document}
\appendix
\section*{Appendix} \label{sec:appendix}
\addcontentsline{toc}{section}{Appendices}
\renewcommand{\thesubsection}{\Alph{subsection}}
\clearpage
\subsection{XYZ}\label{sec:xyz}
\setcounter{table}{0}
\renewcommand{\thetable}{B.\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{B.\arabic{figure}}
\begin{sidewaystable}[!h]\centering\small
\caption{Table 1.}\label{tab:table1}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{9}{c}}
\toprule
&\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)}\\
\midrule
price\_constant & 10.073\sym{***}& 13.562\sym{***}& 12.093\sym{***}& 11.232\sym{***}& 11.330\sym{***}& 10.572\sym{***}& 10.036\sym{***}& 10.077\sym{***}& 9.665\sym{***} \\
price\_sigma & 4.681\sym{***}& 5.448\sym{***}& 4.756\sym{***}& 4.574\sym{***}& 5.069\sym{***}& 4.596\sym{***}& 4.522\sym{***}& 5.058\sym{***}& 3.827\sym{***} \\
\midrule
wage\_constant & 3.342\sym{***}& 5.133\sym{***} & 4.170\sym{***}& 3.687\sym{***}& 3.812\sym{***}& 3.386\sym{***}& 3.166\sym{***}& 3.136\sym{***}& 3.087\sym{***} \\
wage\_sigma & 3.068\sym{***}& 3.279\sym{***} & 2.995\sym{***}& 2.790\sym{***}& 3.038\sym{***}& 3.046\sym{***}& 2.594\sym{***}& 2.528\sym{***}& 2.418\sym{***} \\
\midrule
Observations & 3104 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\midrule
\addlinespace
&\multicolumn{1}{c}{(10)}&\multicolumn{1}{c}{(11)}&\multicolumn{1}{c}{(12)}&\multicolumn{1}{c}{(13)}&\multicolumn{1}{c}{(14)}&\multicolumn{1}{c}{(15)}&\multicolumn{1}{c}{(16)}&\multicolumn{1}{c}{(17)}\\
\midrule
price\_constant & 9.655\sym{***}& 9.727\sym{***}& 9.675\sym{***}& 9.464\sym{***}& 9.356\sym{***}& 8.711\sym{***}& 8.065\sym{***}& 7.952\sym{***}\\
price\_sigma & 4.249\sym{***}& 4.146\sym{***}& 3.892\sym{***}& 3.951\sym{***}& 4.071\sym{***}& 3.819\sym{***}& 3.885\sym{***}& 5.137\sym{***}\\
\midrule
wage\_constant & 3.229\sym{***}& 3.196\sym{***}& 3.072\sym{***}& 3.157\sym{***}& 3.060\sym{***}& 2.790\sym{***}& 2.709\sym{***}& 2.605\sym{***}\\
wage\_sigma & 2.617\sym{***}& 2.887\sym{***}& 2.512\sym{***}& 2.625\sym{***}& 2.791\sym{***}& 2.667\sym{***}& 3.918\sym{***}& 4.752\sym{***}\\
\midrule
Observations & 194 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\bottomrule\addlinespace
\end{tabular}
\end{sidewaystable}
\end{document}
答案1
两个问题:sidewaystable
总是从新页面开始,表格太大,无法容纳在部分标题下方的剩余空间中。为了解决这个问题,我建议使用较小的字体大小和正常的表格环境,并旋转内容:
\documentclass[12pt, a4paper,english,leqno]{article}
\usepackage{eurosym}
\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage{afterpage}
\usepackage{rotating}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[flushmargin]{footmisc}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{calc}
\usepackage{amsfonts,amsmath,amssymb,amsfonts,amsthm}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{delarray}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{color}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{threeparttable}
\usepackage{pgfplotstable}
\usepackage{rotating}
\usepackage{placeins}
\usepackage{pdfpages}
\usepackage{lscape}
\usepackage{float}
\usepackage[export]{adjustbox}[2011/08/13]
\usepackage[unicode=true]{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, anchorcolor=black, citecolor=blue, filecolor=black, menucolor=black, runcolor=black, urlcolor=black}
\clubpenalty = 10000
\widowpenalty = 10000
\usetikzlibrary{arrows,calc}
\floatstyle{plaintop}
\restylefloat{table}
\restylefloat{figure}
\begin{document}
\appendix
\section*{Appendix} \label{sec:appendix}
\addcontentsline{toc}{section}{Appendices}
\renewcommand{\thesubsection}{\Alph{subsection}}
\clearpage
\subsection{XYZ}\label{sec:xyz}
\setcounter{table}{0}
\renewcommand{\thetable}{B.\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{B.\arabic{figure}}
\begin{table}[!h]\centering\scriptsize
\rotatebox{90}{%
\begin{minipage}{.84\textheight}
\caption{Table 1.}\label{tab:table1}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{9}{c}}
\toprule
&\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)}\\
\midrule
price\_constant & 10.073\sym{***}& 13.562\sym{***}& 12.093\sym{***}& 11.232\sym{***}& 11.330\sym{***}& 10.572\sym{***}& 10.036\sym{***}& 10.077\sym{***}& 9.665\sym{***} \\
price\_sigma & 4.681\sym{***}& 5.448\sym{***}& 4.756\sym{***}& 4.574\sym{***}& 5.069\sym{***}& 4.596\sym{***}& 4.522\sym{***}& 5.058\sym{***}& 3.827\sym{***} \\
\midrule
wage\_constant & 3.342\sym{***}& 5.133\sym{***} & 4.170\sym{***}& 3.687\sym{***}& 3.812\sym{***}& 3.386\sym{***}& 3.166\sym{***}& 3.136\sym{***}& 3.087\sym{***} \\
wage\_sigma & 3.068\sym{***}& 3.279\sym{***} & 2.995\sym{***}& 2.790\sym{***}& 3.038\sym{***}& 3.046\sym{***}& 2.594\sym{***}& 2.528\sym{***}& 2.418\sym{***} \\
\midrule
Observations & 3104 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\midrule
\addlinespace
&\multicolumn{1}{c}{(10)}&\multicolumn{1}{c}{(11)}&\multicolumn{1}{c}{(12)}&\multicolumn{1}{c}{(13)}&\multicolumn{1}{c}{(14)}&\multicolumn{1}{c}{(15)}&\multicolumn{1}{c}{(16)}&\multicolumn{1}{c}{(17)}\\
\midrule
price\_constant & 9.655\sym{***}& 9.727\sym{***}& 9.675\sym{***}& 9.464\sym{***}& 9.356\sym{***}& 8.711\sym{***}& 8.065\sym{***}& 7.952\sym{***}\\
price\_sigma & 4.249\sym{***}& 4.146\sym{***}& 3.892\sym{***}& 3.951\sym{***}& 4.071\sym{***}& 3.819\sym{***}& 3.885\sym{***}& 5.137\sym{***}\\
\midrule
wage\_constant & 3.229\sym{***}& 3.196\sym{***}& 3.072\sym{***}& 3.157\sym{***}& 3.060\sym{***}& 2.790\sym{***}& 2.709\sym{***}& 2.605\sym{***}\\
wage\_sigma & 2.617\sym{***}& 2.887\sym{***}& 2.512\sym{***}& 2.625\sym{***}& 2.791\sym{***}& 2.667\sym{***}& 3.918\sym{***}& 4.752\sym{***}\\
\midrule
Observations & 194 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\bottomrule\addlinespace
\end{tabular}
\begin{minipage}{17cm} \footnotesize \emph{Notes:} Significance levels: * (p<0.10), ** (p<0.05), *** (p<0.01). \end{minipage}
\end{minipage}
}
\end{table}
\end{document}
答案2
包括表格注释的解决方案适用于threeparttable
:
\documentclass[12pt, a4paper,english,leqno]{article}
\usepackage{eurosym}
\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage{afterpage}
\usepackage{rotating}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[flushmargin]{footmisc}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{calc}
\usepackage{amsfonts,amsmath,amssymb,amsfonts,amsthm}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{delarray}
\usepackage{verbatim}
\usepackage{setspace}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{color}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{threeparttable}
\usepackage{pgfplotstable}
\usepackage{rotating}
\usepackage{placeins}
\usepackage{pdfpages}
\usepackage{lscape}
\usepackage{float}
\usepackage[export]{adjustbox}[2011/08/13]
\usepackage[unicode=true]{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue, anchorcolor=black, citecolor=blue, filecolor=black, menucolor=black, runcolor=black, urlcolor=black}
\clubpenalty = 10000
\widowpenalty = 10000
\usetikzlibrary{arrows,calc}
\floatstyle{plaintop}
\restylefloat{table}
\restylefloat{figure}
\begin{document}
\appendix
\section*{Appendix} \label{sec:appendix}
\addcontentsline{toc}{section}{Appendices}
\renewcommand{\thesubsection}{\Alph{subsection}}
\clearpage
\subsection{XYZ}\label{sec:xyz}
\setcounter{table}{0}
\renewcommand{\thetable}{B.\arabic{table}}
\setcounter{figure}{0}
\renewcommand{\thefigure}{B.\arabic{figure}}
\begin{table}[!h]\centering\scriptsize
\rotatebox{90}{%
\begin{threeparttable}
\caption{Table 1.}\label{tab:table1}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{9}{c}}
\toprule
&\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)}\\
\midrule
price\_constant & 10.073\sym{***}& 13.562\sym{***}& 12.093\sym{***}& 11.232\sym{***}& 11.330\sym{***}& 10.572\sym{***}& 10.036\sym{***}& 10.077\sym{***}& 9.665\sym{***} \\
price\_sigma & 4.681\sym{***}& 5.448\sym{***}& 4.756\sym{***}& 4.574\sym{***}& 5.069\sym{***}& 4.596\sym{***}& 4.522\sym{***}& 5.058\sym{***}& 3.827\sym{***} \\
\midrule
wage\_constant & 3.342\sym{***}& 5.133\sym{***} & 4.170\sym{***}& 3.687\sym{***}& 3.812\sym{***}& 3.386\sym{***}& 3.166\sym{***}& 3.136\sym{***}& 3.087\sym{***} \\
wage\_sigma & 3.068\sym{***}& 3.279\sym{***} & 2.995\sym{***}& 2.790\sym{***}& 3.038\sym{***}& 3.046\sym{***}& 2.594\sym{***}& 2.528\sym{***}& 2.418\sym{***} \\
\midrule
Observations & 3104 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\midrule
\addlinespace
&\multicolumn{1}{c}{(10)}&\multicolumn{1}{c}{(11)}&\multicolumn{1}{c}{(12)}&\multicolumn{1}{c}{(13)}&\multicolumn{1}{c}{(14)}&\multicolumn{1}{c}{(15)}&\multicolumn{1}{c}{(16)}&\multicolumn{1}{c}{(17)}\\
\midrule
price\_constant & 9.655\sym{***}& 9.727\sym{***}& 9.675\sym{***}& 9.464\sym{***}& 9.356\sym{***}& 8.711\sym{***}& 8.065\sym{***}& 7.952\sym{***}\\
price\_sigma & 4.249\sym{***}& 4.146\sym{***}& 3.892\sym{***}& 3.951\sym{***}& 4.071\sym{***}& 3.819\sym{***}& 3.885\sym{***}& 5.137\sym{***}\\
\midrule
wage\_constant & 3.229\sym{***}& 3.196\sym{***}& 3.072\sym{***}& 3.157\sym{***}& 3.060\sym{***}& 2.790\sym{***}& 2.709\sym{***}& 2.605\sym{***}\\
wage\_sigma & 2.617\sym{***}& 2.887\sym{***}& 2.512\sym{***}& 2.625\sym{***}& 2.791\sym{***}& 2.667\sym{***}& 3.918\sym{***}& 4.752\sym{***}\\
\midrule
Observations & 194 & 194 & 194 & 194 & 194 & 194 & 194 & 194 \\
\bottomrule\addlinespace
\end{tabular}
\begin{tablenotes} \footnotesize \item Significance levels: * \(p<0.10\), ** \(p<0.05\), *** \(p<0.01\).
\end{tablenotes}
\end{threeparttable}
}
\end{table}
\end{document}