# How to check if at first \item in a list/start of the list?

I have a (rather rudimentary) self-defined environment, skipitemize, which is as follows:

\newenvironment{skipitemize}
[1][1]
{\itemize\let\olditem\item\renewcommand\item[1][#1]{\ifnum0=##1\relax\else\ifnum1=##1\smallskip\else\ifnum2=##1\medskip\else\ifnum3=##1\bigskip\else\relax\fi\fi\fi\fi\olditem\relax}}
{\enditemize}


I do apologise if it's a bit difficult to read.

Anyway, although this environment gets the job done (creates skips between \items), it generates an extra skip at the front.

This is shown in this following example:

\documentclass{article}
\newenvironment{skipitemize}
[1][1]
{\itemize\let\olditem\item\renewcommand\item[1][#1]{\ifnum0=##1\relax\else\ifnum1=##1\smallskip\else\ifnum2=##1\medskip\else\ifnum3=##1\bigskip\else\relax\fi\fi\fi\fi\olditem\relax}}
{\enditemize}
\begin{document}
Not so much spacing below here.

\begin{itemize}
\item Foo
\item Bar
\end{itemize}
\newpage
More spacing below here.

\begin{skipitemize}[3]
\item Foo
\item Bar
\end{skipitemize}


In my opinion the extra space looks ugly.

Is there a way to check if I am at the first item in the list (ie the start of the list), and suppress the skip before the first item of a list?

Thank you!

• Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Also, the solution may be dependent on the packages that you are using. – Peter Grill Feb 28 '16 at 12:29
• OK. I'll do that. – Shirayuki Rin Feb 28 '16 at 12:31
• you should not do this at all and instead just (directly or using enumitem package) specify the skip before the list and the skip before each item, latex lists are already parameterised to allow these to be specified separately so there is no need to redefine \item – David Carlisle Feb 28 '16 at 12:37
• You may want to use enumitem package. It gives you a lot of options related to, among others, spacing in lists. – tomasz Feb 28 '16 at 13:01
• @DavidCarlisle how do I "directly" specify the skip before the list and before each item? Do you mean something like: \begin{itemize} \bigskip \item foo \bigskip \item bar \end{itemize}? – Shirayuki Rin Feb 28 '16 at 13:11

What you really want is to increase \itemsep:

\documentclass{article}

\newenvironment{skipitemize}[1][1]
{\itemize\increaseitemsep{#1}}
{\enditemize}

\newcommand{\increaseitemsep}[1]{%
\ifcase#1\relax
% 0, do nothing
\or
\smallskipamount % 1
\or
\medskipamount % 2
\or
\bigskipamount % 3
\fi
}%
}

\begin{document}
Not so much spacing below here.

\begin{itemize}
\item Foo
\item Bar
\end{itemize}

More spacing below here.

\begin{skipitemize}[3]
\item Foo
\item Bar
\end{skipitemize}

\end{document}


• Wow, thanks a lot! I didn't know about \ifcase so I learnt something more from your answer! – Shirayuki Rin Feb 28 '16 at 13:22
• By the way, will \increaseitemsep increase the \itemsep multiple times if I have multiple lists in an article? That's what it's looking like now. – Shirayuki Rin Feb 28 '16 at 13:25
• @ShirayukiRin The setting to \itemsep is reverted as soon as the skipitemize environment ends. It will propagate to nested lists, though. – egreg Feb 28 '16 at 13:26