2

I am creating a set of lists that begin with dates and are then followed by a description. Given that the dates have different horizontal lengths, I would like to insert a command that creates a uniform horizontal space after the date so that all of the descriptions align perfectly. For example, using the following code:

\documentclass[10pt, letter]{article}
\usepackage{setspace}
\usepackage[margin=1.250in]{geometry}
\singlespacing
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\newenvironment{list2}{
  \begin{list}{$\bullet$}{%
      \setlength{\itemsep}{0in}
      \setlength{\parsep}{0in} \setlength{\parskip}{0in}
      \setlength{\topsep}{0in} \setlength{\partopsep}{0in} 
      \setlength{\leftmargin}{0.35in}}}{\end{list}}

\begin{document}


Example Paper Title
\begin{list2}
\item[] June 2014: Stanford University 
\item[] Dec 2013: Conference
\end{list2}
\end{document}

I would like "Stanford University" and "Conference" to align on the same vertical margin. I've got a lot of lists and each has a different horizontal date length, so any ideas on a version of a \hspace that can be applied throughout to generate all of the descriptions to the same margin would be great. Thanks.

2

You can use enumitem:

\documentclass{article}

\usepackage{enumitem}
\newlist{list2}{itemize}{1}
\setlist[list2]{
  nosep,
  before={\let\makelabel=\mymakelabel},
  leftmargin=*,
  labelwidth=6em,
  label={\hspace{6em}},
}
\newcommand{\mymakelabel}[1]{\textbullet\ #1:\hfill}

\begin{document}

\noindent Example Paper Title
\begin{list2}
\item[June 2014] Stanford University
\item[Dec 2013] Conference
\end{list2}
\end{document}

enter image description here

  • Great, thanks. Is there a way to move the left margin in while preserving the same space structure? (Whenever I adjust the leftmargin, it loses the alignment after the colons). – coding_heart Sep 14 '15 at 3:45
  • @user2154571 leftmargin=2cm (or whatever length you prefer)? – egreg Sep 14 '15 at 8:41
2

A slightly simpler way to do this, also with enumitem.

To indent the list, supply a length to labelindent, e.g. labelindent=1em.

\documentclass{article}
\usepackage{enumitem}

\newlist{mybullet}{description}{1}
\SetLabelAlign{myleft}{$\bullet$\ #1\hfil}
\setlist[mybullet]{align=myleft,labelwidth=1in,font=\normalfont,nosep}

\begin{document}
\noindent
Some text
\begin{mybullet}
\item[Sept 2004]{Something}
\item[May 1990]{Something}
\item[June 1215]{Magna Carta}
\end{mybullet}

\end{document}

output of code

  • Great, thanks. Is there a way to move the left margin in while preserving the same space structure? (Whenever I adjust the leftmargin, it loses the alignment after the colons). – coding_heart Sep 14 '15 at 3:45
  • 1
    @user2154571 You can add labelindent=1em (or whatever length you like) to the list definition. – Alan Munn Sep 14 '15 at 3:55
2

You can create your own environment datelist, where date is separated by colon after \item sequence.

\def\dateliststart{\def\item##1:{\par
   \noindent\hbox to2em{\hss$\bullet$\hss}\hbox to6em{##1:\hss}%
   \hangindent=2em \ignorespaces}}
\newenvironment{datelist}{\bgroup\dateliststart}{\par\egroup}

\begin{datelist}
\item June 2014: Stanford University
\item Dec 2013: Conference
\end{datelist}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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