Text Formatting ⇒ Formatting enumerate environment
Formatting enumerate environment
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
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Formatting enumerate environment
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
\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}
Re: Formatting enumerate environment
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
Formatting enumerate environment
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 withian22 wrote:...The first is that if I don't include \parskip=\baselineskip, I have no space between paragraphs, which doesn't look very good...
Code: Select all
\setlength\parindent{0pt}
The documentation for enumitem explains the horizontal lengths involved in a list-like environment. My example code includes the necessary modifications.ian22 wrote:...The second is that there is a hanging indent if the item entry is more than one line. Which length controls this?...
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.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...
Code: Select all
\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\bigskip
paragraph 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}\bigskip
As we can see in \ref{ite:b}, \ref{ite:c}, and \ref{ite:a}
\end{document}
Re: Formatting enumerate environment
ian