LaTeX beamer: way to change the bullet indentation?

LatexBeamer

Latex Problem Overview


I've checked the Beamer Class manual (PDF file).

I can't figure out how to change the indentation bullet assigns to \itemize.

[This is kind of important, as I'm using 2 column slides, and I don't want beamer to steal too much horizontal space].

Latex Solutions


Solution 1 - Latex

Beamer just delegates responsibility for managing layout of itemize environments back to the base LaTeX packages, so there's nothing funky you need to do in Beamer itself to alter the apperaance / layout of your lists.

Since Beamer redefines itemize, item, etc., the fully proper way to manipulate things like indentation is to redefine the Beamer templates. I get the impression that you're not looking to go that far, but if that's not the case, let me know and I'll elaborate.

There are at least three ways of accomplishing your goal from within your document, without mussing about with Beamer templates.

With itemize

In the following code snippet, you can change the value of \itemindent from 0em to whatever you please, including negative values. 0em is the default item indentation.

The advantage of this method is that the list is styled normally. The disadvantage is that Beamer's redefinition of itemize and \item means that the number of paramters that can be manipulated to change the list layout is limited. It can be very hard to get the spacing right with multi-line items.

\begin{itemize}
  \setlength{\itemindent}{0em}
  \item This is a normally-indented item.
\end{itemize}

With list

In the following code snippet, the second parameter to \list is the bullet to use, and the third parameter is a list of layout parameters to change. The \leftmargin parameter adjusts the indentation of the entire list item and all of its rows; \itemindent alters the indentation of subsequent lines.

The advantage of this method is that you have all of the flexibility of lists in non-Beamer LaTeX. The disadvantage is that you have to setup the bullet style (and other visual elements) manually (or identify the right command for the template you're using). Note that if you leave the second argument empty, no bullet will be displayed and you'll save some horizontal space.

\begin{list}{$\square$}{\leftmargin=1em \itemindent=0em}
  \item This item uses the margin and indentation provided above.
\end{list}

Defining a customlist environment

The shortcomings of the list solution can be ameliorated by defining a new customlist environment that basically redefines the itemize environment from Beamer but also incorporates the \leftmargin and \itemindent (etc.) parameters. Put the following in your preamble:

\makeatletter
\newenvironment{customlist}[2]{
  \ifnum\@itemdepth >2\relax\@toodeep\else
      \advance\@itemdepth\@ne%
      \beamer@computepref\@itemdepth%
      \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
      \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
      \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
      \begin{list}
        {
            \usebeamertemplate{itemize \beameritemnestingprefix item}
        }
        { \leftmargin=#1 \itemindent=#2
            \def\makelabel##1{%
              {%  
                  \hss\llap{{%
                    \usebeamerfont*{itemize \beameritemnestingprefix item}%
                        \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
              }%  
            }%  
        }
  \fi
}
{
  \end{list}
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
\makeatother

Now, to use an itemized list with custom indentation, you can use the following environment. The first argument is for \leftmargin and the second is for \itemindent. The default values are 2.5em and 0em respectively.

\begin{customlist}{2.5em}{0em}
   \item Any normal item can go here.
\end{customlist}

A custom bullet style can be incorporated into the customlist solution using the standard Beamer mechanism of \setbeamertemplate. (See the answers to this question on the TeX Stack Exchange for more information.)

Alternatively, the bullet style can just be modified directly within the environment, by replacing \usebeamertemplate{itemize \beameritemnestingprefix item} with whatever bullet style you'd like to use (e.g. $\square$).

Solution 2 - Latex

I use the package enumitem. You may then set such margins when you declare your lists (enumerate, description, itemize):

\begin{itemize}[leftmargin=0cm]
    \item Foo
    \item Bar
\end{itemize}

Naturally, the package provides lots of other nice customizations for lists (use 'label=' to change the bullet, use 'itemsep=' to change the spacing between items, etc...)

Solution 3 - Latex

Setting \itemindent for a new itemize environment solves the problem:

\newenvironment{beameritemize}
{ \begin{itemize}
  \setlength{\itemsep}{1.5ex}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}   
  \addtolength{\itemindent}{-2em}  }
{ \end{itemize} } 

Solution 4 - Latex

To set the indentation globally, without using enumitem (which doesn't work on Beamer), put the following in your preamble:

\setlength{\leftmargini}{0.5cm}
\setlength{\leftmarginii}{0.5cm}

leftmargini and leftmarginii change the first and second list level, respectively.

This solution was given here.

Solution 5 - Latex

Like Geoff's answer, I found a solution I like using enumitem. Set defaults with \setlist[⟨names⟩,⟨levels⟩]{⟨keys/values⟩} to inherit existing (theme?) attributes or \setlist*[⟨names⟩,⟨levels⟩]{⟨keys/values⟩} to fully reset. See the enumitem documentation.

The following sets indentation for the first four levels of nested lists as well as explicitly declares labels. The labels here defaults to bullets for itemized lists and arabic numbers for enumerated lists. It then resets the default labels for nested lists; long-hyphen for 2nd itemized, single hyphen for third itemized, etc. The last line resets default label for 2nd level itemized enumerated lists to be alphabetic (a, b, c).

\usepackage{enumitem}
\setlist[1]{leftmargin=0em}
\setlist[2]{leftmargin=2em} %list within a list
\setlist[3]{leftmargin=2.5em} %list within a list within a list
\setlist[4]{leftmargin=3em}
\setlist[itemize]{label=\textbullet}
\setlist[itemize,2]{label={--}}
\setlist[itemize,3]{label={-}}
\setlist[itemize,4]{label={\textperiodcentered}}
\setlist[enumerate]{label={\arabic*}}
\setlist[enumerate,2]{label={\alph*}}

With enumitem you can also declare a specific label or spacing for a particular instance by adding the options e.g. \begin{itemize}[label={*}] This is Geoff's answer.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionanonView Question on Stackoverflow
Solution 1 - LatexRTBarnardView Answer on Stackoverflow
Solution 2 - LatexGeoffView Answer on Stackoverflow
Solution 3 - LatexGergelyView Answer on Stackoverflow
Solution 4 - LatexFedFranzView Answer on Stackoverflow
Solution 5 - LatexT. Zack CrawfordView Answer on Stackoverflow