1

I feel like I'm taking the long way around here. I'm using ifthen with some other machinery, included for completeness. Is there something in tex that says "all items"? Look for !! HERE !! in the below.

%
% Control where bullet points go, depending on if we are in a beamer block or not
%
\usepackage{ifthen}
\newboolean{insideBlock}
\setboolean{insideBlock}{false}
% flag we're in a beamer block
\BeforeBeginEnvironment{block}{\setboolean{insideBlock}{true}}
\AfterEndEnvironment{block}{\setboolean{insideBlock}{false}}
% if in beamer block, indent the items in itemize
\BeforeBeginEnvironment{itemize}{
  \ifthenelse{\boolean{insideBlock}}{
    \setlength{\leftmargini}{2em}
  }{
    \setlength{\leftmargini}{0em}
  }
}
% Use -- for bullet points inside beamer blocks
\AtBeginEnvironment{itemize}{
  \ifthenelse{\boolean{insideBlock}}{
    % !! HERE !!
    % !! HERE !!
    % !! HERE !!
    \setbeamertemplate{itemize item}{\--}
    \setbeamertemplate{itemize subitem}{\--}
    \setbeamertemplate{itemize subsubitem}{\--}
    \setbeamertemplate{itemize subsubsubitem}{\--}
    \setbeamertemplate{itemize subsubsubsubitem}{\--}
  }{}
}

The above code works, but I feel like there is a better solution. I played around with different variants of \renewcommand\labelitemi{--} but I don't understand tex well enough to know what I'm doing at this point x0

Clarification: I am only wanting to change this inside the block environment, not for the whole document.

Thanks for any suggestions / better options, I'm not planning on changing the max level of itemize, but could imagine scenarios the below might break.

  • Alas, \item is constantly being redefined by different environments. You might try redefining \bullet instead. – John Kormylo Apr 1 '17 at 0:58
  • is that any better or worse? I don't understand the implication of changing \item vs \bullet. In the \bullet case, I have to redefine upon entry and exit (to keep the original bullet behavior). But I also feel like \bullet is a symbol, whereas \item has a lot more going on yes? – svenevs Apr 4 '17 at 3:49
  • I was thinking of globally changing \bullet, since \item is about the only place it is used. Also, definitions made inside an environment are local to that environment. The original definition is restored automatically. – John Kormylo Apr 4 '17 at 4:12
  • Ahhhh yes this is news to me, but makes a lot of sense. I updated the solution accordingly. I actually do use \bullet for some things directly, so I don't want to change that. The current solution is good enough for me. But as you say, this redefines it every time. Is there an analogous concept that only does it once overall, or is this just not how tex works end of story? Like even if I defined a new environment and redfine things in the definition of the new environment itself, it still performs that redefinition every time the new environemtn is used right? – svenevs Apr 4 '17 at 5:17
  • 1
    It occurred to me that while \item is redefined, \labelitemi is not. OTOH, beamer doesn't use \labelitemi and resets it to \beamer@labelitemi using \AtBeginDocument. – John Kormylo Apr 4 '17 at 13:39
2

I would just hook into the shape your theme uses for it's items. For example for a theme using spheres:

\documentclass{beamer}
\usetheme{Darmstadt}

\makeatletter
\AtBeginEnvironment{block}{%
    \def\beamer@usesphere#1#2{%
      \hbox{\usebeamercolor{#1}\normalsize--}}
 }
\makeatother

\begin{document}

\begin{frame}
    \begin{block}{title}
        \begin{itemize}
            \item bla
            \begin{itemize}
                \item blub
            \end{itemize}
        \end{itemize}
    \end{block}

    \begin{itemize}
        \item bla
        \begin{itemize}
            \item blub
        \end{itemize}       
    \end{itemize}
\end{frame} 

\end{document}

enter image description here

  • awesome, thanks @samcarter this directly led me to the solution. my theme wasn't using any spheres or triangles or whatever, but the trick is to just not care at all -- since we wanna redefine all items just do it ;) i definitely wouldn't have gotten that without your answer! – svenevs Apr 4 '17 at 3:46
2

faceslap. the solution is way easier indeed

% Use -- for bullet points inside beamer blocks
\AtBeginEnvironment{itemize}{
  \ifthenelse{\boolean{insideBlock}}{
    \setbeamertemplate{itemize items}{\--}
  }{}
}

items plural instead of item singular will hit them all. this is how the theme actually sets it (in my case the .dtx that creates the style does \setbeamertemplate{itemize items}{\textbullet}. This will only do it for itemize in blocks as desired.

Update: or even simpler

\AtBeginEnvironment{block}{
  \setbeamertemplate{itemize items}{\--}
}

see followups to question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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