合并LaTeX表中的单元格

Joh*_*ohn 11 latex pdflatex

我有一个非常简单的表:

\begin{table}[t]
\begin{tabular}{|c||c|c|c|}
\hline
\multirow{2}{*}{Implementation}         & Test 1  & Test2  &  Test3    \\\hline
                                        & \multicolumn{3}{|c|}{results}   \\\hline\hline
\end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)

它的工作几乎是"完美的",我唯一的问题是hline仍然通过我合并的前两个单元格.基本上,它看起来像这样

"-------------------------------------------------"
"|                | Test 1 | Test 2 | Test 3 |"
" ----Implementation-------------------------------"
"|                |     results      |"  
"-------------------------------------------------"
Run Code Online (Sandbox Code Playgroud)

但是,它应该是这样的:

"-------------------------------------------------" 
"|               | Test 1 | Test 2 | Test 3 |"
"   Implementation    ---------------------------"
"|               |      results     |"   
"-------------------------------------------------"
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何摆脱第一列中的线?

谢谢

Dav*_*ill 21

你想要的命令是\ cline {ij},它允许你只在某些列上绘制一个行分隔符.有关详细信息,请参阅http://www.giss.nasa.gov/tools/latex/ltx-214.html.

特别是,您需要使用\ cline {2-4}在您提到的列之间绘制一条水平线.这是您的代码,其中包含一个更改:

\begin{table}[t]
\begin{tabular}{|c||c|c|c|}
\hline
\multirow{2}{*}{Implementation}         & Test 1  & Test2  &  Test3    \\\cline{2-4}
                                        & \multicolumn{3}{|c|}{results}   \\\hline\hline
\end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)