[Tex/LaTex] Is it possible to put a block inside another block in Beamer

beamer

Basically I want to insert two blocks within a bigger block. I've tried doing this:

\begin{block}{heading}
    \begin{block}{heading1}
     content
    \end{block}
    \begin{block}{heading1}
     content
    \end{block}
\end{block}

but it doesn't work. The error message is :

File ended while scanning use of \beamer@collect@@body.

I would like to add that this is the first time I've used the LaTeX language, so I'm basically a noob here =)

Best Answer

Blocks within blocks work best if you box them, since it gives you better control over their width and placement. This is easily achieved using minipages:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\usetheme{Warsaw}
\begin{document}
\begin{frame}
  \begin{block}{heading}
    Some filler text

    \hspace*{.1\linewidth}\begin{minipage}{.8\linewidth}
    \begin{block}{heading 1}
      content
    \end{block}
    \end{minipage}
    \medskip

    Some more filler text

    \hspace*{.1\linewidth}\begin{minipage}{.8\linewidth}
    \begin{block}{heading 2}
      content
    \end{block}
    \end{minipage}
    \medskip

    Some more filler text
  \end{block}
\end{frame}
\end{document}

Since minipages tend to remove the appropriate paragraph skipping (above and below), an additional \medskip makes the separation more consistent. I've also added an indent of .1\linewidth, which technically centers the nested block since it's .8\linewidth wide.