Inappropriate column size when using \multicolumn

multicolumntables

I have a column size problem when using \multicolumn, please see the following pic:

enter image description here

The size of the second column is bigger than the size of the first column, which should be balanced (like the rest of the columns).

The corresponding latex code:

\begin{table}[!t]
    \renewcommand\tabcolsep{5.5pt}
    \caption{Performance}
    \begin{center}
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
            \hline
            \multirow{2}{*}{Method} & \multicolumn{2}{c|}{\emph{shapes\_translation}} & \multicolumn{2}{c|}{\emph{shapes\_6dof}}   & \multicolumn{2}{c|}{\emph{poster\_6dof}}   & \multicolumn{2}{c|}{\emph{slider\_depth}} \\ \cline{2-9}
            & AOR                 & AR                 & AOR              & AR               & AOR              & AR               & AOR                & AR            \\ \hline
            SiamFC\cite{bertinetto2016fully}                  & 0.812             & 0.940            & 0.835          & 0.968          & 0.830          & 0.956          & 0.909            & \textbf{1.000}       \\ \hline
            ECO\cite{danelljan2017eco}                     & 0.823               & 0.943              & 0.847            & 0.969            & 0.846            & 0.960            & \textbf{0.947}              & \textbf{1.000}         \\ \hline
            SiamRPN++\cite{Li_2019_CVPR}     & 0.790             & 0.942            & 0.779          & 0.972          & 0.753          & 0.899          & 0.907            & \textbf{1.000}       \\ \hline
            ATOM\cite{Danelljan_2019_CVPR}       & 0.815             & 0.945            & 0.803          & 0.974          & 0.835          & 0.961          & 0.897            & \textbf{1.000}       \\ \hline
            E-MS\cite{barranco2018real}                  & 0.675    & 0.768   & 0.612 & 0.668 & 0.417 & 0.373 & 0.447   & 0.350  \\ \hline
            RMRNet-TS                  & 0.491    & 0.564   & 0.467 & 0.509 & 0.504 & 0.558 & 0.814   & 0.993  \\ \hline
            RMRNet                  & \textbf{0.836}    & \textbf{0.951}   & \textbf{0.866} & \textbf{0.980} & \textbf{0.859} & \textbf{0.962} & 0.915   & \textbf{1.000}  \\ \hline
        \end{tabular}
    \end{center}
\end{table}

I have found that 'shapes_translation' is longer than the other titles (such as shapes_6dof), which makes the unbalanced column size. But I do not know how to fix it. Any help will be appreciated, thank you in advance.

Update:

I have modified the code according to Ben's answer in Table column widths disproportionate due to multicolumn cell being too long

The new table and the new code:
enter image description here

\newlength\widthSubTabTwo
\settowidth\widthSubTabTwo{shapes\_translation}
\newlength\lengthTwo
\setlength\lengthTwo{\dimexpr(\widthSubTabTwo+2\tabcolsep)/2-2\tabcolsep\relax}

\begin{table}[!t]
    \renewcommand\tabcolsep{5.5pt}
    \caption{Performance}
    \begin{center}
        \begin{tabular}{|c|*{2}{w{c}{\lengthTwo}}|c|c|c|c|c|c|}
            \hline
            \multirow{2}{*}{Method} & \multicolumn{2}{c|}{\emph{shapes\_translation}} & \multicolumn{2}{c|}{\emph{shapes\_6dof}}   & \multicolumn{2}{c|}{\emph{poster\_6dof}}   & \multicolumn{2}{c|}{\emph{slider\_depth}} \\ \cline{2-9}
            & AOR                 & AR                 & AOR              & AR               & AOR              & AR               & AOR                & AR            \\ \hline
            SiamFC\cite{bertinetto2016fully}                  & 0.812             & 0.940            & 0.835          & 0.968          & 0.830          & 0.956          & 0.909            & \textbf{1.000}       \\ \hline
            ECO\cite{danelljan2017eco}                     & 0.823               & 0.943              & 0.847            & 0.969            & 0.846            & 0.960            & \textbf{0.947}              & \textbf{1.000}         \\ \hline
            SiamRPN++\cite{Li_2019_CVPR}     & 0.790             & 0.942            & 0.779          & 0.972          & 0.753          & 0.899          & 0.907            & \textbf{1.000}       \\ \hline
            ATOM\cite{Danelljan_2019_CVPR}       & 0.815             & 0.945            & 0.803          & 0.974          & 0.835          & 0.961          & 0.897            & \textbf{1.000}       \\ \hline
            E-MS\cite{barranco2018real}                  & 0.675    & 0.768   & 0.612 & 0.668 & 0.417 & 0.373 & 0.447   & 0.350  \\ \hline
            RMRNet-TS                  & 0.491    & 0.564   & 0.467 & 0.509 & 0.504 & 0.558 & 0.814   & 0.993  \\ \hline
            RMRNet                  & \textbf{0.836}    & \textbf{0.951}   & \textbf{0.866} & \textbf{0.980} & \textbf{0.859} & \textbf{0.962} & 0.915   & \textbf{1.000}  \\ \hline
        \end{tabular}
    \end{center}
\end{table}

Then, the problem is solved, but I have a new problem. The red vertical line is missing. I am a newbie at this, please help.

Best Answer

The new LaTeX3 package tabularray has an option hspan=even for distributing extra space evenly:

\documentclass{article}

\usepackage{tabularray}
\usepackage{caption}

\begin{document}

\begin{table}[!t]
    \centering
    \caption{Performance}
        \begin{tblr}{
          colspec = |c|c|c|c|c|c|c|c|c|,
          cell{1}{1} = {r=2}{c}, % multirow
          cell{1}{even} = {c=2}{c}, % multicolumn
          hspan = even, % distribute extra space evenly
          colsep = 5.5pt,
        }
        \hline
          Method & \emph{shapes\_translation} & & \emph{shapes\_6dof} & & \emph{poster\_6dof} & & \emph{slider\_depth} & \\
        \cline{2-9}
                 & AOR & AR                     & AOR & AR              & AOR & AR              & AOR & AR \\
        \hline
            SiamFC\cite{bertinetto2016fully}
                 & 0.812  & 0.940               & 0.835    & 0.968      & 0.830   & 0.956       & 0.909 & \textbf{1.000} \\
        \hline
            ECO\cite{danelljan2017eco}
                 & 0.823  & 0.943 & 0.847  & 0.969 & 0.846   & 0.960  & \textbf{0.947}  & \textbf{1.000} \\
        \hline
            SiamRPN++\cite{Li_2019_CVPR}
                 & 0.790  & 0.942  & 0.779  & 0.972 & 0.753  & 0.899  & 0.907 & \textbf{1.000} \\
        \hline
            ATOM\cite{Danelljan_2019_CVPR}
                 & 0.815   & 0.945  & 0.803  & 0.974 & 0.835  & 0.961  & 0.897 & \textbf{1.000} \\
        \hline
            E-MS\cite{barranco2018real}
                 & 0.675    & 0.768   & 0.612 & 0.668 & 0.417 & 0.373 & 0.447   & 0.350  \\
        \hline
            RMRNet-TS 
                 & 0.491    & 0.564   & 0.467 & 0.509 & 0.504 & 0.558 & 0.814   & 0.993  \\ \hline
            RMRNet
                 & \textbf{0.836} & \textbf{0.951} & \textbf{0.866} & \textbf{0.980} & \textbf{0.859} & \textbf{0.962} & 0.915   & \textbf{1.000}  \\
        \hline
        \end{tblr}
\end{table}

\end{document} 

enter image description here

Related Question