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
....
lockstep
  • 250,273
rgallego
  • 2,112

2 Answers2

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.

Stefan Kottwitz
  • 231,401
  • 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 '10 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 '10 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 01 '13 at 12:17
  • Where do I put the code \setlength{\leftmargini}{0pt}? – LWZ Sep 07 '13 at 07:42
  • @LWZ Into the preamble, as usual. – Stefan Kottwitz Sep 07 '13 at 09:31
  • What are the default values for \leftmargini, \leftmarginii and \leftmarginiii in beamer? – Matti Mar 25 '17 at 17:01
30

This seemed to work for me:

\settowidth{\leftmargini}{\usebeamertemplate{itemize item}}
\addtolength{\leftmargini}{\labelsep}