# How to include enumerate in tabular?

I would like to have text in one column table with multiple rows, but I need to include an enumerate in one cell. I get errors and read on the Internet the problem is in combining environments with \item. Is there a solution? I haven't found anything yet.

Sample:

...
\begin{tabular}{|l|}
\hline
\textbf{Name:} Foo \\
\hline
\textbf{Main success scenario:} \\
\begin{enumerate}
\item Entry action
\item next steps\ldots
\end{enumerate}
\hline
\end{tabular}
...


Errors:

Illegal unit of measure (pt inserted). \hline (followed by: )
Misplaced \noalign. \hline (followed by: )
Missing number, treated as zero. \hline (followed by: )
Something's wrong--perhaps a missing \item. \end{enumerate} (followed by: )
You can't use \hrule' here except with leaders. \hline (followed by: )

-
Could you please add some sample code what exactly you are trying and what the error message is. That makes it easier to help you. – Caramdir Feb 20 '11 at 1:17
See also these questions for examples and solutions on lists inside tabular: (1), (2), (3) – Martin Scharrer Feb 20 '11 at 1:25
(You can format code nicely by indenting it with 4 spaces or selecting it and pressing the 101010 button.) – Caramdir Feb 20 '11 at 1:38
@Caramdir thanks – Gabriel Ščerbák Feb 20 '11 at 1:43

Try changing the heading to p{3cm} as shown below:

\documentclass{article}
\begin{document}
\begin{tabular}{|p{3cm}|}
\hline
\textbf{Name:} Foo \\
\hline
\textbf{Main success scenario:} \\
\begin{enumerate}
\item Entry action
\item next steps\ldots
\end{enumerate}\\
\hline
\end{tabular}
\end{document}

-
Thanks, this is an easy solution that works, meanwhile I found it on the web as well (en.wikibooks.org/wiki/LaTeX/…). However now I would like to avoid absolute width, how to have it adjust to the width of the page or cell content? – Gabriel Ščerbák Feb 20 '11 at 2:24
Ok, I found further information here: en.wikibooks.org/wiki/LaTeX/Tables#The_tabular_environment – Gabriel Ščerbák Feb 20 '11 at 2:33
@YiannisLazarides: Thanks for the answer. Reading about tabular, I could understand the definitions but still not quite get why one could not replace [c] or [l] for that matter with {|p(3cm)|} at the top...it gives an error message – Abhimanyu Arora Aug 14 '14 at 17:26
@AbhimanyuArora The definition of a list in LaTeX kernel uses paragraphs and paragraph related commands, hence require the |p{}|. The |c| |l| etc cannot accept paragraphs. – Yiannis Lazarides Aug 14 '14 at 17:36
I see, that's great! Thanks for clarifying. – Abhimanyu Arora Aug 14 '14 at 17:56

Look at the listliketab package list columns

The following was posted on CTT a long time ago by Donald Arseneau for itemized and enumerated cells

\documentclass{article}
\usepackage{array}
\makeatletter
\newcolumntype{e}[1]{%--- Enumerated cells ---
>{\minipage[t]{\linewidth}%
\NoHyper%                Hyperref adds a vertical space
\let\\\tabularnewline
\enumerate
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\endenumerate
\endNoHyper
\endminipage}}

\newcolumntype{i}[1]{%--- Itemized cells ---
>{\minipage[t]{\linewidth}%
\let\\\tabularnewline
\itemize
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\enditemize\endminipage}}

\AtBeginDocument{%
{\let\NoHyper\relax\let\endNoHyper\relax}}
\makeatother
\begin{document}

\begin{tabular}[t]{|i{2.5cm}|e{3cm}|}
\hline
\item Item A
\item Item B   &
\item Item 1
\item Item 2   \\
\hline
\end{tabular}

\end{document}
`
-