Graphics, Figures & TablesItemize into table?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
karlisrepsons
Posts: 50
Joined: Sat May 23, 2009 10:13 pm

Itemize into table?

Post by karlisrepsons »

Hi,
a problem again! How to insert items into a particular table cell?

This one fails:

Code: Select all

\begin{tabular}{ll}
 A: &
 \begin{itemize}
  \item how to write,
  \item how to test.
 \end{itemize} \\
 
 B: & how to produce.
\end{tabular}
Not sure, if I need it right now, but anyway - how to do it right?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Itemize into table?

Post by fatra2 »

Hi there,

The only problem with your code is that the option \begin{tabular}{ll} will not allow you to generate line break, therefore having your list on the same line.

You could change this option to:

Code: Select all

\begin{tabular}{p{0.5\textwidth}p{0.5\textwidth}}
A: &
\begin{itemize}
  \item how to write,
  \item how to test.
\end{itemize} \\

B: & how to produce.
\end{tabular}
Where the p{0.5\textwidth} get you into a paragraph environment inside the table cell. There, you can add some \linebreak just like in a paragraph (just don't use the \\).

Cheers
karlisrepsons
Posts: 50
Joined: Sat May 23, 2009 10:13 pm

Itemize into table?

Post by karlisrepsons »

Question answered.

Indeed, this is OK:

Code: Select all

\begin{tabular}{p{0.5\textwidth}p{0.5\textwidth}}
  \begin{itemize}
   \item i1
   \item i2
  \end{itemize}
  txxx & tex2
\end{tabular}
Post Reply