Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 '12 at 18:00
add comment

2 Answers 2

up vote 7 down vote accepted

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}
share|improve this answer
    
The struts seem to do the trick. Thanks for your help! –  Zev Chonoles Feb 20 '12 at 0:35
add comment

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}
share|improve this answer
    
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? –  Zev Chonoles Feb 19 '12 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:-) –  David Carlisle Feb 19 '12 at 17:49
    
answer updated to cope with a short description –  David Carlisle Feb 19 '12 at 18:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.