12

How can i remove space before enumerate?

% before \begin{document}
\usepackage{enumerate}

This is first line and i need to remove space between this line and item list below it.

% after \begin{document}
\begin{enumerate}[-]
 \item asdasd
 \item dsfdsf
\end{enumerate}
1
  • 5
    Don't use hyphens for marking items; an en-dash -- is better.
    – egreg
    Dec 6, 2013 at 10:05

2 Answers 2

9

This is easiest to do with the enumitem package. You can either specify topsep=0pt or probably better nosep which will also reduce the vertical spacing between items:

Sample output

\documentclass{article}

\usepackage[shortlabels]{enumitem}

\begin{document}
This is first line and i need to remove space between this line and
item list below it.
\begin{enumerate}[-,topsep=0pt]
\item asdasd
\item dsfdsf
\end{enumerate}

This is first line and i need to remove space between this line and
item list below it.
\begin{enumerate}[-,nosep]
\item asdasd
\item dsfdsf
\end{enumerate}

\end{document}

To set such an option globally, use \setlist:

\documentclass{article}

\usepackage[shortlabels]{enumitem}
\setlist[enumerate]{nosep}

\begin{document}
This is first line and i need to remove space between this line and
item list below it.
\begin{enumerate}[-]
\item asdasd
\item dsfdsf
\end{enumerate}

\end{document}

enumitem with the shortlabels option essentially reproduces the behaviour of the enumerate package.

4
  • I need to use enumerate instead of enumitem as i have already coded 6000 lines using this. I prefer not to change this.
    – manish
    Dec 6, 2013 at 9:41
  • Sorry I wrote itemize instead of enumerate. I think my updated solution should do want you want. Dec 6, 2013 at 9:50
  • Those approaches didn't work
    – alper
    Dec 7, 2019 at 22:41
  • @alper Can you be specific? The code works for me. Dec 8, 2019 at 12:13
6

some what similar question had been asked before: Vertical space in lists a possible idea could be if you want to use enumerate:

\documentclass[12pt]{report}
\usepackage{paralist}
  \let\itemize\compactitem
  \let\enditemize\endcompactitem
  \let\enumerate\compactenum
  \let\endenumerate\endcompactenum
  \let\description\compactdesc
  \let\enddescription\endcompactdesc
  \pltopsep=1pt
  \plitemsep=1pt
  \plparsep=1pt

\begin{document}
This is the first line
\begin{enumerate}
 \item asdasd
 \item dsfdsf
 \item fajfaf
\end{enumerate}
\end{document}

With this code result is: enter image description here

You can change the vertical length by :

\pltopsep=1pt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .