0

I want to have an enumerated list inside a table, but with varying numbers of items in each cell, appearing like this:enter image description here

This sort of works, but it's of course not enumerating

\begin{tabular}{| p{.45\textwidth} | p{.45\textwidth} |}
\hline
Column 1 Heading & Column 2 Heading \\
\hline
1. Item 1 & 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit.. \\
                   & 3. More and more lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. \\
\hline
4. Perhaps this text could go on for a while too & 5. Item 5 \\
\hline
\end{tabular}
2

You could use the resume* option form the enumitem package in order to get a continued numering even in separate enumerate environments:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{tabular}{| p{.45\textwidth} | p{.45\textwidth} |}
\hline
Column 1 Heading & Column 2 Heading \\
\hline
\begin{enumerate}[series=table,nosep,leftmargin=*,after=\vspace{-\baselineskip},before=\vspace{-0.5\baselineskip}] \item Item 1\end{enumerate} &
\begin{enumerate}[resume*=table] \item Lorem ipsum dolor sit amet, consectetur adipisicing elit.. 
                  \item More and more lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. \end{enumerate}\\
\hline
\begin{enumerate}[resume*=table] \item Perhaps this text could go on for a while too \end{enumerate} & 
\begin{enumerate}[resume*=table] \item Item 5 \end{enumerate}\\
\hline
\end{tabular}
\end{document}

The following MWE contains some improvements concerning the general table layout. With the tabularx package, you could spread the table columns evenly, so that the whole table is exactly as wide as the textwidth. Getting rid of the vertical lines and replacing the \hline commands with the appropriate rules from the booktabs package gives the table a more open look:

\documentclass{article}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{tabularx}{\textwidth}{XX}
\toprule
Column 1 Heading & Column 2 Heading \\
\midrule
\begin{enumerate}[series=table,nosep,leftmargin=*,after=\vspace{-\baselineskip},before=\vspace{-0.5\baselineskip}] \item Item 1\end{enumerate} &
\begin{enumerate}[resume*=table] \item Lorem ipsum dolor sit amet, consectetur adipisicing elit.. 
                  \item More and more lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. \end{enumerate}\\
\begin{enumerate}[resume*=table] \item Perhaps this text could go on for a while too \end{enumerate} & 
\begin{enumerate}[resume*=table] \item Item 5 \end{enumerate}\\
\bottomrule
\end{tabularx}

\end{document}

enter image description here

If you want to use this style of table more often throughout your document, you might also be interested in globally defining a new environment that already contains all the layout arguments. This can be done with the help of \newlist and \setlist.

\documentclass{article}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{booktabs}

\newlist{tabenumi}{enumerate}{1}
\setlist[tabenumi]{label={\arabic*.},nosep,leftmargin=*,after=\vspace{-\baselineskip},before=\vspace{-0.5\baselineskip}}

\begin{document}
\begin{tabularx}{\textwidth}{XX}
\toprule
Column 1 Heading & Column 2 Heading \\
\midrule
\begin{tabenumi}[series=table] \item Item 1\end{tabenumi} &
\begin{tabenumi}[resume*=table] \item Lorem ipsum dolor sit amet, consectetur adipisicing elit.. 
                  \item More and more lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. \end{tabenumi}\\
\begin{tabenumi}[resume*=table] \item Perhaps this text could go on for a while too \end{tabenumi} & 
\begin{tabenumi}[resume*=table] \item Item 5 \end{tabenumi}\\
\bottomrule
\end{tabularx}

\end{document}
  • nice answer! however, are necessary to define after twice: after=\strut, after=\vspace{-\baselineskip}, and align=parleft,. – Zarko Apr 8 '18 at 11:05
  • @Zarko: Thank you. I have removed the superfluous options. – leandriis Apr 8 '18 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.