Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

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

share|improve this answer
    
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 Dec 16 '12 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. –  Andrew Swann Dec 16 '12 at 19:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.