标题在浮动之外

标题在浮动之外

我有下面提到的代码,它给出了标题超出浮动错误。请告诉我为什么会出现这个错误。

\begin{center}
\caption{
Table 10. Performance for the seven models using the top 10 features from model D3 on the test dataset. \label{long}}\\
\vspace{15}
\begin{tabular}{|c c c|} 
 \hline
 Models & AUC & RMSE  \\ [0.5ex] 
 \hline\hline
M1 & 0.640431 & 0.459820 \\
 \hline\hline
M2 & 0.980599 & 0.179471 \\
 \hline\hline
M3 & 0.985183 & 0.112334 \\
 \hline\hline
D1 & 0.712025 & 0.158077 \\
 \hline\hline
D2 & 0.838344 & 0.120950 \\
 \hline\hline
D3 & 0.753037 & 0.117660 \\
 \hline\hline
D4 & 0.711824 & 0.814445\\
 \hline
\end{tabular}
\vspace{15pt}
\end{center}

答案1

只需将您的tabular环境包装在一个可以拥有和的table浮动实体的环境中。captionlabel

\documentclass{article}

\begin{document}
    \listoftables
    
    \vspace{2cm}
    
    \begin{table}[ht]
        \centering
        \begin{tabular}{|c c c|} 
            \hline
            Models & AUC & RMSE  \\ [0.5ex] 
            \hline\hline
            M1 & 0.640431 & 0.459820 \\
            \hline\hline
            M2 & 0.980599 & 0.179471 \\
            \hline\hline
            M3 & 0.985183 & 0.112334 \\
            \hline\hline
            D1 & 0.712025 & 0.158077 \\
            \hline\hline
            D2 & 0.838344 & 0.120950 \\
            \hline\hline
            D3 & 0.753037 & 0.117660 \\
            \hline\hline
            D4 & 0.711824 & 0.814445\\
            \hline
        \end{tabular}
        %Previous method: \renewcommand\thetable{10} %If you want to change the table number manually
        \setcounter{table}{9} %If you want to change the table number manually
        \caption{Performance for the seven models using the top 10 features from model D3 on the test dataset.}
        \label{table::long}
    \end{table}
    
    This is a reference, \ref{table::long}.
\end{document}

编辑:添加了\centering我忘记做的,并更改了重新编号的方法。感谢@Mico 的评论。

在此处输入图片描述

相关内容