15

In Beamer, I can easily set the desired vertical space between items in an enumerated list with itemsep. But how do I set the vertical space between the line that introduces the enumerated list and the first item in this list? Ideally I would like it to be identical to the space between the items in the list. In the MWE below, I want more space after the itemized line "Here are two interesting things:"

\documentclass{beamer}
\usepackage{lmodern}

\begin{document}
    \begin{frame}
        \begin{itemize}
            \item Here are two interesting things:
            \begin{enumerate} \itemsep2ex
                \item This is number one.
                \item And this is number two.
            \end{enumerate}
        \end{itemize}
    \end{frame}
\end{document}

enter image description here

1 Answer 1

17

Simply setting \topsep as is usual does not work in the beamer case. Instead you can redefine \@listii as follows:

Sample outptu

\documentclass{beamer}
\usepackage{lmodern}

\makeatletter
\def\@listii{\leftmargin\leftmarginii
              \topsep    2ex
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\makeatother

\begin{document}
    \begin{frame}
        \begin{itemize}
            \item Here are two interesting things:
            \begin{enumerate} \itemsep2ex
                \item This is number one.
                \item And this is number two.
            \end{enumerate}
        \end{itemize}
    \end{frame}
\end{document}

See the file beamerbaselocalstructure.sty where you will find the formatting variables \@listi, \@listii and \@listiii for formatting of lists at depths one, two and three, respectively.

You can define macro that will set \topsep, \itemsep to the same value (#2) for lists of a given level as in the example below. This is particularly useful you want to scope the change of definition for just a single frame.

\documentclass{beamer}
\usepackage{lmodern}

\makeatletter
\newcommand{\setlistspacing}[2]{\def\@ld{#1}\expandafter\def\csname
@list\romannumeral\@ld \endcsname{\leftmargin\csname
leftmargin\romannumeral\@ld \endcsname
              \topsep    #2
              \parsep    0\p@   \@plus\p@
              \itemsep   #2}}
\makeatother

\begin{document}
{\setlistspacing{2}{2ex}
\begin{frame}
  \begin{itemize}
  \item Here are two interesting things:
    \begin{enumerate}
    \item This is number one.
    \item And this is number two.
    \end{enumerate}
  \item Here are no interesting things.
  \item Here are two interesting things:
    \begin{enumerate}
    \item This is number one.
    \item And this is number two.
    \end{enumerate}
  \end{itemize}
\end{frame}
}

{\setlistspacing{1}{4ex}
\begin{frame}
  \begin{itemize}
  \item Here are two interesting things:
    \begin{enumerate}
    \item This is number one.
    \item And this is number two.
    \end{enumerate}
  \item Here are no interesting things.
  \item Here are two interesting things.
    \begin{enumerate}
    \item This is number one.
    \item And this is number two.
    \end{enumerate}
  \end{itemize}
\end{frame}
}

\begin{frame}
  \begin{itemize}
  \item Here are two interesting things:
    \begin{enumerate}
    \item This is number one.
    \item And this is number two.
    \end{enumerate}
  \end{itemize}
\end{frame}

\end{document

}

Sample output

2
  • One problem here is that I want some flexibility with respect to what the distance is. On another slide, for example, I might want the distance to be 1ex.
    – Sverre
    Commented Dec 16, 2012 at 19:26
  • 1
    You can put the code from my preamble just before the frame and enclose everything in a \bgroup / \egroup pair. Then it is just that frame that is affected. Commented Dec 16, 2012 at 19:29

You must log in to answer this question.

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