3

I need to insert an enumerate environment in a table.

Following hints from this page: itemize in a tabular environment, I used \parbox to prevent error (https://tex.stackexchange.com/questions/141628/putting-itemize-environment-in-a-tabular-environment).

The issue is that I have two par boxes line up horizontally when I need them vertically stacked. How to stack par boxes in a table?

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

\newcommand{\fuda}[2]{%
Function:%
\parbox[t]{3cm}{
\begin{itemize}[nosep]%
#1%
\end{itemize}
}
Data:%
\parbox[t]{3cm}{
\begin{itemize}[nosep]%
#2%
\end{itemize}%
}
}
\begin{document}
\begin{longtable}{p{0.3\textwidth}|p{0.7\textwidth}}
\caption[List of components]{List of functions and data allocated to each component} \label{d_plan} \\
\toprule
\textbf{Components} & \textbf{Functions and Data} \\\midrule
\textbf{Registration} & \fuda{
\item A
\item B
\item C
}{
\item  X
\item Y
\item  Z}
\\\bottomrule
\end{longtable}
\end{document}

enter image description here

4

You have a column of type p{...}. You don't need all these parboxes. This definition of your command will work without problems:

\newcommand{\fuda}[2]{%
Function:
\begin{itemize}[nosep]%
#1%
\end{itemize}
Data:  
\begin{itemize}[nosep]%
#2%
\end{itemize}%
}

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.