2010-01-09 43 views
5

我想要一个有序列表(enumerate)在LaTeX通过以下操作添加到表(tabular):乳胶:添加一个枚举环境到表格环境

\begin{tabular}{|l|l|} 
    \hline 
    Event Flow & 
    \begin{enumerate} 
    \item This is item 1 
    \item This is item 2 
    \end{enumerate} 
    \\ 
    \hline 
\end{tabular} 

但我收到以下错误:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

           l.34 \item T 
      his is item 1 ? 

任何人都可以请告诉我究竟是什么问题?

因为当我把enumerate环境放在tabular环境以外时,它就起作用了;所以猜猜我目前正在失去一些与我的表格的例子。

+0

你或许应该只发布这样为*堆栈溢出和超级用户的一个*(比较http://superuser.com/questions/93498/latex-adding-an问题-enumerate-environment-to-a-tabular-environment)。就我个人而言,我怀疑你会在这里得到更快的答案。 – dmckee 2010-01-09 18:47:06

+0

是的,你是非常正确的,我完全同意你的看法。我选择以超级用户的方式提出这个问题的原因是因为我认为这会在这里结束;我现在将从超级用户中删除该问题。 – 2010-01-11 08:22:14

回答

8

以下工作:

 
\documentclass{article} 
\begin{document} 
\begin{tabular}{|l|l|} 
    \hline 
    Event Flow & 
    \begin{minipage}{5in} 
    \vskip 4pt 
    \begin{enumerate} 
    \item This is item 1 
    \item This is item 2 
    \end{enumerate} 
    \vskip 4pt 
\end{minipage} 
\\ 
    \hline 
\end{tabular} 
\end{document} 

我猜麻烦的是,罗列环境需要在垂直模式:你可以用\ VBOX实验。

+0

仍然出现错误:/ – 2010-01-09 15:19:06

+0

已修复并经过测试,对不起 – 2010-01-09 15:33:11

+0

+1非常好,现在就开始工作。谢谢!无论如何,你知道我可以垂直对齐第一个单元格的内容('Event Flow')吗?因为它目前是中心垂直对齐。 – 2010-01-09 16:26:17

2

您可以采用如下方案:

\documentclass{article} 
\begin{document} 
\begin{tabular}{|l|p{5cm}|} 
    \hline 
    Event Flow & 
    \begin{enumerate} 
     \item This is item 1 
     \item This is item 2 
    \end{enumerate} \\ 
    \hline 
\end{tabular} 
\end{document} 

换句话说,你可以通过简单地创建一个段落类型列(其中有一个指定的宽度)避免对minipage的需要。这编译为

table with enumerate