1

I am creating a list in LaTeX using the enumitem package, and having trouble setting the alignment of one item in the list. For that one item, I want to remove the label and decrease the indent so that item is aligned with the labels of the previous items.

Here is the code I am currently using:

\usepackage{enumitem}

\begin{enumerate}
  \item Item 1
  \item Item 2
  \item Item 3
  \item Item 4
  \item[] Item 5
\end{enumerate}

Which looks like this:

1. Item 1
2. Item 2
3. Item 3
4. Item 4
   Item 5

But what I want is this:

1. Item 1
2. Item 2
3. Item 3
4. Item 4
Item 5

Making a new paragraph doesn't work because LaTeX automatically creates space after the list and Item 5 needs to be part of the list.

Thanks in advance!

  • 1
    you could always use \item[]\hspace*{-whatever your indent is} Item 5 but how is the reader to to know that's item 5? it would be better markup to just end the list after 4, and arrange that it does not add vertical space – David Carlisle Oct 17 '17 at 22:29
1

Changing your syntax slightly (just to add more functionality), you can use \item*:

enter image description here

\documentclass{article}

\usepackage{enumitem,xparse}

\setlength{\parindent}{0pt}% Just for this example

\let\oldenumerate\enumerate
\let\endoldenumerate\endenumerate
\RenewDocumentEnvironment{enumerate}{O{}}
  {\begin{oldenumerate}[#1]
     \let\olditem\item
     \RenewDocumentCommand{\item}{s}{%
       \IfBooleanTF{##1}
         {\olditem[]\hspace*{\dimexpr-\labelindent-\labelwidth-\labelsep}\ignorespaces}
         {\olditem}}
     }
  {\end{oldenumerate}}

\begin{document}

Some reference text.

\begin{enumerate}
  \item Item 1
  \item Item 2
  \item Item 3
  \item Item 4
  \item[] Item 5
\end{enumerate}

Some reference text.

\begin{enumerate}[label=\roman*]
  \item Item 1
  \item Item 2
  \item Item 3
  \item Item 4
  \item* Item 5
\end{enumerate}

Some reference text.

\end{document}

The above redefinition of the enumerate environment keeps the optional argument functionality provided by enumitem while changing the way \item functions; it adds a starred \item* version. This *-version sets a regular \item[] and backspaces to the margin.

|improve this answer|||||
  • I think the O.P. wants to backspace to the left side of the labels (which implies using the key align=left, or wide). – Bernard Oct 17 '17 at 23:08
  • Rather than redefining the enumerate environment you can, instead, add before=\let\olditem\newitem to the environment, where \newitem is the *-accepting item command. See, for example, tex.stackexchange.com/questions/342934/… – Andrew Oct 18 '17 at 7:06

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.