# Variable itemize indentation on Beamer slides

I'm not sure if what I want is possible at all, but asking doesn't hurt...

I've adjusted the itemize environment so that the item text is aligned with the text outside the environment. This might look strange, but since I never use itemized and non-itemized text on the same slide, it's not a problem.

A problem arises if I use itemize inside a block environment. In this case, the bullets are positioned outside of the box -- which is definitely not what I want.

Can I somehow distinguish between itemize environments inside a block and the ones outside a block and set the \leftmargini accordingly?

\documentclass{beamer}
\usetheme{default}
\usecolortheme{crane}
\setbeamertemplate{itemize/enumerate body begin}{\setlength{\leftmargini}{0pt}}
\begin{document}
\begin{frame}
This is a text.
\begin{itemize}
\item This is an item.
\item This is another item
\begin{itemize}
\item with a subitem
\item and another subitem
\end{itemize}
\end{itemize}
This is a text in a block.
\begin{itemize}
\item This is an item in a block.
\item Another item.
\end{itemize}
\end{frame}
\end{document}


-
Where do I get this cuuute pink color theme? –  mbork Mar 19 '13 at 14:46
@mbork You need a crane to lift it... –  vwegert Mar 19 '13 at 17:58
Well, crane is rather orange-ish, I'd say. (I know that because it's one of my favorite beamer color themes, not counting my own one;).) –  mbork Mar 19 '13 at 18:15
@mbork This is just an alert block - I used it for no special purpose, my actual slides are rather greenish... –  vwegert Mar 19 '13 at 18:32

Does the following do what you want? My solution redefines the alertblock environment so that \leftmargini be reset to its original value at the beginning of the environment; outside of an alertblock's scope, \leftmargini reverts to its global value. You can of course adapt the method to other environments, if you want.

\documentclass{beamer}
\usetheme{default}
\usecolortheme{crane}

\newlength\origleftmargini
\setlength\origleftmargini\leftmargini
\setbeamertemplate{itemize/enumerate body begin}{\setlength{\leftmargini}{0pt}}

\begin{document}
\begin{frame}
This is a text.
\begin{itemize}
\item This is an item.
\item This is another item
\begin{itemize}
\item with a subitem
\item and another subitem
\end{itemize}
\end{itemize}
%\setbeamertemplate{itemize/enumerate body begin}{\setlength{\leftmargini}{\origleftmargini}}
This is a text in a block.
\begin{itemize}
\item This is an item in a block.
\item Another item.
\end{itemize}
\begin{itemize}
\item This is an item.
\item This is another item
\begin{itemize}
\item with a subitem
\item and another subitem
\end{itemize}
\end{itemize}
\end{frame}
\end{document}


-

You can place code in block alerted begin to adjust material contained in that block. In this case, one way to acheive your goal is to redefine \@listi. The definition below is beamer's standard definition with just the setting of \leftmargin to \leftmargini changed to 3em. Adjust this value as you wish.

\documentclass{beamer}
\usetheme{default}
\usecolortheme{crane}
\setbeamertemplate{itemize/enumerate body begin}{\setlength{\leftmargini}{0pt}}

\makeatletter
\def\@listi{\leftmargin3em
\topsep 3\p@ \@plus2\p@ \@minus2.5\p@
\parsep 0\p@
\itemsep3\p@ \@plus2\p@ \@minus3\p@}
}
\makeatother

\begin{document}
\begin{frame}
This is a text.
\begin{itemize}
\item This is an item.
\item This is another item
\begin{itemize}
\item with a subitem
\item and another subitem
\end{itemize}
\end{itemize}
This is a text in a block.
\begin{itemize}
\item This is an item in a block.
\item Another item.
\end{itemize}

As the code involved uses internal variables containing @ it has to be enclosed in a \makeatletter/\makeatother pair.