5

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}
  • 4
    Don't use hyphens for marking items; an en-dash -- is better. – egreg Dec 6 '13 at 10:05
5

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.

  • 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 '13 at 9:41
  • Sorry I wrote itemize instead of enumerate. I think my updated solution should do want you want. – Andrew Swann Dec 6 '13 at 9:50
3

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

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.