# How to create columns within an itemize environment?

I want to generate a list of the following syntax for a resume.

* <Description of Activity> <empty space> <right aligned date>


Currently I have been using a form such as

\begin{itemize}
\item First Activity \hfill Date 1
\item Second Activity \hfill Date 2
\end{itemize}


This approach works so long as each activity is not very long. If the activity description happens to be too long, the date will wrap poorly. I would like to wrap the activity into a column of its own so that it can wrap to the next line without affecting the date essentially yielding the following

* This is a really long activity that    Date
spans multiple lines without
messing up the dates.


I tried nesting a tabular environment, but it didn't work.

-
It is worth asking whether or not the itemized list is breakable across the pages. – kiss my armpit Sep 16 '12 at 4:09

You can use minipages as in this MWE:

\documentclass{article}
\usepackage{lipsum}
\begin{document}

\begin{itemize}
\item First Activity  ~~ \dotfill ~~ Date 1
\item Second Activity  ~~ \dotfill ~~ Date 2
\item
\begin{minipage}[t]{8cm}
This is a really long activity
that  spans multiple lines without
messing up the dates.
\end{minipage}
~~ \dotfill ~~ Date 3

\item
\begin{minipage}[t]{8cm}
This is a another long activity
that spans in more tha one line.
\end{minipage}
~~ \dotfill ~~ Date 4

\end{itemize}
\end{document}

-
Your solution looks like the easiest for me to implement, although I not not familiar with minipage. I may try this, so long as minipage is stable in terms of spacing. – Carl Morris Sep 17 '12 at 1:08

You can place the contents in a tabularx:

\documentclass{article}
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\noindent
First activity & Date 1 \\
Second activity & Date 2 \\
\lipsum*[2] & Date 3 \\
Fourth activity & Date 4
\end{tabularx}
\end{document}


For extending this across page breaks, you could consider ltxtable. This will only break on complete cells.

-
Your solution is quite similar to the one I eventually constructed while waiting for answers. Of course line breaks would be an issue in general, the layout of my resume allowed me to avoid that problem. Your use of primitives in the argument to tabularx is quite interesting. I think I need to learn more about them. – Carl Morris Sep 17 '12 at 1:10

I would set this as a list with the date being set as part of the item label, just offset to the right. Unlike solutions using tables or minipages, using lists allows page breaks mid-item (which is either a feature or not, depending what you want).

\documentclass{article}
\makeatletter
\newenvironment{dateitemize}{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\list
\csname\@itemitem\endcsname
{%
\def\makelabel##1{\hss\llap{\textbullet}\rlap{\hbox to \dimexpr\linewidth+\rightmargin+\itemsep\relax{\hss##1}}}}%
\fi}{%
\enditemize}

\makeatother
\begin{document}

\noindent X\dotfill X

\noindent X\dotfill X

\begin{dateitemize}
\item[Date 1] First Activity
\item[Date 2] Second Activity
\item[Date 3--Date 4]
This is a really long activity
that  spans multiple lines without
messing up the dates.
\item[Date 4]
This is a another long activity
that spans in more tha one line.

\end{dateitemize}
\end{document}

-
I think your solution is the most sophisticated. I am hesitant to use it, though. It uses a good bit more TeX knowledge than I have, but in the long run I would like to go through your example to understand why it works, because I think it could be helpful for some applications. – Carl Morris Sep 17 '12 at 1:11
Actually it is the least sophisticated. It is the definition of itemize copied from article.cls with one line to reduce the right margin to make room for the date and one line to add the date flush right. I could have put it in a package and given a one line answer of \usepackage{dateitem} or I could have use etoolbox \patch command and given the answer as a patch on itemize but the code in etoolbox (and the code in tabularx) is far more complicated so it is just hiding complication under the covers. – David Carlisle Sep 17 '12 at 8:19