# How to use \begin{enumerate} in tabular without using p{size}

I'd like to generate a table, using tabular, that looks like this

+-----------------+---------------+
|1. djkfjsdalfkj  |1. djhfjdhf    |
|2. asdfdsjkfasd  |2. sadhfdsj    | <--- enumeration list
+----------------+----------------+
.
.
.
rest of table like the above


But I do not want to use paragraph option to tabular, since then I would have to specify a size for the width. I do not want to do this, since I'll process this .tex file with latex2html (l2h), and I do not want the web page to have fixed width in the browser. (I do not know how big a window there will be), and I'd like the table to resize with the window size automatically.

Is there a way to do it, using tabular, and just using 'c'?

(I need to stay with tabular since I know l2h supports this. If I go to fancy table packages, it might not work).

The problem is I can't add \begin{enumerate} when I use 'c'. Hence this does not work:

\documentclass{article}
\begin{document}

\begin{tabular}{|c|c|}\hline

\begin{enumerate}
\item dhfkjdshafkjds
\item hfdsjkhdsjkafsdaf
\end{enumerate}
&
\begin{enumerate}
\item dhfkjdshafkjds
\item hfdsjkhdsjkafsdaf
\end{enumerate}

\\\hline
\end{tabular}
\end{document}


But if I replace {|c|c|} above by {|p{4in}|p{4in}|} then it work since one can use \begin{enumerate} in a paragraph.

I looked at the examples here http://en.wikibooks.org/wiki/LaTeX/Tables and do not see how to do it.

Question is: How to use enumeration list in tabular without using p{size}

thanks

update: As I mentioned above, I'd like the solution to only use tabular. I am using latex2html to process the latex document to convert to HTML. And l2h does not support all the latex packages.

Warning: No implementation found for package: tabularx.
Warning: No implementation found for package: paralist..


This is the HTML page I get from running the solution below on latex2html

-

## migrated from stackoverflow.comMay 15 '12 at 9:18

This question came from our site for professional and enthusiast programmers.

You can put the list inside a varwidth environment that would shrink to the natural width of its contents. Or you could even use a minipage. Is that an option? –  Werner May 15 '12 at 18:12
Thanks, but with l2h these things will not work right due to HTML generation limitation it has on what Latex I can use where. I'll just go back to using p{5in} and this allows me to use enumeration lists inside the table cells and l2h can handle that. I'll have to pick a column size I think will not be too large for most monitors. The above size is the MAXIMUM size the table column will extend. User can make column less wide then this size, but not more wide even if the monitor is wider. Most monitors these days are winder than 10 inches I think. So I can make my table 2 columns each is 5 in. –  Nasser May 15 '12 at 19:19
LaTeX is not "dynamic" like that - it produces a "static" output. If you want things to conform to some variable length, then you need to compile it twice (doesn't help in your case) or use some non-standard setup... which it seems is restrictive to your usage, again. –  Werner May 15 '12 at 19:24

There are many solutions on the web, I stole this one from here: http://www.komascript.de/node/300

\documentclass{article}
\usepackage{tabularx}
\usepackage{paralist}
\newcommand*{\sii}{\setdefaultleftmargin{1em}{1em}{1em}{1em}{1em}{1em}}
\makeatletter
\newcommand*{\storeenum}{%
\expandafter\xdef\csname
stored@\@enumctr\endcsname{\expandafter\the\value{\@enumctr}}%
}%
\newcommand*{\restoreenum}{%
\setcounter{\@enumctr}{\csname stored@\@enumctr\endcsname}%
}
\makeatother
\begin{document}
\noindent\begin{tabularx}{\textwidth}{|>{\sii}X|>{\sii}X|}
\hline
\begin{compactenum}
\item ITEM
\item ITEM
\item ITEM
\storeenum
\end{compactenum} &
\begin{compactenum}
\restoreenum
\item ITEM
\item ITEM
\item ITEM
\storeenum
\end{compactenum}\\
\hline
\begin{compactenum}
\restoreenum
\item ITEM
\item ITEM
\item ITEM
\storeenum
\end{compactenum} &
\begin{compactenum}
\restoreenum
\item ITEM
\item ITEM
\item ITEM
\end{compactenum}\\
\hline
\end{tabularx}
\end{document}

-
I've seen the 'many solutions' but as I said, I want to stay with tabular. I am using l2h to process the document, and l2h does not support tabularx. I've just posted the message I get from trying the above with latex2html above. –  Nasser May 15 '12 at 16:15