### Featured Books

Preorder discount 35%
coupon code LXCB35

Limited discount 50%
coupon code tDRet6Y

### Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 10 guests

## Formatting enumerate environment

Add tags Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)

### Formatting enumerate environment

Hi,
I am trying to write a letter report for work in Latex. The formatting standard doesn't look great, but I'm stuck with it. On the first page of the letter report I need something like:

Underlined Letter Subject
References: A. ASTM E8M – 00, Standard Test Methods for Tension Testing of Metallic Materials
B. A second reference. Second line does not have hanging indent.
C. Another reference.

It basically has to look like this - no space between any of these lines, no hanging indent, and "References:" immediately before the first one.

I tried using the list and enumerate environments, but couldn't control the spaces while enumerating with capital letters. I want to refer to the references (rarely more than five in these types of reports) with proper cross-references, so I need something I can label that will give something sensible when I write "Reference~\ref{ASTME8}", or something of that sort. I have tried the enumerate and enumitem packages, but find they were conflicting somewhat. I'd appreciate any suggestions. Thanks,

Ian
ian22

Posts: 3
Joined: Fri Feb 12th, 2010

### Re: Formatting enumerate environment

Hi,

in code below I used the enumitem package to define two new environments: (smylist and emylist) which are in fact variations on the standard enumerate environment. The first environment should be used to produce only the first item of the list; the second environment should be used to produce the remaining items.

To cross-reference the items, you can use the standard \label, \ref mechanism.

Take a look at the example:

Code: Select all  •  Open in writeLaTeX
\documentclass{book}\usepackage{enumitem}\newenvironment{smylist}  {\par\noindent References:%      \vspace*{-\baselineskip}%      \begin{enumerate}[itemindent=1.9cm,nolistsep,align=left,leftmargin=*,        labelsep=3pt,label=\Alph*.]}  {\end{enumerate}}\newenvironment{emylist}  {\begin{enumerate}[nolistsep,label=\Alph*.,align=left,leftmargin=*,labelsep=3pt]    \stepcounter{enumi}}  {\end{enumerate}}\begin{document}text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text\begin{smylist}  \item\label{ite:a} First item.\end{smylist}\begin{emylist}  \item\label{ite:c} Second item.  \item\label{ite:b} Third item.\end{emylist}As we can see in \ref{ite:b}, \ref{ite:c}, and \ref{ite:a}...\end{document}

Feel free to adapt my example according to your needs.
1,1,2,3,5,8,13,21,34,55,89,144,233,...

gmedina

Posts: 2313
Joined: Wed Jul 11th, 2007
Location: Colombia

### Re: Formatting enumerate environment

Thanks, that works great, but I have three problems with it. The first is that if I don't include \parskip=\baselineskip, I have no space between paragraphs, which doesn't look very good. When I include this line, there are vertical spaces between "References:" and "A." and between the A entry and B entry.

The second is that there is a hanging indent if the item entry is more than one line. Which length controls this?

The third is that Reference~\ref{ref to item A} will output "Reference A." Is there a way to omit the period? It is out of place in the middle of a sentence.

Thanks for your help. This has gotten me a lot closer to what I need.

Ian
ian22

Posts: 3
Joined: Fri Feb 12th, 2010

### Re: Formatting enumerate environment

ian22 wrote:...The first is that if I don't include \parskip=\baselineskip, I have no space between paragraphs, which doesn't look very good...

To increase the vertical separation between paragraphs use one of the commands \bigskip, \medskip or \smallskip. Do not change \parskip as this could affect other parts of your document in an undesired way. The example below shows the use of \bigskip; of course, now the paragraph indentation is superfluous so I suppressed it with

Code: Select all  •  Open in writeLaTeX
\setlength\parindent{0pt}

ian22 wrote:...The second is that there is a hanging indent if the item entry is more than one line. Which length controls this?...

The documentation for enumitem explains the horizontal lengths involved in a list-like environment. My example code includes the necessary modifications.

ian22 wrote:...The third is that Reference~\ref{ref to item A} will output "Reference A." Is there a way to omit the period? It is out of place in the middle of a sentence...

Again, the documentation contains the answer. All you have to do is to use the ref key in the format declaration of the list. See my example below.

Code: Select all  •  Open in writeLaTeX
\documentclass{book}\usepackage{enumitem}\newenvironment{smylist}  {\par\noindent References:%      \vspace*{-\baselineskip}%      \begin{enumerate}[nolistsep,label=\Alph*.,ref=\Alph{enumi},        leftmargin=0pt,labelsep=15pt,align=left,        labelwidth=-0.5cm,itemindent=1.9cm]}  {\end{enumerate}}\newenvironment{emylist}  {\begin{enumerate}[nolistsep,label=\Alph*.,ref=\Alph{enumi},      leftmargin=0pt,labelsep=0pt,align=left,      labelwidth=17pt,itemindent=16pt]    \stepcounter{enumi}}  {\end{enumerate}}\setlength\parindent{0pt}\begin{document}paragraph one text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text\bigskipparagraph two text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text\bigskip\begin{smylist}  \item\label{ite:a} First item text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\end{smylist}\begin{emylist}  \item\label{ite:c} Second item text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.  \item\label{ite:b} Third item.\end{emylist}\bigskipAs we can see in \ref{ite:b}, \ref{ite:c}, and \ref{ite:a}\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

gmedina

Posts: 2313
Joined: Wed Jul 11th, 2007
Location: Colombia

### Re: Formatting enumerate environment

That works great; thank a lot.

ian
ian22

Posts: 3
Joined: Fri Feb 12th, 2010