2

I would like to insert a small line between certain items of a list, so that it will look roughly like this:

(1) This is the first line

(2) This is the second line
    --------
(3) This is the last line

This is what I have so far:

\documentclass{article}
\usepackage{enumitem}
\begin{document}

\begin{enumerate}[label=(\arabic*)]
    \item This is the first item
    \item This is the second item
    \\ \rule{2cm}{1pt}
    \item This is the last item
\end{enumerate}

\end{document}

But, this causes the rule to be placed on its own line, creating a huge space in the list:

Imgur

How can I draw a line like this without all the extra space, and without ending the enumerate environment?

Also, this part is not a requirement, but is it possible to make the left side of the line align with the left of the labels for the items in the list? e.g.:

(1) this is the first line
------------
(2) this is the last line
1

When I do this, I want some space added due to the line, but not as much as having the line on a regular-height line would give. Also, I want the line to start at the left of the list.

For example:

\documentclass{article}
\usepackage{enumitem,expdlist}
\newlist{inferenum}{enumerate}{10}
\setlist[inferenum]{%
  label={\arabic*.},
  ref={\arabic*},
  itemsep=.25\baselineskip,
  parsep=0pt,
  labelindent=\parindent,
  leftmargin=*,
  widest={99},
  align=left,
  before*={%
    \pagebreak[3]%
    \renewcommand{\listpartsep}{-.5\baselineskip}%
    \renewcommand{\inferline}{%
      \listpart{%
        \hspace{\trythis}\rule{25mm}{0.5pt}%
      }%
    }%
  },
}
\let\sent\item
\newlength{\trythis}
\setlength{\trythis}{\parindent}
\newcommand{\inferline}{}
\begin{document}
\begin{inferenum}
  \sent This is given as one thing.
  \sent This is taken to mean another.
  \inferline
  \sent Finally, the upshot is the result.
\end{inferenum}
\end{document}

gives

list with line

Adapting this to your desiderata, you might write, for example,

\documentclass{article}
\usepackage{enumitem,expdlist}
\newlist{inferenum}{enumerate}{10}
\setlist[inferenum]{%
  label={\arabic*.},
  ref={\arabic*},
  itemsep=.25\baselineskip,
  parsep=0pt,
  labelindent=\parindent,
  leftmargin=*,
  widest={99},
  align=left,
  before*={%
    \pagebreak[3]%
    \renewcommand{\listpartsep}{-\topsep}%
    \renewcommand{\inferline}{%
      \listpart{%
        \hspace{2\labelindent}\rule{25mm}{0.5pt}%
      }%
    }%
  },
}
\let\sent\item
\newcommand{\inferline}{}
\begin{document}
\begin{inferenum}
  \sent This is given as one thing.
  \sent This is taken to mean another.
  \inferline
  \sent Finally, the upshot is the result.
\end{inferenum}
\end{document}

adapted to desiderata

3

Something like this? I also defined a \sepitem command for an item with a separating line above:

\documentclass{article}

\usepackage{enumitem}
\newcommand\sepitem{\item\raisebox{2.8ex}[0pt]{\rlap{\rule{2cm}{0.8pt}}}}

 \begin{document}

\begin{enumerate}[label=(\arabic*)]
\item This is the first item
\item This is the second item
\item\raisebox{2.8ex}[0pt]{\rlap{\rule{2cm}{1pt}}}%
 This is the last but one item
\sepitem This is the last item
\end{enumerate}

\end{document} 

enter image description here

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.