# A list inside a table

I'm using this simple code to align date ranges on a CV:

\section{I'm pretty cool}\begin{tabular}{l l}
2009--present & company 1 \\
2011--2012 & company 2
\end{tabular}


Now this looks like this:

2009 - present   company 1
2011 - 2012      company 2


but I'd like to add a list in each of the entries, like this:

2009 - present   company 1:
* editor
2011 - 2012      company 2
* judge
* jury
* executioner


How can I achieve this? I could itemize them in a separate column, but it doesn't work inside tabular in cases like this, where I want part of "company 2" to be in that column.

-

If you use itemize inside a p column in tabular a lot of unnecessary space is added. Use a properly defined column type to do the right thing. The following was posted on CTT a long time ago by Donald Arseneau for itemized and enumerated cells.

Edit: Change \multicolumn contents to a p column.

\documentclass{article}
\usepackage{array}
\makeatletter
\newcolumntype{e}[1]{%--- Enumerated cells ---
>{\minipage[t]{\linewidth}%
\NoHyper%                Hyperref adds a vertical space
\let\\\tabularnewline
\enumerate
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\endenumerate
\endNoHyper
\endminipage}}

\newcolumntype{i}[1]{%--- Itemized cells ---
>{\minipage[t]{\linewidth}%
\let\\\tabularnewline
\itemize
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\enditemize\endminipage}}

\AtBeginDocument{%
{\let\NoHyper\relax\let\endNoHyper\relax}}
\makeatother

\newlength{\pcolwdth}
\begin{document}
\setlength{\pcolwdth}{5cm}%
\begin{tabular}{li{\pcolwdth}}
2009--present & \multicolumn{1}{p{\pcolwdth}}{company 1} \\
& \item editor                             \\
2011--2012    & \multicolumn{1}{p{\pcolwdth}}{company 2} \\
& \item judge
\item jury
\item executioner                        \\
\end{tabular}
\end{document}


-

Depending on your preference, you might just as well avoid lists and set the items using a "fake list" environment:

\documentclass{article}
\newcommand{\nextitem}{\par\hspace*{\labelsep}\textbullet\hspace*{\labelsep}}
\begin{document}
\thispagestyle{empty}
\begin{tabular}{rp{3in}}
2009--present & company 1
\nextitem editor \\
2011--2012 & company 2
\nextitem jury
\nextitem executioner
\end{tabular}
\end{document}


This only works because the second column is set in paragraph mode. You could also use an X-column (from the tabularx package).

An alternative suggestion altogether would be to use the moderncv class. Here's an extract from the moderncv template/example (there are other examples):

-
Nice answer, but if the item is more than a line long, it does not line up the text (I believe I had the (final) answer to one of my previous questions. – Sveinung Sep 26 '14 at 12:01

Not exactly using tabular. But this solution uses parallel package.

\documentclass{article}
\usepackage{parallel,enumitem}
\setlist{label=*,leftmargin=0.31\textwidth}
\begin{document}
\begin{Parallel}[v]{0.24\textwidth}{0.74\textwidth} % remove [v] if you don't need a vertical line
\ParallelLText{\noindent
2009--present
}
%
\ParallelRText{%
\noindent
Company 1
\begin{enumerate}%[label=*,leftmargin=0.31\textwidth] %defined by \setlist in preamble
\item{editor}
\end{enumerate}}
\ParallelPar
\bigskip
%---------------------
\ParallelLText{\noindent
2011--2012
}
%
\ParallelRText{%
\noindent
Company 1
\begin{enumerate}%[label=*,leftmargin=0.31\textwidth]
\item{Judge}
\item{Jury}
\item{Executioner}
\end{enumerate}}
\ParallelPar
\bigskip
%---------------------
\end{Parallel}

\end{document}


-

The list environment does not work inside l columns, but it is fine inside p columns:

\documentclass{article}
\usepackage{array}
\begin{document}
\thispagestyle{empty}
\begin{tabular}{l<{\raggedright}p{3in}}
2009--present & company 1
\begin{itemize}
\item editor
\end{itemize}
\\
2011--2012 & company 2
\begin{itemize}
\item jury
\item executioner
\end{itemize}
\end{tabular}
\end{document}


-