1

I am using Overleaf to draw a Table that contained multirow cells, I am facing a problem with the right border, there are missing lines, I am using the code below, what I am missing?

\begin{table}[ht]
  \caption{Mann Whitney U Participants sex}
  \label{tab:man_whitnet_sig}
     \begin{threeparttable}[t]
 \centering
\begin{tabular}{|l|c|c|c|c|c|l|l|}
\hline
      \multicolumn{2}{|l|}{Sex} & N &   Mean Rank   & $\sum Ranks$& U & Sig. \\ \hline
\multirow{2}{*}{ P10} & Male & 24 &17.31 &415.50& \multirow{3}{*}{115.5}&\multirow{3}{*}{0.031} \\ \cline{2-5} 
                     & Female & 16 & 25.28 & 494.50 &  \\ \cline{2-5}
                           & Total & 40 &  &  & & \\ \hline
 \multirow{2}{*}{P11} & Male & 24 & 17.08&410.00& \multirow{3}{*}{110.00}&\multirow{3}{*}{0.021} \\ \cline{2-5} 
                           & Female & 16 & 25.63 & 410.00 &  \\ \cline{2-5}
                           & Total & 40 &  &  & & \\ \hline    
 \multirow{2}{*}{P12} & Male & 24 &18.13 &435.00& \multirow{3}{*}{135.00}&\multirow{3}{*}{0.099} \\ \cline{2-5} 
                           & Female & 16 & 47.04 & 2258.00 &  \\ \cline{2-5}
                           & Total & 40 &  &  & & \\ \hline                 
     \multicolumn{2}{|l|}{Academic Degree} & N &    Mean Rank   & $\sum Ranks$& U & Sig. \\ \hline
\multirow{2}{*}{ P3} & Bachelor & 30 &22.2 &666.0& \multirow{3}{*}{99.00}&\multirow{3}{*}{0.099} \\ \cline{2-5} 
                     & Master & 10 & 15.40 & 154.0 &  \\ \cline{2-5}
                           & Total & 40 &  &  & & \\ \hline                       
  \end{tabular}
   \begin{tablenotes}\footnotesize
        \item *. Correlation is significant at the 0.05 level (1-tailed).
        \item P3. Apply Threat Modeling. P10. Track Vulnerabilities. P11. Improve Development Process. P12. Perform Security Training. 
  
    \end{tablenotes}
    \end{threeparttable}
\end{table} 

enter image description here

2 Answers 2

1

I removed the superfluous column specifier and added the missing &s.

enter image description here

\documentclass{article}
\usepackage{threeparttable}
\usepackage{multirow}
\begin{document}
\begin{table}[ht]
  \caption{Mann Whitney U Participants sex}
  \label{tab:man_whitnet_sig}
     \begin{threeparttable}[t]
 \centering
\begin{tabular}{|l|c|c|c|c|c|l|} % <------------ removed l| from here. You declared 8 columns but only use 7
\hline
\multicolumn{2}{|l|}{Sex}             & N  & Mean Rank  & $\sum Ranks$ & U                       & Sig.                    \\ \hline      %<--------- removed superfluous blank in \multirow command
\multirow{2}{*}{P10}  & Male          & 24 & 17.31      & 415.50       & \multirow{3}{*}{115.5}  & \multirow{3}{*}{0.031}  \\ \cline{2-5} 
                      & Female        & 16 & 25.28      & 494.50       &                         &                         \\ \cline{2-5}
                      & Total         & 40 &            &              &                         &                         \\ \hline      %<--------- added missing &
\multirow{2}{*}{P11}  & Male          & 24 & 17.08      & 410.00       & \multirow{3}{*}{110.00} & \multirow{3}{*}{0.021}  \\ \cline{2-5} 
                      & Female        & 16 & 25.63      & 410.00       &                         &                         \\ \cline{2-5}
                      & Total         & 40 &            &              &                         &                         \\ \hline       %<--------- added missing &
\multirow{2}{*}{P12}  & Male          & 24 & 18.13      & 435.00       & \multirow{3}{*}{135.00} & \multirow{3}{*}{0.099}  \\ \cline{2-5} 
                      & Female        & 16 & 47.04      & 2258.00      &                         &                         \\ \cline{2-5}
                      & Total         & 40 &            &              &                         &                         \\ \hline      %<--------- added missing &          
