![如何在前一列之后插入第二行?](https://linux22.com/image/396060/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%89%8D%E4%B8%80%E5%88%97%E4%B9%8B%E5%90%8E%E6%8F%92%E5%85%A5%E7%AC%AC%E4%BA%8C%E8%A1%8C%EF%BC%9F.png)
我正在尝试在一行的后面一列中在第一行之后添加第二行。问题是该列中的文本未居中,如下图所示。此外,表格的每一行只有一条垂直线结束。
下面是我正在使用的乳胶代码:
\begin{table}
\centering
\begin{tabular}{ | l | l | l | l | }
\hline
Scene & Type & Time (ms) & Difference \\ \hline
\multirow{2}{*}{A} & Type A & \SI{10}{ms} \\
& Type B & \SI{10}{ms} & \multirow{2}{*}{\SI{0}{ms}} \\ \hline
\multirow{2}{*}{B} & Type A & \SI{10}{ms} \\
& Type B & \SI{10}{ms} & \multirow{2}{*}{\SI{0}{ms}} \\ \hline
\multirow{2}{*}{C} & Type A & \SI{10}{ms} \\
& Type B & \SI{10}{ms} & \multirow{2}{*}{\SI{0}{ms}} \\ \hline
\end{tabular}
\end{table}
如何将“差异(毫秒)”列中的文本居中,就像“场景”列中那样?并修复缺失的行?
任何帮助将非常感激
答案1
像这样?
\documentclass{article}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ | l | l | l | l | }
\hline
Scene & Type & Time (ms) & Difference \\ \hline
\multirow{2}{*}{A} & Type A & \SI{10}{\milli\second} & \multirow{2}{*}{\SI{0}{\milli\second}}\\
& Type B & \SI{10}{\milli\second} & \\ \hline
\multirow{2}{*}{B} & Type A & \SI{10}{\milli\second} & \multirow{2}{*}{\SI{0}{\milli\second}}\\
& Type B & \SI{10}{\milli\second} & \\ \hline
\multirow{2}{*}{C} & Type A & \SI{10}{\milli\second} &\multirow{2}{*}{\SI{0}{\milli\second}} \\
& Type B & \SI{10}{\milli\second} & \\ \hline
\end{tabular}
\end{table}
\end{document}