1

I want to have blocks within itemize environments. The code:

\documentclass[8pt]{beamer}
\usetheme{Madrid}
\begin{document}
\begin{frame}{Bad Frame}
\begin{itemize}
\item Some item here
\begin{block}{Bad Block}
Bad text
\end{block}
\item Some item here
\end{itemize}
\end{frame}    
\end{document}

Produces something that looks like this:

enter image description here

But I really want the block to be aligned to the item texts, and not go further left. Started using columns for each and every block I have:

\begin{columns}
\begin{column}{0.075\textwidth}
\end{column}
\begin{column}{0.925\textwidth}
\begin{block}{\bf Output}
   Good block text
\end{block}
\end{column}
\end{columns}

But this looks ugly and the document becomes unreadable. Can I make a simple command or environment that I can use like this:

\begin{itemize}
\item Some item here
\begin{gblock}{Good Block}
Good text
\end{gblock}
\item Some item here
\end{itemize}
1

This looks really good:

\newenvironment<>{gblock}[2][\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{columns}
    \begin{column}{0.075\textwidth}
    \end{column}
    \begin{column}{0.925\textwidth}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}
  \end{column}
    \end{columns}}  

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.