Nested list in table cell

liststables

I'm using the Latex table generator to create a large table, which should include several lists and several split cells in some rows. Below you can find a cropped screenshot of this large table.

Latex table generator screenshot

The generated code is as follows:

% Please add the following required packages to your document preamble:
% \usepackage{multirow}
% \usepackage{graphicx}
\begin{table}[]
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|}
\hline
\textbf{a} & \textbf{b} & \textbf{c} & \textbf{d} & \textbf{e} \\ \hline
1 & \begin{tabular}[c]{@{}c@{}}* x1\\ * x2\\ * x3\\ *x4\\ * x5\\ * x6\\ * x7\\ * x8\\ * x9\\ * x10\\ *x11\\ * x12\\ * x13\end{tabular} & h1largercell & 1thiswasaddedtomakethecelllarger & 1largercell \\ \hline
\multirow{2}{*}{2} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}* y1\\ * y2\\ * y3\\ * y4\\ * y5\\ * y6\\ * y7\\ *y8\\ * y9\\ * y10\end{tabular}} & h2 & 9 & 12 \\ \cline{3-5} 
 &  & h3 & 3 & 12 \\ \hline
3 & \begin{tabular}[c]{@{}c@{}}* z1\\ * z2\\ * z3\\ * z4\\ * z5\\ * z6\\ * z7\\ *z8\\ * z9\\ * z10\end{tabular} & h4 & 1 & 1 \\ \hline
\multirow{4}{*}{4} & \multirow{4}{*}{\begin{tabular}[c]{@{}c@{}}* k1\\ *k2\\ * k3\\ * k4\end{tabular}} & h5 & 8 & \multirow{4}{*}{21} \\ \cline{3-4}
 &  & h6 & 1 &  \\ \cline{3-4}
 &  & h7 & 3 &  \\ \cline{3-4}
 &  & h8 & 2 &  \\ \hline
\end{tabular}%
}
\caption{Sample}
\label{tab:SampleTable}
\end{table}

I loaded all necessary packages but, unfortunately, the end result after compiling always looks as follows in my document:

Result in compiled document

The overlap in the first column is especially annoying. I'm aiming for nested lists in each table cell and this question comes very close to what I would like to achieve. Unfortunately, it does not account for the split cells in the lower rows.

Any help or ideas how to integrate both concepts (i.e. nested lists and split cells) are highly appreciated.

Best Answer

The following tabularray-based approach may get you started:

enter image description here

\documentclass{article}
\usepackage{tabularray}


\usepackage{enumitem}
\newlist{tabitem}{itemize}{1}
\setlist[tabitem]{label=\textbullet, noitemsep,leftmargin=*,topsep=0pt,partopsep=0pt, nosep, before=\begin{minipage}[t]{\hsize}, after=\end{minipage}}

\begin{document}
\begin{table}
\caption{caption text}
\label{tab:key}
\begin{tblr}{colspec={cm{1cm}ccc}, hlines, vlines, vspan=even, rows = {m}}
\textbf{a} & \textbf{b} & \textbf{c} & \textbf{d} & \textbf{e} \\ 
1 
  & \begin{tabitem}
       \item x1
       \item x2
       \item x3
       \item x4 
       \item x5 
       \item x6
       \item x7
       \item x8
       \item x9
       \item x10
       \item x11
       \item x12
       \item x13
     \end{tabitem}
  & h1largercell 
  & 1thiswasaddedtomakethecelllarger 
  & 1largercell \\ 
\SetCell[r=2]{} 2 
  & \SetCell[r=2]{} 
    \begin{tabitem}
       \item y1
       \item y2
       \item y3
       \item y4 
       \item y5 
       \item y6
       \item y7
       \item y8
       \item y9
       \item y10
     \end{tabitem} 
  & h2 
  & 9 
  & 12 \\  
 &  & h3 & 3 & 12 \\
3 
  & \begin{tabitem}
       \item z1
       \item z2
       \item z3
       \item z4 
       \item z5 
       \item z6
       \item z7
       \item z8
       \item z9
       \item z10
     \end{tabitem} 
  & h4 
  & 1 
  & 1 \\
\SetCell[r=4]{} 4 
  & \SetCell[r=4]{}    
    \begin{tabitem}
       \item k1
       \item k2
       \item k3
       \item k4 
     \end{tabitem} 
  & h5 
  & 8 
  & \SetCell[r=4]{} 21 \\ 
 &  & h6 & 1 &  \\ 
 &  & h7 & 3 &  \\ 
 &  & h8 & 2 &  \\ 
\end{tblr}
\end{table}


\end{document}
Related Question