Chris33 Chris33 - 3 months ago 28
LaTeX Question

Line missing from Latex table

I have made a table in latex in the following format,

\begin{table}[H]
\centering
\begin{tabular}{|p{3.5cm}|l|l|l|l|l|l|l|p{1.0cm}|}
\hline
&\multicolumn{7}{c|}{Different values of K}\\
\cline{2-8}
1 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & sum\\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
\end{tabular}
\caption {sum}
\label{tab:sum}
\end{table}


However when I run it, there is a line missing on the table at the top right corner. Can anyone please help me to fix this issue? I am not able to solve it.
I am using online latex.
Thank You.

Answer

Just add a "&" at the end of this line: &\multicolumn{7}{c|}{Different values of K} &\\

Comments