11

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 =)

0

1 Answer 1

10

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.

2
  • Wow. I didn't expect such a quick reponse. It works perfectly fine!! Many thanks Werner!! Jul 12, 2013 at 21:39
  • I am not so sure of the boxing being required – your example as well as the OPs MWE both compile fine even if one removes the minipages. (For proper indenting they are necessary anyway, but that is another point).
    – Daniel
    Jul 13, 2013 at 7:29

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.