6

I would like to generate a list of "Aims" (1,2,3...etc) as the \item label, with the text for the aim located adjacent (with \hspace{Xmm}). For items that exceed the width of the line, the alignment of the second line is undesirable. I would like it to be flush.

Here is what I have so far:

\documentclass{article}
\usepackage{enumitem}
\usepackage[top=1in, bottom=1.5in, left=1in, right=1in]{geometry}
\begin{document}
\begin{itemize}[leftmargin=*,align=left]
\item[Aim 1] \hspace{10mm} This aim fits nicely on to a single line.
\item[Aim 2] \hspace{10mm} Unfortunately, the details of this aim are such that they will not fit on to a single line. Instead, the text aligns strangely beneath the "Aim 2" item label :(
\end{itemize}
\end{document}

I previously attempted this with tabbing, which came very close to the desired output, however the second aim would not wrap to the pagewidth:

\documentclass{article}
\usepackage{enumitem}
\usepackage[top=1in, bottom=1.5in, left=1in, right=1in]{geometry}
\begin{document}
\begin{tabbing}
\= \hspace{20mm} \= \\
\> {\bf Aim 1:} \> This aim fits nicely on to a single line.\\[10pt]
\> {\bf Aim 2:} \> Unfortunately, the details of this aim are such that they willnot fit on to a single line. Instead, the text aligns strangely beneath the "Aim 2" item label :(
\end{tabbing}
\end{document}

Many thanks in advance for any assistance/pointers.

David Carlisle
  • 757,742
MRJ
  • 63

2 Answers2

7

Another option would be to use the enumitem package to define a new list having the desired layout (the showframe option for geometry was only used as a visual guideline):

\documentclass{article}
\usepackage{enumitem}
\usepackage[showframe]{geometry}

\newlist{aims}{enumerate}{1}
\setlist[aims,1]{
  label={Aim~\arabic*},
  leftmargin=*,
  align=left,
  labelsep=10mm,
  itemindent=\dimexpr\labelsep+\labelwidth+7pt\relax
}

\begin{document}

\begin{aims}
\item This aim fits nicely on to a single line.
\item The details of this aim are such that they will not fit on to a single line. Now the text aligns with the margin.
\item This aim fits nicely on to a single line.
\item The details of this aim are such that they will not fit on to a single line. Now the text aligns with the margin.
\end{aims}

\end{document}

enter image description here

Since I wasn't sure about the desired alignment, here's another possibility:

\documentclass{article}
\usepackage{enumitem}
\usepackage[showframe]{geometry}

\newlist{aims}{enumerate}{1}
\setlist[aims,1]{
  label={Aim~\arabic*},
  leftmargin=*,
  align=left,
  labelsep=10mm,
}

\begin{document}

\begin{aims}
\item This aim fits nicely on to a single line.
\item The details of this aim are such that they will not fit on to a single line. Now the text aligns with the margin.
\item This aim fits nicely on to a single line.
\item The details of this aim are such that they will not fit on to a single line. Now the text aligns with the margin.
\end{aims}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • Thank you for these options. Part 2 of your solution solved my problem and things now look great. If there is a way to acknowledge a useful solution, let me know and I'll attribute it. (P.S my reputation is so low I am unable to upvote. I will be sure to do this as soon as I can).

    Kudos :)

    – MRJ Apr 07 '13 at 15:15
  • @MRJ You're welcome! Now that you mention it, yes, there's a way. You can accept an answer that you consider solved your problem by clicking on the check-mark to the left of the answer. More information on How do you accept an answer?. – Gonzalo Medina Apr 07 '13 at 15:23
1

I'm not sure exactly what you want, but here is an attemp:

\documentclass{article}

\newcounter{myenumi}
\renewcommand{\themyenumi}{(\roman{myenumi})}
\newenvironment{myenumerate}{%
% stuff for beginning of environment goes here
\setlength{\parindent}{0pt}% don't indent paragraphs
\setcounter{myenumi}{0}% restart numbering
\bigskip% skip a line
\renewcommand{\item}{% new definition of item
\par% start a new line
\refstepcounter{myenumi}% advance counter
\makebox[2.5em][l]{\themyenumi}% print counter to width of 3em, aligned to left
}% end of definition of item
}{% at end of environment
\par% start new paragraph
\bigskip% skip a line
\noindent% don't indent new paragraph
\ignorespacesafterend% ignore spaces after environment
}

\pagestyle{empty}

\begin{document}

\noindent Here is some regular text, and I'm going to go on a bit just to see where it wraps and all that.
\begin{myenumerate}
\item Here is the first item which goes on a bit so we can see how it wraps, and it still needs to be longer.
\item Here is another item.
\item Here is yet another item.
\item And this item is going to be much much longer so we can see another example of one that wraps.
\end{myenumerate}
Here is some more regular text, and let's go on a bit here too, just in case it's important how that looks too.

\end{document}

output

P.S. I cannot remember where I originally got this code, but it is not my own. (If you can recognise this as something you have written or know who has, let me know; I will then delete my answer and let you post it.)

  • Hi and thanks for the potential solution. Unfortunately it doesn't seem to achieve what I was hoping for. To clarify, I would basically like a list of items where the label is "Aim X". Associated with this label is text which should be 1) on the same line as the label 2) should wrap as a block of text adjacent to the label, as opposed to proceeding off of the edge of the page. – MRJ Apr 07 '13 at 15:04