LaTeX: Adding an Enumerate environment to a Tabular environment

I am trying to add an ordered list ( enumerate ) to a table ( tabular ) in LaTeX with the following:

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

But I am getting the following error:

! 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 ?

Can anyone please tell me what is the problem exactly?

Because when I put the enumerate environment outside of the tabular environment, it works; so guess I am currently missing something with my example of the table.


The following works:

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}

I'm guessing the trouble is that the enumerate environment needs to be in vertical mode: you could experiment with a vbox.


You could use the following solution:

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}

In other words, you can avoid the need for a minipage by simply creating a paragraph type column (which has a specified width). This compiles to

链接地址: http://www.djcxy.com/p/33452.html

上一篇: 乳胶再生命令不能正常工作

下一篇: LaTeX:将枚举环境添加到Tabular环境