latex

Missing vertical line in multirow table


I'm trying to make a table, but one vertical lines near "unmap" is missing. Could someone help me to see the mistake?

\documentclass{article}

\usepackage{multirow}
\usepackage{makecell}

\begin{document}
\begin{table}[htbp]
    \centering
    \label{tab:4}
    \begin{tabular}{*{6}{c|}c|c}
        \hline
        \multirow{3}{*}{keyword} & \multicolumn{7}{c}{time (ms)}\\\cline{2-8}
                                & \multirow{2}{*}{map} & \multicolumn{2}{c|}{find} & \multicolumn{2}{c|}{save} & \multirow{2}{*}{unmap} & \multirow{2}{*}{total}\\\cline{3-6}
                                & & max & min & max & min\\\hline 
        1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\\hline
    \end{tabular}
\end{table}
\end{document}

enter image description here

Fill in the vertical line separator between "unmap" and "total".


Solution

  • The line & & max & min & max & min\\\hline has less columns than your table. You can have empty cells, but you can't just leave them out.

    \documentclass{article}
    
    \usepackage{multirow}
    \usepackage{makecell}
    
    \begin{document}
    \begin{table}[htbp]
        \centering
        \label{tab:4}
        \begin{tabular}{*{6}{c|}c|c}
            \hline
            \multirow{3}{*}{keyword} & \multicolumn{7}{c}{time (ms)}\\\cline{2-8}
                                    & \multirow{2}{*}{map} & \multicolumn{2}{c|}{find} & \multicolumn{2}{c|}{save} & \multirow{2}{*}{unmap} & \multirow{2}{*}{total}\\\cline{3-6}
                                    & & max & min & max & min &&\\\hline 
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\\hline
        \end{tabular}
    \end{table}
    \end{document}
    

    enter image description here