51

I'd like to modify the spacing between items in the itemize environment. This post shows how to modify a specific itemize environment (\addtolength{\itemsep}{0.5\baselineskip}). However, I'd like to do it globally for the entire document. This post suggests the enumitem package. However, I get an error in beamer when i use this package (just declaring it). Any suggestions? I'm currently using the addtolength method on all my itemize environments. I'd like a global solution. Thanks.

1

7 Answers 7

24

In most documents, you can do this, which avoids the use of extra packages.

\let\tempone\itemize
\let\temptwo\enditemize
\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{0.5\baselineskip}}{\temptwo}

(Stufazi suggested a neater way of doing this in his answer, which I will use below.)

However, I think that the frame environment in beamer resets the properties of itemize. You could do something like this, but it will prevent frame's optional arguments from working.

\documentclass{beamer}
\let\oldframe\frame
\renewcommand{\frame}{%
\oldframe
\let\olditemize\itemize
\renewcommand\itemize{\olditemize\addtolength{\itemsep}{100pt}}%
}
%
\begin{document}
\begin{frame}
\begin{itemize}
\item The first.
\item The second.
\item The third.
\end{itemize}
\end{frame}
%
\begin{frame}
\begin{itemize}
\item The fourth.
\item The fifth.
\item The sixth.
\end{itemize}
\end{frame}
%
\end{document}

Alternatively, you could try this, but I can't guarantee that it won't break something else.

\documentclass{beamer}
\newlength{\wideitemsep}
\setlength{\wideitemsep}{\itemsep}
\addtolength{\wideitemsep}{100pt}
\let\olditem\item
\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem}
%
\begin{document}
\begin{frame}
\begin{itemize}
\item The first.
\item<2-> The second.
\item<3-> The third.
\end{itemize}
\end{frame}
%
\begin{frame}[shrink=50]
\begin{itemize}
\item The fourth.
\item The fifth.
\item The sixth.
\end{itemize}
\end{frame}
%
\end{document}

It might be safer to define your own list environment based on itemize and use this in future; thus

\newenvironment{wideitemize}{\itemize\addtolength{\itemsep}{100pt}}{\enditemize}

This would avoid the necessity for hacks that have unwanted side effects.

3
  • I am a user of the wideitemize environment. When I have them nested though, I cannot change the font size of the inner one using \fontsize. only the outer one. Do you know why this might be the case?
    – luchonacho
    Nov 4, 2020 at 14:59
  • @luchonacho --- I would guess it's a grouping issue. I suggest asking a new question about this, with an example code for others to play around with. It shouldn't be too difficult to fix this, once we see exactly what you are doing (famous last words). Nov 4, 2020 at 20:32
  • Actually, it has nothing to so with the new environment. Question here: tex.stackexchange.com/q/569624/77895
    – luchonacho
    Nov 4, 2020 at 22:19
22

Just put the two line in your foredocument (change the 100pt to any value you want):

\let\OLDitemize\itemize
\renewcommand\itemize{\OLDitemize\addtolength{\itemsep}{100pt}}

And if next time you write your document using the enumitem package (recommended!), you could

\usepackage{enumitem}
\setitemize{itemsep=100pt}
4
  • 17
    @Michael enumitem does not work with beamer as I've described. @Stufazi this did not work for me. I placed it right after \documentclass{beamer} Apr 29, 2011 at 19:39
  • Thanks for \setitemize, worked for me.
    – Stan
    Nov 25, 2020 at 15:05
  • or you can use \usepackage{enumitem} and then \begin{enumerate}[itemsep=100pt] ... Feb 5, 2022 at 7:41
  • it is possible that this interacts poorly with the bracket arguments after \begin{itemize} like [<+->]? The first solution causes a missing \item error in code that compiled previously. This is my best guess.
    – MRule
    Jun 9, 2023 at 15:59
16

After diving a bit into beamer's source files, I think that I've found the best way to implement this without breaking other options or advanced features of the itemize or frame environments. The solution is to define a new frame option like:

