Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} 
    \begin{alertblock}{Just A Block}
      This is a text in a block.
      \begin{itemize}
        \item This is an item in a block.
        \item Another item.
      \end{itemize}
    \end{alertblock}
  \end{frame}
\end{document}

example

share|improve this question
    
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
add comment

2 Answers

up vote 6 down vote accepted

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}}

\let\oldalertblock\alertblock
\let\oldendalertblock\endalertblock
\def\alertblock{\begingroup \setbeamertemplate{itemize/enumerate body begin}{\setlength{\leftmargini}{\origleftmargini}} \oldalertblock}
\def\endalertblock{\oldendalertblock \endgroup}

\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} 
    \begin{alertblock}{Just A Block}
    %\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}
    \end{alertblock}
    \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}

enter image description here

share|improve this answer
add comment

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.

Sample output

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

\makeatletter
\addtobeamertemplate{block alerted begin}{
\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}
  \begin{alertblock}{Just A Block}
    This is a text in a block.
    \begin{itemize}
    \item This is an item in a block.
    \item Another item.
    \end{itemize}
  \end{alertblock}
  \begin{itemize}
  \item This is an item.
  \item This is another item
  \end{itemize}
\end{frame}
\end{document}

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.