\multicolumn{2}{|l|}{Academic Degree} & N  & Mean Rank  & $\sum Ranks$ & U                       & Sig.                    \\ \hline
\multirow{2}{*}{ P3}  & Bachelor      & 30 & 22.2       & 666.0        & \multirow{3}{*}{99.00}  &\multirow{3}{*}{0.099}   \\ \cline{2-5} 
                      & Master        & 10 & 15.40      & 154.0        &                         &                         \\ \cline{2-5}
                      & Total         & 40 &            &              &                         &                         \\ \hline      %<--------- added missing &                  
  \end{tabular}
   \begin{tablenotes}\footnotesize
        \item *. Correlation is significant at the 0.05 level (1-tailed).
        \item P3. Apply Threat Modeling. P10. Track Vulnerabilities. P11. Improve Development Process. P12. Perform Security Training. 
    \end{tablenotes}
    \end{threeparttable}
\end{table} 

\end{document}
1
  • Thank you very much
    – Mai
    May 18, 2021 at 19:48
1

You were missing 4 ampersands. I took the opportunity to add some improvements to the layout of the table (such as setting \extrarowheight to 2pt, loading caption to have a decent spacing between caption and table, and using the flushleft option for the table notes).

\documentclass{article}
\usepackage{array, threeparttable, multirow}
\usepackage{caption} 
\usepackage{amsmath} 

\begin{document}

\begin{table}[ht]
  \caption{Mann Whitney U Participants sex}
  \label{tab:man_whitnet_sig}
     \begin{threeparttable}[t]
 \centering\setlength{\extrarowheight}{2pt}
\begin{tabular}{|l|c|c|c|c|c|l|l|}
\hline
      \multicolumn{2}{|l|}{Sex} & N & Mean Rank & $\sum\text{Ranks}$& U & Sig. \\ \hline
\multirow{2}{*}{P10} & Male & 24 &17.31 &415.50& \multirow{3}{*}{115.5}&\multirow{3}{*}{0.031} \\ \cline{2-5}
                     & Female & 16 & 25.28 & 494.50 & & \\ \cline{2-5}
                           & Total & 40 & & & & \\ \hline
 \multirow{2}{*}{P11} & Male & 24 & 17.08&410.00& \multirow{3}{*}{110.00}&\multirow{3}{*}{0.021} \\ \cline{2-5}
                           & Female & 16 & 25.63 & 410.00 & & \\ \cline{2-5}
                           & Total & 40 & & & & \\ \hline
 \multirow{2}{*}{P12} & Male & 24 &18.13 &435.00& \multirow{3}{*}{135.00}&\multirow{3}{*}{0.099} \\ \cline{2-5}
                           & Female & 16 & 47.04 & 2258.00 & & \\ \cline{2-5}
                           & Total & 40 & & & & \\ \hline
     \multicolumn{2}{|l|}{Academic Degree} & N & Mean Rank & $\sum \text{Ranks}$& U & Sig. \\ \hline
\multirow{2}{*}{ P3} & Bachelor & 30 &22.2 &666.0& \multirow{3}{*}{99.00}&\multirow{3}{*}{0.099} \\ \cline{2-5}
                     & Master & 10 & 15.40 & 154.0 & & \\ \cline{2-5}
                           & Total & 40 & & & & \\ \hline
  \end{tabular}
   \begin{tablenotes}[flushleft]\footnotesize
        \item *. Correlation is significant at the 0.05 level (1-tailed).
        \item P3. Apply Threat Modeling. P10. Track Vulnerabilities. P11. Improve Development Process. P12. Perform Security Training.
    \end{tablenotes}
    \end{threeparttable}
\end{table}

\end{document} 

enter image description here

5
  • You have put a extra space before P10. May 18, 2021 at 19:50
  • 1
    @F.Pantigny: I didn't put myself. It was in the original code (same problem for P3) and I didn't notice it. I've fixed it. Thank you for warning me!
    – Bernard
    May 18, 2021 at 19:59
  • Thank you guys for the modifications, it seems helpful
    – Mai
    May 18, 2021 at 20:05
  • @Mai, your thankfulness you should express by up-voting of answer :-)
    – Zarko
    May 18, 2021 at 21:49
  • The problem is that I can not mark two answers as solutions at the same time, otherwise, I will check your response as a solution too.
    – Mai
    May 20, 2021 at 4:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .