
我在表中使用多行作為最右邊的列,但垂直線被截斷。我該如何解決?
\begin{table*}[t]
\begin{center}
\resizebox{1\textwidth}{!}{
%\scriptsize
\begin{tabular}{|l|l|cc|cc|cc|cc|r|}
\hline%\noalign{\smallskip}
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} &
\multicolumn{2}{c|}{$\text{x}_{1:5} \rightarrow \hat{\text{x}}_{6:15}$} & \multicolumn{2}{c|}{$\text{x}_{1:5} \rightarrow \hat{\text{x}}_{6:20}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:20}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multirow{2}{*}{\# Params} \\
& & SSIM & MSE & SSIM & MSE & SSIM & MSE & SSIM & MSE \\
\hline
\end{tabular}
}
\end{center}
答案1
正如萊德里斯所說,第二行的最後一條垂直線沒有繪製,因為您的行不完整,因為沒有最後一個單元格。放在&
該行的末端會建立該儲存格並繪製規則。
您也可以考慮套餐nicematrix
。在該包的環境中,總是繪製前言中{NiceTabular}
指定的垂直規則。|
不需要添加|
後面,\multicolummn
即使行不完整,也會繪製規則。
\documentclass{article}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{nicematrix}
\begin{document}
\begin{table*}[t]
\begin{center}
\resizebox{1\textwidth}{!}{
%\scriptsize
\begin{NiceTabular}{|l|l|cc|cc|cc|cc|r|}
\hline%\noalign{\smallskip}
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} &
\multicolumn{2}{c}{$\text{x}_{1:5} \rightarrow \hat{\text{x}}_{6:15}$} & \multicolumn{2}{c}{$\text{x}_{1:5} \rightarrow \hat{\text{x}}_{6:20}$} & \multicolumn{2}{c}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:20}$} & \multicolumn{2}{c}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multirow{2}{*}{\# Params} \\
& & SSIM & MSE & SSIM & MSE & SSIM & MSE & SSIM & MSE \\
\hline
\end{NiceTabular}
}
\end{center}
\end{table*}
\end{document}