0

How I can draw vertical lines between column 3 and 4, also between column 2 and 3? I used long table and \multirow and I wrap the text to become inside table but I do not know how I can draw lines between columns? the wrong result of code is here: 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}
RJFF
  • 37
  • 1
  • 5

1 Answers1

1

Your table is uselessly complicated. You can describe this kind of table in a much simpler and readable way and you do not need multirow. Using multirow is useful in very specific situations, where, for instance, you have a picture, or row description that must span over several rows.

Here is a possible solution.

\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}

enter image description here I suppressed the \noalign that creates gaps between the vertical row and the horizontal rules. Maybe they were intended to fix the incorrect spacing in LaTeX between the rule and the text, but I would suggest you to use instead the booktabs package. It fixes this spacing and provides ways to create tables without vertical columns that are much nicer and readable.

\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}

enter image description here

Alain Merigot
  • 10,667
  • 3
  • 18
  • 31