71

I can't figure out how to line up the symbols of an itemize environment in beamer with the left part of the main text. In other words, I would like to supress the left margin in beamer itemize lists.

It would be nice if the solution worked with any itemize label defined with

\setbeamertemplate{itemize item}[]

In order to make myself clearer, what beamer produces by default is something like:

Main text. Main text. Main text...
   * Item 1
   * Item 2
   * Item 3
   ....

and the desired result is

Main text. Main text. Main text...
* Item 1
* Item 2
* Item 3
....
0

2 Answers 2

59

The beamer class uses the same default lengths for the left margin like the base classes: \leftmargini, \leftmarginii etc. So you could adjust those lenghts. For instance:

\setlength{\leftmargini}{0pt}

You may insert any value instead of 0pt that fits for you.

Further requirements might require a redefiniton or patch of beamer's itemize environment. If you would like to have such complete control over the itemize environment, you could redefine it this way within your preamble:

\makeatletter
\renewcommand{\itemize}[1][]{%
  \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel##1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
          }%
        }%
      }
  \fi%
  \beamer@cramped%
  \raggedright%
  \beamer@firstlineitemizeunskip%
}
\makeatother

Until now it's just a copy of the original! But since it's in your preamble, you can modify it.

For example, replace \hss\llap by \rlap and the bullets will align with the text around:

...
      {\def\makelabel##1{%
          {%
            \rlap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
...

Within this redefinition you could adjust the LaTeX list length macros. This requires to know how to work with the LaTeX list environment.

6
  • 1
    Thanks Stefan, but your code hangs the item labels out into the margin and this is not what I want. Of course, I could change the left margin to a nonzero value, but how could I do it sistematically for itemize lists with any label?
    – rgallego
    Nov 25, 2010 at 17:39
  • @rgallego: I added a redefinition which could give you a start. If you should have a question regarding LaTeX's list environment, you may post it on the site as well.
    – Stefan Kottwitz
    Nov 25, 2010 at 18:02
  • This does only seem to align the bullet-points, but the text of the items is still placed on the same position, which leaves an ugly gap between the bullet-points and the text. Is there a way to change that too?
    – Flow
    Mar 1, 2013 at 12:17
  • Where do I put the code \setlength{\leftmargini}{0pt}?
    – LWZ
    Sep 7, 2013 at 7:42
  • @LWZ Into the preamble, as usual.
    – Stefan Kottwitz
    Sep 7, 2013 at 9:31
30

This seemed to work for me:

\settowidth{\leftmargini}{\usebeamertemplate{itemize item}}
\addtolength{\leftmargini}{\labelsep}
4
  • 1
    What's nice about this solution is that exactly answers the OP's question, i.e., the left edge of the bullets is aligned with the left margin of normal text.
    – banbh
    Nov 9, 2017 at 2:59
  • 2
    +1 \addtolength{\leftmargini}{-2\labelsep} for radical tightness.
    – PatrickT
    Jul 11, 2018 at 15:56
  • This works for the Madrid theme :) Aug 30, 2019 at 13:18
  • Where should be put this code piece?
    – alper
    Jan 9, 2023 at 15:45

You must log in to answer this question.

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