# Multi-pages long tables : how to deal with itemize listing?

I would like to create a multi-pages table similar to this answer on stackexchange ( https://tex.stackexchange.com/a/419760/129702 ) but with the following differences :

• I have 4 columns ("Site", "Description", "Avantages, "Disavantages")
• The two first columns contains text : the two last contains itemize listings
• I don't want the itemize listings to be difficult to read (because of restricted column size) so I am open if needed to merge the two last columns into a single one ("Avantages & Disavantages") and itemize with + / - symbol
• Itemize settings can be strict to limit the empty spaces (nosep,noitemsep,topsep=0pt,partopsep=0pt,after=\vspace*{2pt})
• Any ideas to reduce the space taken by the table would be appreciated

Additional information :

• the "Site" is a simple site name (example: "Hackerrank")
• the "Description" is a short introduction of the site (example: \lipsum*[3])
• In average, there is 5 items in "advantages"
• In average, there is 3-4 items in "disavantages"
• documentclass : report

Thanks for the help

• Please show an example of such a table. How many entries are there in the advanteges/disadvantages part? How much text will there be in the first two columns? Which documentclass do you use? (The available space depends on the documentclass) May 21, 2020 at 14:09
• Probably you could even use a description environment (for "Site" and "Description" and a nested itemize for the advantages/disadvantages part? May 21, 2020 at 14:17
• I add some details : you could use lipsum for that (in average, items could be remplaced by lipsum[1] or lipsum[2] most of the time)
– jy95
May 21, 2020 at 14:19

## 2 Answers

Here is a solution which defines two new columns with compact lists. I pretty sure that it is based on a answer by Heiko Oberdiek, but I was not able to find the answer to give correct reference.

One column is defined as a itemize list, one is defined as a numbered list. You can change the width of the list columns at will. If you prefer that the tabular fills the space between the margin, you can use \extracolsep{\hfill}. You may also use xltabular.

If the heading shall be repeated at each page, just use the normal longtable commands. To cancel enumeration or itemisation for individual cells, you use \multicolumn.

\documentclass{article}
\usepackage{array, longtable, booktabs}
\makeatletter
\newcolumntype{e}[1]{%--- Enumerated cells ---
>{\minipage[t]{\linewidth}%
\NoHyper%                Hyperref adds a vertical space
\let\\\tabularnewline
\settowidth{\leftmargini}{\,9.\hspace{\labelsep}}
\enumerate
\addtolength{\rightskip}{0pt plus 50pt}% for raggedright
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\endenumerate
\endNoHyper
\endminipage}}

\newcolumntype{i}[1]{%--- Itemized cells ---
>{\minipage[t]{\linewidth}%
\let\\\tabularnewline
\settowidth{\leftmargini}{~\hspace{\labelsep}}
\itemize
\addtolength{\rightskip}{0pt plus 50pt}%
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\enditemize\endminipage}}

\AtBeginDocument{%
\@ifpackageloaded{hyperref}{}%
{\let\NoHyper\relax\let\endNoHyper\relax}}
\makeatother

\setlength{\tabcolsep}{3pt}
\setlength{\extrarowheight}{2pt}

\begin{document}

\begin{longtable}{@{\extracolsep{\fill}}p{2cm}p{2cm}i{3.5cm} e{3.5cm}@{}}
\toprule
Site & Description & \multicolumn{1}{l}{Avantages} & \multicolumn{1}{l@{}}{Disavantages}\\
\midrule\endhead %% Repead heading on every page
Text here and there & More left aligned text &
\item Item A is part of a itemised list
\item Item B   &
\item Item 1 is part of a numbered list
\item Item 2   \\
\midrule
Text & Text &
\item Item A
\item Item B   &
\item Item 1
\item Item 2
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\item Item 1
\\
\bottomrule

\end{longtable}

\end{document}

• Thanks for the detailled answer : the heading shall be repetead as I doubt 6 sites with itemize stuff will fit in one page ^^
– jy95
May 21, 2020 at 14:52
• @jy95 Do you need separate first page heading? Footer? May 21, 2020 at 14:58
• No footer is needed : with 6 sites, the table is a little bit for that
– jy95
May 21, 2020 at 15:00
• @jy95 If the Site column is only one line, you may change the first p{2cm} with an l. May 21, 2020 at 15:10

Here is an example using nested desctiption and itemize lists. The layout can be further customized using the enumitem package:

\documentclass{report}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\setlist[itemize]{label=+.,leftmargin=*, nosep}
\begin{description}
\item[a term]\lipsum[3]
\begin{itemize}
\item[+] \lipsum[1][1]
\item[+] \lipsum[1][1]\lipsum[1][2] \lipsum[1][3]
\item[--] \lipsum[1][1]
\item[--] \lipsum[1][1]\lipsum[1][2] \lipsum[1][3]
\end{itemize}
\item[another term]\lipsum[5]
\begin{itemize}
\item[+] \lipsum[1][1]
\item[+] \lipsum[1][1]\lipsum[1][2] \lipsum[1][3]
\item[--] \lipsum[1][1]
\item[--] \lipsum[1][1]\lipsum[1][2] \lipsum[1][3]
\end{itemize}
\end{description}
\end{document}