2

I have a table with four columns. The problem is:

  • The text overflows in the third and fourth column as shown in below image. These columns contains dense text.
  • The text should be within table.

I tried by searching the existing answers (1,2), but most of them are using p{width} column type. This method is not working with multirow situation.

enter image description here

Desired table:

enter image description here

Here is an example to illustrate the problem:

\documentclass{article}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}
\begin{table}[H]
\caption{}
\label{tab:my-table}
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l|l|l|}
\hline
\textbf{Research group} & \textbf{Ref} & \textbf{Common attributes} & \textbf{features noted} \\ \hline
(Yasir et al., 2020) &
  [1] &
  \multirow{9}{*}{\begin{tabular}[c]{@{}l@{}}1) blah blah blah blah blah blah blah blah blah blah blah.\\ ---------------------------------------------------------\\ \\ -------------------------------------------------------\\ \\ ------------------------------------------------------\\ \\ \\ \\ 2). blah blah blah blah blah blah blah blah blah blah blah.\\ ---------------------------------------------------------\\ \\ -------------------------------------------------------\\ \\ ------------------------------------------------------\\ \\ \\ \\ 3)- blah blah blah blah blah blah blah blah blah blah blah.\\ ---------------------------------------------------------\\ \\ -------------------------------------------------------\\ \\ -----------------------------------------------------\\ \\ \\ \\ \\ blah blah blah blah blah blah blah blah blah blah blah.\\ \\ ---------------------------------------------------------\\ \\ -------------------------------------------------------\\ \\ ------------------------------------------------------\end{tabular}} &
  \multirow{9}{*}{\begin{tabular}[c]{@{}l@{}}1).blah blah blah blah blah blah blah blah blah blah blah.\\ \\ ---------------------------------------------------------\\ -------------------------------------------------------\\ ------------------------------------------------------\\ \\ 2). blah blah blah blah blah blah blah blah blah blah blah.\\ \\ ---------------------------------------------------------\\ -------------------------------------------------------\\ ------------------------------------------------------\\ \\ \\ 3).blah blah blah blah blah blah blah blah blah blah blah.\\ \\ ---------------------------------------------------------\\ -------------------------------------------------------\\ -----------------------------------------------------\\ \\ \\ \\ 4). blah blah blah blah blah blah blah blah blah blah blah.\\ ---------------------------------------------------------\\ \\ ------------------------------------------------------\\ \\ ------------------------------------------------------\end{tabular}} \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \cline{1-2}
(Yasir et al., 2020)    & [1]          &                            &                         \\ \hline
\end{tabular}%
}
\end{table}
\end{document}
Zarko
  • 296,517
Case Msee
  • 229

2 Answers2

2

From your desired table, I think you may want something like this.

enter image description here

\documentclass{article}

\usepackage{tabularray} \usepackage{lipsum} \UseTblrLibrary{booktabs}

\begin{document} \begin{table} \caption{} \label{tab:my-table} \begin{tblr}{ width = \textwidth, stretch = 1.5, colspec={X[0.5,m] Q[c,m] *{2}{X[m]}}, row{1} = {font=\bfseries}, vspan = even } \toprule Research group & Ref & Common attributes & features noted \\midrule (Yasir et al., 2020) & [1] & \SetCell[r=3]{halign=l, valign=h} \lipsum[1][1-2] & \SetCell[r=3]{halign=l, valign=h} \lipsum[1][1-2]\ (Yasir et al., 2020) & [1] & & \ (Yasir et al., 2020) & [1] & & \ \midrule (Yasir et al., 2020) & [1] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2]\ (Yasir et al., 2020) & [1] & & \ \midrule (Yasir et al., 2020) & [1] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2]\ (Yasir et al., 2020) & [1] & & \ \midrule (Yasir et al., 2020) & [1] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2] & \SetCell[r=2]{halign=l, valign=h} \lipsum[1][1-2]\ (Yasir et al., 2020) & [1] & & \ \bottomrule \end{tblr}% \end{table} \end{document}

Edit (according to OP's comment): A table with lists using Ulrike Fischer's answer here.

\documentclass{article}

\usepackage{tabularray} \usepackage{enumitem} \usepackage{lipsum} \UseTblrLibrary{booktabs}

%to remove space from top of the list \makeatletter \newcommand\novspace{@minipagetrue} \makeatother

\begin{document} \begin{table} \caption{} \label{tab:my-table} \begin{tblr}{ width = \textwidth, stretch = 1.5, % vlines, %uncomment if you want vertical lines colspec={X[0.5,m] Q[c,m] {2}{X[c,m]}}, row{1} = {font=\bfseries}, vspan = even } \toprule Research group & Ref & Common attributes & features noted \\midrule (Yasir et al., 2020) & [1] & \SetCell[r=9]{halign=l, valign=h} \parbox[t]{\linewidth}{\novspace %to remove space from the bottom of the list \begin{itemize}[leftmargin=] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \end{itemize}} & \SetCell[r=9]{halign=l, valign=h} \parbox[t]{\linewidth}{\novspace \begin{itemize}[leftmargin=*] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \end{itemize}}\\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\cmidrule{1-2} (Yasir et al., 2020) & [1] & & \\bottomrule \end{tblr}% \end{table} \end{document}

enter image description here

Imran
  • 3,096
  • The third and fourth colomn should not have horizontal lines, rather merged into single row which contain text in bullets. Howver first two colmns should have the horizontal lines along the row as shown in desired image in question. – Case Msee Jan 11 '22 at 06:44
  • @CaseMsee See the edited answer. – Imran Jan 11 '22 at 07:30
2

A small variation of the @Imran answer (+1):

  • for list settings is employed etoolbox
  • no parbox
  • used are vertical lines (as you show in question)
\documentclass{article}
\usepackage[margin=25mm]{geometry}              % new
\usepackage[skip=1ex, 
            font=small, labelfont=bf]{caption}  % new

\usepackage{tabularray} \UseTblrLibrary{varwidth} % new

\usepackage{enumitem} \usepackage{etoolbox} % new \AtBeginEnvironment{table}% % new { \setlist[itemize]{label=\textbullet, wide, after=\end{minipage},
before=\begin{minipage}[t]{\linewidth} } } \usepackage{lipsum}

\begin{document} \begin{table}[ht] \caption{} \label{tab:my-table} \begin{tblr}{hlines, vlines, colspec={X[0.5,l] c X[h, j] X[h, j]}, colsep = 4pt, row{1} = {font=\small\bfseries}, measure = vbox, vspan =even } Research group
& Ref. & Common attributes & Features noted \ (Yasir et al., 2020) & [1] & \SetCell[r=9] {j} \begin{itemize} \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \end{itemize} & \SetCell[r=9] {j} \begin{itemize} \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \item \lipsum[1][1-3] \end{itemize} \ (Yasir et al., 2020)
& [2] & & \ (Yasir et al., 2020)
& [3] & & \ (Yasir et al., 2020)
& [4] & & \ (Yasir et al., 2020)
& [5] & & \ (Yasir et al., 2020)
& [6] & & \ (Yasir et al., 2020)
& [7] & & \ (Yasir et al., 2020)
& [8] & & \ (Yasir et al., 2020)
& [9] & & \ \end{tblr}% \end{table} \end{document}

enter image description here

Zarko
  • 296,517