1

I am using a list like this:

\section{My section}
\begin{enumerate}
\item My first item
\item Second item
\end{enumerate}

The problem is that enumerate produces a vertical whitespace just before the first item.

So if I use

\section{My section}
Some text
\begin{enumerate}
\item My first item
\item Second item
\end{enumerate}

instead of just

\section{My section}
\begin{enumerate}
\item My first item
\item Second item
\end{enumerate}

the first item, "My first item", will have exact same location.

So the list environment seems to reserve a spot for text above it. I have tried using:

\usepackage{enumitem}
\setenumerate{partopsep=0cm, topsep=0cm}

but it doesn't change anything.

I guess I could use \vspace{-some value} just before my lists, but I need a more generic code, so I have to set the option globally.

Edit

This code:

\documentclass{article}

\usepackage{titlesec}
\usepackage{enumitem}

\titleformat{\section}[leftmargin]{\raggedright}{}{0pt}{}[]
\titlespacing*{\section}{2.5cm}{2.5ex}{0cm}

\setlist[enumerate]{topsep=0cm, leftmargin=0cm, label={}}

\begin{document}

\section{Experience}
Some text
\begin{enumerate}
\item Software Developer
\item Project Manager
\end{enumerate}

\section{Education}
\begin{enumerate}
\item M.Sc.
\item B.Sc.
\end{enumerate}

\end{document}

produces this:

enter image description here

As seen next to "Education", the problem is that the list 'reserves' some space for a paragraph just above it.

10
  • Try \setlist[enumerate]{topsep=0pt] -- please note that \section has also a vertical skip!
    – user31729
    Nov 22, 2015 at 9:39
  • \setenumerate is deprecated by the way (according to the manual) -- since the spacing below enumerate is ruled by topsep also changing topsep will also modify the below skip as well!
    – user31729
    Nov 22, 2015 at 9:45
  • Still no difference :(
    – Jamgreen
    Nov 22, 2015 at 10:56
  • For me the vertical space is the same with or without "Some text" before the enumerate environment. Please provide a full MWE.
    – musicman
    Nov 22, 2015 at 11:08
  • I have edited my question.
    – Jamgreen
    Nov 22, 2015 at 11:13

1 Answer 1

2

Better use a table for the job. For example:

\documentclass{article}
\usepackage{setspace}

\begin{document}

% \renewcommand{\arraystretch}{1.15}%height of table rows
\onehalfspacing%linespacing

\begin{tabular}{l p{\dimexpr\linewidth-2.5cm}}
Experience & Software Developer\newline Project Manager\\[5mm]
Education & M.Sc.\newline B.Sc.\\
\end{tabular}

\end{document}
3
  • 1
    Thanks but I really want to use sections if ever possible.
    – Jamgreen
    Nov 22, 2015 at 12:08
  • Why does it need to be a section?
    – musicman
    Nov 22, 2015 at 19:33
  • So that I get a 'table of contents' in my PDF reader
    – Jamgreen
    Mar 28, 2016 at 13:55

You must log in to answer this question.

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