我正在使用 Overleaf 绘制一个包含多行单元格的表格,我遇到了右边框的问题,缺少一些线条,我正在使用下面的代码,我缺少什么?
\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}
答案1
我删除了多余的列说明符并添加了缺失的&
s。
\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}
答案2
您漏掉了 4 个 & 符号。我借此机会对表格布局进行了一些改进(例如,设置\extrarowheight
为 2pt、加载时caption
让标题和表格之间留出合适的间距,以及使用flushleft
表格注释选项)。
\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}