在表格环境中逐项列出

在表格环境中逐项列出

编译时:

   \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*}

编译器不断抱怨大约 20 次,Something's wrong--perhaps a missing \item在标记的行中说。

这看起来应该是这样的:

    +------------------------------+  
    | 名称 选项 1 选项 2 |  
    +------------------------------+  
    | 项目 1 xx |  
    | * 包含内容的长文本...|  
    | * 项目符号 2 |
    | * 等等 |  
    +------------------------------+  
    | 项目 2 x |
    | * 其他列表 |
    | * 其他列表 |
    +------------------------------+

答案1

我猜这个\parbox命令可以解决问题。问题是,在表格中,您不能有需要“段落”换行的东西,但在里面\parbox,您可以。您只需提前指定宽度即可。

   \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*}

答案2

这是使用 cals 表的变体。边框可以进一步调整,但我喜欢我的版本。

带有逐项列出的表格

\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}

相关内容