所以我遇到了一个非常奇怪的问题。
简而言之,当我在 \begin table 后放置 [H] 时,表格无法放在页面上。我不得不放置 [H],因为 Latex 将表格放在了错误的位置(大约 2 页之外)。当我删除 [H] 时,表格可以完美地放在一页上。不幸的是,我无法提供 MWE,因为我无法在 MWE 环境中复制它,但我可以提供基本代码:
\documentclass{article}
\usepackage{ragged2e,array,siunitx,longtable,booktabs}
\begin{document}
\begin{table}
\centering
\small
\setlength{\tabcolsep}{3.7pt}
\caption{Descriptive Statistics (\%): Commerce, EBE and Science faculties. Key: \textbf{G}: Graduate, \textbf{AE}: Academically Excluded, \textbf{C}: Censored}
\label{table:DSCF}
\begin{tabular}{
>{\RaggedRight\arraybackslash}p{.15\textwidth}
*{12}{S[table-format=2.1]}}
\toprule
{\bfseries Variable} &
\multicolumn{3}{c}{\bfseries Commerce} &
\multicolumn{3}{c}{\bfseries EBE} &
\multicolumn{3}{c}{\bfseries Science} &
\multicolumn{3}{c}{\bfseries Total} \\
\cmidrule(rl){2-4}
\cmidrule(rl){5-7}
\cmidrule(rl){8-10}
\cmidrule(rl){11-13}
&
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C}\\
\midrule
\bfseries Total & 50.1 & 7.5 & 42.4 & 35.8 & 21.6 & 42.7 & 46.4 & 26.1 & 27.5 & 45.8 & 14.9 & 39.3 \\
\addlinespace
\bfseries Gender\\
Male & 49.6 & 8.7 & 41.7 & 36.4 & 21.9 & 41.7 & 44.0 & 31.2 & 24.9 & 44.3 & 17.3 & 38.5 \\
Female & 50.7 & 6.2 & 43.1 & 33.8 & 20.6 & 45.7 & 49.3 & 20.2 & 30.5 & 48.0 & 11.5 & 40.5 \\
\addlinespace
\bfseries Race\\
White & 59.8 & 3.0 & 37.2 & 50.8 & 7.8 & 41.3 & 64.5 & 5.1 & 30.4 & 58.7 & 4.6 & 36.7 \\
Black & 38.7 & 13.1 & 48.2 & 22.2 &34.9& 43.0 & 31.0 & 44.5 & 24.5 & 32.5 & 26.3 &41.2\\
Coloured & 49.8 & 7.4 & 42.8 & 36.4 & 21.9 & 41.6 & 40.2 & 30.6 & 29.2 & 44.5 & 16.1 & 39.5 \\
Indian/Asian & 48.9 & 7.9 & 43.3 & 32.7 & 20.5 & 46.9 & 32.7 & 20.5 & 46.9 & 44.6 & 13.3 & 42.1\\
\addlinespace
\multicolumn{4}{l}{\bfseries Financial Aid}\\
Ineligible& 52.1 & 5.5 & 42.4 & 38.0 & 17.7 & 44.3 & 38.0 & 17.7 & 44.3 & 48.7 & 10.6 & 40.7 \\
Eligible & 40.7 & 17.2 & 42.1 & 26.5 & 37.5 & 36.1 & 33.8 & 42.9 & 23.3 & 35.2 & 30.3 & 34.5 \\
\addlinespace
\multicolumn{4}{l}{\bfseries Programme}\\
Mainstream & 55.4 & 5.7 & 38.9 & 40.5 & 17.3 & 42.3 & 54.3 & 16.4 & 29.3 & 51.3 & 10.8 & 37.9 \\
Academic Dev. & 32.5 & 13.7 & 53.8 & 14.1 & 41.4 & 44.5 & 25.3 & 51.8 & 22.8 & 27.1 & 28.7 & 44.2 \\
\addlinespace
\multicolumn{4}{l}{\bfseries English Home Language}\\
Yes & 55.1 & 4.9 & 39.9 & 44.1 & 13.3 & 42.6 & 56.3 & 14.1 & 29.6 & 52.8 & 8.6 & 38.6 \\
No & 38.8 & 13.4 & 47.8 & 22.3 & 35.0 & 42.7 & 32.7 & 42.7 & 24.6 & 32.8 & 26.6 & 40.6 \\
\addlinespace
\multicolumn{4}{l}{\bfseries School Quintile}\\
1 & 34.6 & 30.8 & 34.6 & 14.1 & 49.3 & 36.6 & 34.0 & 45.3 & 20.8 & 26.1 & 42.6 & 31.3 \\
2 & 30.2 & 16.0 & 53.8 & 25.6 & 36.4 & 38.0 & 28.8 & 50.9 & 20.3 & 28.1 & 35.1 & 36.8 \\
3 & 32.0 & 17.5 & 50.5 & 21.7 & 41.9 & 36.5 & 30.0 & 45.8 & 24.2 & 27.7 & 35.3 & 37.0 \\
4 & 37.7 & 17.7 & 44.5 & 17.7 & 38.0 & 44.3 & 30.0 & 46.7 & 23.3 & 29.5 & 32.0 & 38.5 \\
5 & 52.0 & 6.9 & 41.1 & 41.0 & 16.2 & 42.9 & 54.3 & 14.8 & 31.0 & 49.2 & 12.0 & 38.9 \\
Independent & 52.5 & 5.3 & 42.2 & 40.7 & 13.9 & 45.5 & 54.3 &14.8 & 31.0 & 50.4 & 8.6 & 41.0 \\
\addlinespace
\multicolumn{4}{l}{\bfseries Western cape province}\\
Yes & 55.1 & 5.9 &39.0 & 42.1 &16.2 &41.7 & 52.0 &20.0 & 28.0 & 51.3 & 11.6 &37.0 \\
No &46.8 & 8.6 & 44.6 & 31.6 & 25.1 & 43.3 & 41.5 & 31.5 & 27.1 & 41.9 & 17.2 &41.0\\
\addlinespace
\multicolumn{4}{l}{\bfseries Year of First Registration} \\
{2006} & 87.8 & 11.3 & 0.9 & 70.3 & 29.0 & 0.7 & 69.5 & 28.2 & 2.3 & 79.9 & 18.9 &1.2 \\
{2007} & 88.2 & 10.1 & 1.7 & 68.7 & 30.0 & 1.4 & 68.5 & 30.8 & 0.7 & 79.4 &19.2 &1.4\\
{2008} & 87.1 & 10.3 & 2.6 & 63.6 & 30.6 & 5.8 & 66.2 & 32.3 & 1.6 & 76.7 & 20.3 & 3.0 \\
{2009} & 80.9 & 9.7 & 9.4 & 51.2 & 32.3 &16.5 & 51.9 & 43.9 & 4.2 & 64.9 & 24.9 & 10.2 \\
{2010} & 62.6 & 6.4 & 31.1 & 36.8 & 19.0 & 44.2 & 69.8 & 21.0 & 9.3 & 57.5 & 12.7 & 29.8 \\
{2011} & 15.8 & 7.2 & 77.0 & 0.0 & 18.2 & 81.8 & 37.3 & 23.4 & 39.8 & 15.3 & 12.8 & 71.9 \\
{2012} & 0.0 & 5.4 & 94.6 & 0.0 & 7.5 & 92.5 & 0.0 & 13.4 & 86.6 & 0.0 & 7.5 & 92.5 \\
{2013} & 0.0 & 1.7 & 98.3 & 0.0 & 4.9 & 95.1 & 0.0 & 5.1 & 94.9 & 0.0 & 3.0 & 97.0 \\
\end{tabular}
\end{table}
\end{document}
此代码生成此文档(好)
现在,当我将 [H} 放在 \begin{table} 之后时,它会产生以下内容:
这是我的确切代码(我正在使用主 .tex 文件 - 这是其中一章,因此此代码中没有包):
\begin{table} [H]
\centering
\small
\setlength{\tabcolsep}{3.7pt}
\caption{Descriptive Statistics (\%): Commerce, EBE and Science faculties. Key: \textbf{G}: Graduate, \textbf{AE}: Academically Excluded, \textbf{C}: Censored}
\label{table:DSCF}
\begin{tabular}{
>{\RaggedRight\arraybackslash}p{.15\textwidth}
*{12}{S[table-format=2.1]}}
\toprule
{\bfseries Variable} &
\multicolumn{3}{c}{\bfseries Commerce} &
\multicolumn{3}{c}{\bfseries EBE} &
\multicolumn{3}{c}{\bfseries Science} &
\multicolumn{3}{c}{\bfseries Total} \\
\cmidrule(rl){2-4}
\cmidrule(rl){5-7}
\cmidrule(rl){8-10}
\cmidrule(rl){11-13}
&
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C} &
{\bfseries G} & {\bfseries AE} &
{\bfseries C}\\
\midrule
\bfseries Total & 50.1 & 7.5 & 42.4 & 35.8 & 21.6 & 42.7 & 46.4 & 26.1 & 27.5 & 45.8 & 14.9 & 39.3 \\
\addlinespace
\bfseries Gender\\
Male & 49.6 & 8.7 & 41.7 & 36.4 & 21.9 & 41.7 & 44.0 & 31.2 & 24.9 & 44.3 & 17.3 & 38.5 \\
Female & 50.7 & 6.2 & 43.1 & 33.8 & 20.6 & 45.7 & 49.3 & 20.2 & 30.5 & 48.0 & 11.5 & 40.5 \\
\addlinespace
\bfseries Race\\
White & 59.8 & 3.0 & 37.2 & 50.8 & 7.8 & 41.3 & 64.5 & 5.1 & 30.4 & 58.7 & 4.6 & 36.7 \\
Black & 38.7 & 13.1 & 48.2 & 22.2 &34.9& 43.0 & 31.0 & 44.5 & 24.5 & 32.5 & 26.3 &41.2\\
Coloured & 49.8 & 7.4 & 42.8 & 36.4 & 21.9 & 41.6 & 40.2 & 30.6 & 29.2 & 44.5 & 16.1 & 39.5 \\
Indian/Asian & 48.9 & 7.9 & 43.3 & 32.7 & 20.5 & 46.9 & 32.7 & 20.5 & 46.9 & 44.6 & 13.3 & 42.1\\
\addlinespace
\multicolumn{4}{l}{\bfseries Financial Aid}\\
Ineligible& 52.1 & 5.5 & 42.4 & 38.0 & 17.7 & 44.3 & 38.0 & 17.7 & 44.3 & 48.7 & 10.6 & 40.7 \\
Eligible & 40.7 & 17.2 & 42.1 & 26.5 & 37.5 & 36.1 & 33.8 & 42.9 & 23.3 & 35.2 & 30.3 & 34.5 \\
\addlinespace
\multicolumn{4}{l}{\bfseries Programme}\\
Mainstream & 55.4 & 5.7 & 38.9 & 40.5 & 17.3 & 42.3 & 54.3 & 16.4 & 29.3 & 51.3 & 10.8 & 37.9 \\
Academic Dev. & 32.5 & 13.7 & 53.8 & 14.1 & 41.4 & 44.5 & 25.3 & 51.8 & 22.8 & 27.1 & 28.7 & 44.2 \\
\addlinespace
\multicolumn{4}{l}{\bfseries English Home Language}\\
Yes & 55.1 & 4.9 & 39.9 & 44.1 & 13.3 & 42.6 & 56.3 & 14.1 & 29.6 & 52.8 & 8.6 & 38.6 \\
No & 38.8 & 13.4 & 47.8 & 22.3 & 35.0 & 42.7 & 32.7 & 42.7 & 24.6 & 32.8 & 26.6 & 40.6 \\
\addlinespace
\multicolumn{4}{l}{\bfseries School Quintile}\\
1 & 34.6 & 30.8 & 34.6 & 14.1 & 49.3 & 36.6 & 34.0 & 45.3 & 20.8 & 26.1 & 42.6 & 31.3 \\
2 & 30.2 & 16.0 & 53.8 & 25.6 & 36.4 & 38.0 & 28.8 & 50.9 & 20.3 & 28.1 & 35.1 & 36.8 \\
3 & 32.0 & 17.5 & 50.5 & 21.7 & 41.9 & 36.5 & 30.0 & 45.8 & 24.2 & 27.7 & 35.3 & 37.0 \\
4 & 37.7 & 17.7 & 44.5 & 17.7 & 38.0 & 44.3 & 30.0 & 46.7 & 23.3 & 29.5 & 32.0 & 38.5 \\
5 & 52.0 & 6.9 & 41.1 & 41.0 & 16.2 & 42.9 & 54.3 & 14.8 & 31.0 & 49.2 & 12.0 & 38.9 \\
Independent & 52.5 & 5.3 & 42.2 & 40.7 & 13.9 & 45.5 & 54.3 &14.8 & 31.0 & 50.4 & 8.6 & 41.0 \\
\addlinespace
\multicolumn{4}{l}{\bfseries Western cape province}\\
Yes & 55.1 & 5.9 &39.0 & 42.1 &16.2 &41.7 & 52.0 &20.0 & 28.0 & 51.3 & 11.6 &37.0 \\
No &46.8 & 8.6 & 44.6 & 31.6 & 25.1 & 43.3 & 41.5 & 31.5 & 27.1 & 41.9 & 17.2 &41.0\\
\addlinespace
\multicolumn{4}{l}{\bfseries Year of First Registration} \\
{2006} & 87.8 & 11.3 & 0.9 & 70.3 & 29.0 & 0.7 & 69.5 & 28.2 & 2.3 & 79.9 & 18.9 &1.2 \\
{2007} & 88.2 & 10.1 & 1.7 & 68.7 & 30.0 & 1.4 & 68.5 & 30.8 & 0.7 & 79.4 &19.2 &1.4\\
{2008} & 87.1 & 10.3 & 2.6 & 63.6 & 30.6 & 5.8 & 66.2 & 32.3 & 1.6 & 76.7 & 20.3 & 3.0 \\
{2009} & 80.9 & 9.7 & 9.4 & 51.2 & 32.3 &16.5 & 51.9 & 43.9 & 4.2 & 64.9 & 24.9 & 10.2 \\
{2010} & 62.6 & 6.4 & 31.1 & 36.8 & 19.0 & 44.2 & 69.8 & 21.0 & 9.3 & 57.5 & 12.7 & 29.8 \\
{2011} & 15.8 & 7.2 & 77.0 & 0.0 & 18.2 & 81.8 & 37.3 & 23.4 & 39.8 & 15.3 & 12.8 & 71.9 \\
{2012} & 0.0 & 5.4 & 94.6 & 0.0 & 7.5 & 92.5 & 0.0 & 13.4 & 86.6 & 0.0 & 7.5 & 92.5 \\
{2013} & 0.0 & 1.7 & 98.3 & 0.0 & 4.9 & 95.1 & 0.0 & 5.1 & 94.9 & 0.0 & 3.0 & 97.0 \\
\end{tabular}
\end{table}
答案1
如果已到达文档末尾或遇到
\clearpage
,LaTeX 将开始一个新页面,放宽所有限制性浮动条件,并将保留队列中的所有浮动元素放置在浮动页面上进行输出。
\clearpage
因此人们可以尝试在表格之后使用。