Search code examples
latexoverleaf

LaTex table corner cell line not showing


I'm using Overleaf to write a report. I can't seem to get the format just right for the top right corner cell. I would also like to center "Correlation coefficient"

\begin{table}[h]
\caption{Correlation coefficient between force plate data and kinematic model data}
\label{IMUvsVB}
\begin{center}
\begin{tabular}{|c||c||c|}
\hline
\textbf{Ground reaction} & \multicolumn{2}{l}{\textbf{Correlation coefficient}} \\
\cline{2-3}
& \textbf{IMU based kinematics} & \textbf{Vision based kinematics}\\
\hline
Anteroposterior &   0.91 &  0.96\\
Mediolateral &  0.80 &  0.79\\
Vertical &  0.97 &  0.99\\
Frontal &   0.64 &  0.66\\
Sagittal &  0.91 &  0.94\\
Transverse &    0.82 &  0.84\\
\hline
\end{tabular}
\end{center}
\end{table} 

enter image description here


Solution

  • Substitute

    \textbf{Ground reaction} & \multicolumn{2}{l}{\textbf{Correlation coefficient}} \\
    

    with

    \textbf{Ground reaction} & \multicolumn{2}{c|}{\textbf{Correlation coefficient}} \\
    

    The \multicolumn command needs 3 inputs:

    • The 1st one is the number of columns to be spanned.
    • The 2nd is the formatting of the cell (l for left, c for center and r for right). Here you can add also | for a single vertical line or even || for a double vertical line.
    • The 3rd one is the content of the cell.

    Have a look at the documentation here if you need more insights on the usage of \multicolumn.