[Tex/LaTex] The caption overlapping with the table and figures

captionstables

How should I fix the following? The caption overlaps with either of figure and tables.

\begin{table}[]
\caption{\label{tab:compareResult1}
Results of Ablation Studies: Accuracy of different input settings on KenyanFood13.}
\vspace*{-.3cm}
\begin{tabular}{|c|r|r|}
\hline
\multirow{2}{*}{\textbf{Method}}          & \multicolumn{2}{c|}{\textbf{Test Accuracy}}                \\ \cline{2-3} 
                                 &\textbf{Top-1} & \textbf{Top-3} \\ \hline\hline
Image only          &    73.18\%$\pm$ 0.79\%  &  92.04\%$\pm$ 0.44\% \\ \hline
Caption only                &    65.30\%$\pm$ 1.70\%     &   83.68\%$\pm$ 1.55\%   \\ \hline\hline
{\bf Ours:} Image + Caption               &    81.04\%$\pm$ 0.86\%     &  95.95\%$\pm$ 0.44\%   \\ \hline
\end{tabular}
\vspace*{-0.2cm}
\end{table}

enter image description here

Best Answer

Inserting a negative \vspace is most likely the cause behind the overlapping of the \caption and your tabular.

The following removes this and uses a booktabs representation:

enter image description here

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{table}
  \centering
  \caption{Results of Ablation Studies: Accuracy of different input settings on KenyanFood13.}
  \begin{tabular}{ l c c }
    \toprule
                                   & \multicolumn{2}{c}{\bfseries Test accuracy} \\
    \cmidrule{2-3}
    \textbf{Method}                &    \textbf{Top-1}    &    \textbf{Top-3}    \\
    \midrule
    Image only                     & $73.18\% \pm 0.79\%$ & $92.04\% \pm 0.44\%$ \\
    Caption only                   & $65.30\% \pm 1.70\%$ & $83.68\% \pm 1.55\%$ \\
    \textbf{Ours:} Image + Caption & $81.04\% \pm 0.86\%$ & $95.95\% \pm 0.44\%$ \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document}