11

When compiling this:

   \begin{table*}[h]
    \begin{tabular}{|lll|}
        \hline \bfseries Name & \bfseries Opt 1 & \bfseries Opt 2 \\\hline 
        \hline \bfseries Item 1 & X & \\\multicolumn{3}{|c|}{
            \begin{itemize}
                \item Key 
                \item Key 
                \item Key 
            \end{itemize} }        % <--- Something's wrong--perhaps a missing \item
         \\ \bfseries Item 2 & X & X \\\multicolumn{3}{|c|}{
            \begin{itemize}
                \item Key key key key key key key key key key key
                \item Key key key key key key key key key key key
                \item Key key key key key key
            \end{itemize} }        % <--- Something's wrong--perhaps a missing \item
         \\ \bfseries Item 3 &  & X\\\multicolumn{3}{|c|}{
            \begin{itemize}
                \item Key
             \end{itemize} }       % <--- Something's wrong--perhaps a missing \item 
          \\ \hline
     \end{tabular}
   \end{table*}

The compiler keeps complaining like 20 times or so saying Something's wrong--perhaps a missing \item in marked lines.

This should look like:

    +------------------------------+  
    | Name            opt 1  opt 2 |  
    +------------------------------+  
    | Item 1            x     x    |  
    |   * long text with stuff ... |  
    |   * bullte 2                 | 
    |   * and so on                |  
    +------------------------------+  
    | Item 2                  x    | 
    |   * other list               | 
    |   * other list               | 
    +------------------------------+
  • 4
    You can't put a multiline text in a column of type "c". Use the p-type instead. – Ulrike Fischer Mar 16 '12 at 14:22
  • @UlrikeFischer this seems to answer the original question perfectly, are there disadvantages to using this method? – oLas May 15 '14 at 18:35
14

I guess that \parbox command does the trick. The problem is, that inside a table, you cannot have something that needs "paragraph" line breaking, but inside \parbox, you can. You just have to specify the width in advance.

   \begin{table*}[h]
    \begin{tabular}{|lll|}
        \hline \bfseries Name & \bfseries Opt 1 & \bfseries Opt 2 \\\hline 
        \hline \bfseries Item 1 & X & \\\multicolumn{3}{|c|}{\parbox{0.9\textwidth}{
            \begin{itemize}
                \item Key 
                \item Key 
                \item Key 
            \end{itemize} }}
         \\ \bfseries Item 2 & X & X \\\multicolumn{3}{|c|}{\parbox{0.9\textwidth}{
            \begin{itemize}
                \item Key key key key key key key key key key key
                \item Key key key key key key key key key key key
                \item Key key key key key key
            \end{itemize} }}
         \\ \bfseries Item 3 &  & X\\\multicolumn{3}{|c|}{\parbox{0.9\textwidth}{
            \begin{itemize}
                \item Key
             \end{itemize} }}
          \\ \hline
     \end{tabular}
   \end{table*}
  • Could you add a picture of the output? – doncherry Oct 24 '12 at 18:34
3

Here is a variant using cals tables. Borders can be adjusted further, but I like my version.

table with itemize

\documentclass{article}
\usepackage{cals}
\usepackage{xcolor}
\begin{document}
\begin{calstable}
\colwidths{{30mm}{20mm}{20mm}}
\makeatletter
\brow
\cell{Name}
\cell{opt 1}
\cell{opt 2}
\erow
\brow
\cell{Item 1}
\cell{x}
\cell{x}
\erow
\def\cals@rs@width{0pt}
\brow
\nullcell{ltb}
\nullcell{tb}
\nullcell{trb}\spancontent{
  \begin{itemize}
  \item Key key key key key key key key key key key
  \item Key key key key key key key key key key key
  \item Key key key key key key
  \end{itemize}
}
\erow
\def\cals@rs@width{0.4pt}
\brow
\cell{Item 2}
\cell{}
\cell{x}
\erow
\def\cals@rs@width{0pt}
\brow
\nullcell{ltb}
\nullcell{tb}
\nullcell{trb}\spancontent{
  \begin{itemize}
  \item Key key key key key key key key key key key
  \item Key key key key key key key key key key key
  \item Key key key key key key
  \end{itemize}
}
\erow
\end{calstable}
\end{document}

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.