0

如何在第 3 列和第 4 列之间以及第 2 列和第 3 列之间绘制垂直线?我使用了长表和 \multirow 并将文本包装成表内,但我不知道如何在列之间画线?代码的错误结果在这里: https ://ibb.co/cQfVs1w

    \begin{longtable}[H] {|p{2cm}|p{2.8cm}|p{2.8cm}|p{2.8cm}|}
% table caption is above the table
\caption{xxx}
\label{tab:2}       % Give a unique label
% For LaTeX tables use
%\begin{tabular}{|p{2cm}|p{2.8cm}|p{2.8cm}|p{2.8cm}|}
\\
\hline\noalign{\smallskip}
Reference & Description & Advantages & Limitations  \\
\noalign{\smallskip}\hline\noalign{\smallskip}

xx & xx & {\multirow{3}{*}{\parbox{2.8cm} {1.xxx\\
            2.  xxxx\\
            3.  xxx \\
            4.  xxx \\
            5.  xxx\\
            6.  xxxx\\ 
            7.  xxxx\\
}}}
& {\multirow{3}{*}{\parbox{2.8cm}{ 1.   xxx\\
            2.  xxx\\
            3.  xxx\\
            4.  xxx\\
}}}\\
xx [18] & xxx  &  & \\
xx [6] & xxx  &  & \\
\\
\\
\\
\\
\noalign{\smallskip}\hline
%\end{tabular}
    \end{longtable}
4

1 回答 1

1

你的桌子太复杂了。您可以以更简单易读的方式描述这种表,并且不需要多行。使用 multirow 在非常特殊的情况下很有用,例如,您有一张图片或必须跨越多行的行描述。

这是一个可能的解决方案。

\documentclass{article}

\usepackage{longtable}
%\usepackage{multirow}
\usepackage{booktabs}

\begin{document}
\begin{longtable}[H] {|p{2cm}|p{2.8cm}|p{2.8cm}|p{2.8cm}|}
% table caption is above the table
\caption{xxx}
\label{tab:2}       % Give a unique label
% For LaTeX tables use
%\begin{tabular}{|p{2cm}|p{2.8cm}|p{2.8cm}|p{2.8cm}|}
\\\hline            %%%% \noalign{\smallskip}
Reference & Description & Advantages & Limitations  \\
%%%%%%%% \noalign{\smallskip}\hline\noalign{\smallskip}
\hline
xx      & xx   & 1.  xxx     & 1. xxx\\
xx[18]  & xxx  & 2.  xxxx    & 2. xxx\\
xx [6]  & xxx  & 3.  xxx     & 3. xxx\\
        &      & 4.  xxx     & 4. xxx\\
        &      & 5.  xxx     &       \\
        &      & 6.  xxxx    &       \\ 
        &      & 7.  xxxx    &       \\
\hline
%\end{tabular}
\end{longtable}
\end{document}

在此处输入图像描述 我抑制了在垂直行和水平规则之间产生间隙的 \noalign 。也许他们打算修复 LaTeX 中规则和文本之间不正确的间距,但我建议您改用 booktabs 包。它修复了这个间距,并提供了创建没有垂直列的表格的方法,这些表格更加美观和可读。

\begin{longtable}[H] {p{2cm}p{2.8cm}p{2.8cm}p{2.8cm}}
% table caption is above the table
\caption{xxx}
\label{tab:2}       % Give a unique label
\\\toprule
Reference & Description & Advantages & Limitations  \\
\midrule
xx      & xx   & 1.xxx       & 1. xxx\\
xx[18]  & xxx  & 2.  xxxx    & 2. xxx\\
xx [6]  & xxx  & 3.  xxx     & 3. xxx\\
        &      & 4.  xxx     & 4. xxx\\
        &      & 5.  xxx     &       \\
        &      & 6.  xxxx    &       \\ 
        &      & 7.  xxxx    &       \\
\bottomrule
\end{longtable}

在此处输入图像描述

于 2019-10-14T18:59:33.753 回答