\makeatletter
\define@key{beamerframe}{wide}[30pt]{%
  \def\beamer@cramped{\itemsep #1\topsep0.5pt\relax}}
\makeatother

So that one can later write:

\begin{frame}[wide]
% ...
\end{frame}

to get “wider”, more spacey, versions of all the itemize, enumerate and description environments used in the frame. This is actually just a copy from another squeeze option already defined by beamer, so I'm guessing this would be the “proper” way to implement this without breaking anything.


Set as default

One would also want, probably, an option to make this the default for all frames. Unfortunately beamer does not seem to support setting default frame options. The following is a bit of a hack, but I'm hoping it not to break anything. Throw all of this code in a style file (say beamer-extra.sty):

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamer-extra}[2013/08/22 Some extra beamer features]
\RequirePackage{etoolbox}

% A command to set default frame options:
%   \defaultframeoptions{<options>}  % append some more defaults options
%   \defaultframeoptions*{<options>} % clear past defaults, set some new
\def\beamer@extra@frameoptions{}
\def\beamer@extra@setframeoptions#1%
  {\appto\beamer@extra@frameoptions{\setkeys{beamerframe}{#1}}}
\def\defaultframeoptions{\@ifstar
  {\def\beamer@extra@frameoptions{}\beamer@extra@setframeoptions}
  {\beamer@extra@setframeoptions}}
\define@key{beamerframe}{environment}%
  {\def\beamer@frameenvironmentsubst{#1}\beamer@extra@frameoptions}

% A new frame option for wider items
\define@key{beamerframe}{wide}[30pt]{%
  \def\beamer@cramped{\itemsep #1\topsep0.5pt\relax}}

And then use it like:

\documentclass{beamer}
\usepackage{beamer-extra}
\defaultframeoptions{wide=15pt}

\begin{document}
\begin{frame}
\frametitle{Example}
\begin{itemize}
\item One
\item Two
\item Three
\end{itemize}
\end{frame}
\end{document}
2
  • This works perfectly, thank you Jun 9, 2020 at 13:51
  • Also works for note (beamernotes)
    – mrupp
    Nov 2, 2020 at 12:24
8

Another solution that works with beamer is to redefine \item as suggested in this answer to a related question:

\let\olditem\item
\renewcommand{\item}{%
\olditem\vspace{4pt}}

This puts a space after items, even when they are followed by sub-items, unlike solutions based on \itemsep.

Rather than using a fixed size, this solution can be used with \fill so that the items (and sub-items) are spread out to fill the slide:

\let\olditem\item
\renewcommand{\item}{%
\olditem\vspace{\fill}}     

This is useful for squeezing space when you want to put a bit more on a slide, or stretching space when a slide doesn't have so much content, so both look reasonable (within limits!).

1
  • 1
    This changes the spacing between items but breaks arguments after \item like \item<+->. Sep 16, 2019 at 8:57
8

As the other answers show, it is quite viable to redefine the environments to your liking. A more beamer specific approach would be to have templates take care of these settings.

There are predefined templates available, that allow us to modify the behaviour of itemize and enumerate environments alike. The following 6, one per line, can be used to decorate these environments.

itemize/enumerate body begin
itemize/enumerate body end
itemize/enumerate subbody begin
itemize/enumerate subbody end
itemize/enumerate subsubbody begin
itemize/enumerate subsubbody end

The sub and subsub templates are used for nesting these environments. The body begin templates, and especially the itemize/enumerate body begin template, can be used to "globally" set item-spacing in itemize (and enumerate) environments for beamer.

(Currently) Beamer starts our subject environments like this

\usebeamertemplate{itemize/enumerate body begin}
\list{redacted}{redacted}
\beamer@cramped
\raggedright
\beamer@firstlineitemizeunskip

For nested environments it uses the subbody-versions of the template.

Let's focus on the internal macro \beamer@cramped: Currently, using only the beamer class and styles as provided by the beamer package, this macro is either empty, or \itemsep0pt\topsep0.5pt\relax. At least \itemsep is one of the settings we are looking for and it is a list-specific (and therefore itemize and enumerate specific) setting. Apparently this macro was introduced exactly for the purpose we are looking for!

This means we are unlikely to break anything, by modifying this macro. We can write templates like this:

\defbeamertemplate*{itemize/enumerate body begin}{myAwesome theme}
{
    \let\this@beamer@cramped\beamer@cramped
    \renewcommand{\beamer@cramped}{
        \this@beamer@cramped
        \addtolength{\itemsep}{.5\baselineskip}
    }
}

\defbeamertemplate*{itemize/enumerate body end}{myAwesome theme}
{
    \let\beamer@cramped\this@beamer@cramped
}

I constructed this code in order to fit the question. Personally, I don't do the \let and \addtolength things. I simply define \beamer@cramped to set \itemsep to an absolute value, i.e.

\renewcommand{\beamer@cramped}{\itemsep2em\relax}

I keep the \relax at the end of my \beamer@cramped definition, because the original authors of \beamer@cramped probably had a reason to put it there in the first place.

The tricky thing is that we need to set \itemsep after \list is called, which means, we cannot simply set \itemsep in the template. By modifying \beamer@cramped we can put our code at a useful position.

It is possible that all of this happens inside of groups, so that our redefinition of `\beamer@cramped is only effective for a specific environment and its nested environments, I didn't investigate.

2
  • Can I use \renewcommand{\beamer@cramped}{\itemsep2em\relax} without defining a new theme? I've tried doing \setbeamertemplate{itemize/enumerate body begin}{\renewcommand{\beamer@cramped}{\itemsep2em\relax}} but it doesn't quite work.
    – darpich
    Jun 17, 2020 at 8:11
  • Yes, you can redefine \beamer@cramped without defining a new theme.
    – Bananguin
    Jun 15, 2021 at 10:40
2

A way of achieving a similar result, without using extra packages is this:

\renewcommand<>{\item}{\beameroriginal\item\vspace{\stretch{.2}}}

Although you will loose the ability to put overlay specification in the \item. Overlay specs still work in the environment options, though.

0

I simply used this settings before the document starts:

\let\realitemize\itemize
\let\endrealitemize\enditemize
\renewenvironment{itemize}{%
    \footnotesize\realitemize\setlength{\parskip}{0pt}\setlength{\itemsep}{0pt plus 1pt}}
    {%
    \footnotesize\endrealitemize%
    }

Here, I additionally decreased the font size to \footnotesize which is optional. The spacing is adjusted with \parskip and \itemsep to achieve optimal goals!

You must log in to answer this question.

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