9

I would like to make a list, each entry of which has two pieces of information: a date range, and a description. If there are two separate date ranges that apply to an item, I would like to be able to write

\begin{itemize}
  ...
  \item \parbox[t]{5cm}{date range 1\\ date range 2} description
  ...
\end{itemize}

However, the inter-item spacing seems to get thrown off by this; for example, when I compile

\documentclass[11pt]{article}
\begin{document}
\begin{itemize}
  \item \parbox[t]{5cm}{test\\test}
  \item test
  \item test
\end{itemize}
\end{document}

what I see is

enter image description here

The spacing between the first and second items is not the same as the spacing between the second and third items.

Is there a way of getting the spacing to be equal? I'd like to avoid if possible using a package like the ones described in this question, since (I think) that would change the spacing in the rest of the list.

Also, I assume that there is a smarter way of creating the kind of list I'm describing than the method I am attempting - any suggestions regarding that are welcome too.

1
  • How long is the description you're talking about? If it extends over more than one line, the "regular itemize vertical gap" would be larger than \baselineskip, making the date range lines not match up with the description. Would you be able to update your MWE to include a little more detail showing some output possibilities?
    – Werner
    Feb 19, 2012 at 18:00

2 Answers 2

8

You should end the \parbox with a \strut to give it normal depth ("test" doesn't contain chars with descender). Or use a tabular instead (each line in a tabular has a standard height).

\documentclass[11pt]{article}
\begin{document}
\begin{itemize}
  \item \parbox[t]{5cm}{test\\test}
  \item test\\test
  \item test\\test
  \item \parbox[t]{5cm}{test\\test\strut}
  \item test\\test
  \item test\\test
  \item \begin{tabular}[t]{@{}p{5cm}}test\\test\end{tabular}
  \item test\\test
  \item test\\test

\end{itemize}
\end{document}
1
  • The struts seem to do the trick. Thanks for your help! Feb 20, 2012 at 0:35
6

I think you'd be best with a modified description environment, something like

\documentclass[11pt]{article}
\newenvironment{mydescription}
               {\list{}{\labelwidth5em 
                        \let\makelabel\mydescriptionlabel}}
               {\endlist}

\newcommand*\mydescriptionlabel[1]{%
                                \smash{\parbox[t]{5em}{\normalfont\bfseries #1}}}


\def\d{description description description goes here. }
\begin{document}
\begin{mydescription}
  \item [test 1\\test 2]  \d\d
  \item [test]\d\d\d
  \item [test]\d
\end{mydescription}
\end{document}

enter image description here

The \smash might be too much of a blunt instrument in practice, but it depends on what you want the behaviour to be if the label is bigger than the description and/or you are near a page break.

I think the following vesrsion would detect if the description paragraph was one line and if so add extra space for teh two line label

\newenvironment{mydescription}
               {\list{}{\labelwidth5em 
                        \let\item\myitem
                        \let\makelabel\mydescriptionlabel}}
               {\endlist}

\newcommand*\mydescriptionlabel[1]{%
                                \smash{\parbox[t]{5em}{\normalfont\bfseries #1}}}

\let\saveditem\item
\def\myitem{%
\relax\ifnum\prevgraf=1 \vskip\baselineskip\fi
\saveditem}
3
  • Thanks for your help! This seems like a good start, but as you mention in the last paragraph, I'd want the spacing to work with a two-line date even when the description is only one line (for example, \item [test 1\\test 2] \d has incorrect spacing following it). Perhaps there's a way of pretending the description has the same height as the date range? Feb 19, 2012 at 16:18
  • You could open up the whole thing by making it, say, \labelwidth5em \itemsep\baselineskip then there is always room for the 2 line label but if you want the tighter spacing, but essentially add a blank line after 1-line items, I'd need to remind myself how this is supposed to work... (or someone else may step in:-) Feb 19, 2012 at 17:49
  • answer updated to cope with a short description Feb 19, 2012 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .