0

I can easily enumerate like,

\begin{enumerate}
\item detail 1.1
\item detail 1.2
\end{enumerate}

Now I want to put the above enumeration output as a cell content of a table. I cannot find any way. I have tried to use below code but no luck,

\begin{table}
\caption{Test table for enum}
\label{tab:2_2}
\centering
  \begin{tabular}{ |c|c|c| }
    \hline
    \textbf{Ser.} &  \textbf{Item} & \textbf{Detail}
    
    \\ \hline
        1. & Item1 & \begin{enumerate}
                     \item detail 1.1
                     \item detail 1.2
                     \end{enumerate} \\ \hline
        2. & Item1 & Detail2 \\ \hline
        3. & Item1 & Detail3 \\ \hline
        4. & Item1 & Detail4 \\ \hline
    
     \end{tabular}
  \end{table}

How can I do so?

Update - 1

Following leandriis's answer, my output is showing like,

enter image description here

1
  • 1
    Use the enumerate environment inside of a fixed width column such as a p column.
    – leandriis
    Mar 8, 2020 at 16:46

1 Answer 1

1

Place your enumerate environment inside a fixed width column such as a p type column. In the following example, I have also added the enumitem package in order to adjust the spacing around the list:

enter image description here

\documentclass{article}
\usepackage{enumitem}
\newlist{tabenum}{enumerate}{1}
\setlist[tabenum]{wide=0pt, 
                  nosep, 
                  leftmargin= * ,
                  label*=\arabic*.,
                  after=\vspace{-\baselineskip},
                  before=\vspace{-0.6\baselineskip}}

\begin{document}
\begin{table}
\caption{Test table for enum}
\label{tab:2_2}
\centering
  \begin{tabular}{ |c|c|p{3cm}|}
    \hline
    \textbf{Ser.} &  \textbf{Item} & \textbf{Detail}
    \\ \hline
        1. & Item1 & \begin{tabenum}
                     \item detail 1.1
                     \item detail 1.2
                     \end{tabenum} \\ \hline
        2. & Item1 & Detail2 \\ \hline
        3. & Item1 & Detail3 \\ \hline
        4. & Item1 & Detail4 \\ \hline

     \end{tabular}
  \end{table}
  \end{document}
2
  • did't work in my custom documentclass :(. enums are overlapped Mar 8, 2020 at 16:55
  • @SazzadHissainKhan: Without knowing which documentclass you use, I can't give any useful tips on how to overcome this issue.
    – leandriis
    Mar 8, 2020 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .