Chris33 - 1 year ago 131

LaTeX Question

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 Source

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