1

I search the internet and get a nice redefinition of the block environment of beamer. It has the ability to set the width of the block, instead of always spanning the whole page.

\newenvironment<>{varblock}[2][0.95\textwidth]{
  \begin{center}
    \begin{minipage}{#1}
      \setlength{\textwidth}{#1}
        \begin{actionenv}#3
          \def\insertblocktitle{#2}
          \par
          \usebeamertemplate{block begin}}
    {\par
          \usebeamertemplate{block end}
        \end{actionenv}
    \end{minipage}
  \end{center}
}

Now I want to add padding to the text inside the block. Please notice only text not block title. I want to do this because I am using a plain theme, which does not have the color background to get them easily distinguishable.

Please help me, thanks.

  • Note that the minipage already sets \textwidth to its width argument. Setting it again will give you funny results: an argument like 0.95\textwidth will result in final \textwidth of 0.95*0.95\textwidth. – Martin Scharrer May 23 '11 at 11:14
2

I'm not quite sure what the above definition is doing that the already defined columns environment doesn't...

\documentclass{beamer}
\usecolortheme{orchid}
\begin{document}
\begin{frame}
  \begin{columns}[t]
    \begin{column}{0.49\textwidth}
      \begin{block}{This is a headline}
        This is a block
      \end{block}
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{block}{}
      This is another block
    \end{block}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

I've added a colour theme just to illustrate the extent of the blocks. So the question is: "How can I make the width of the body text thinner than that of the headline?" You can do that with a quote environment inside the block:

\documentclass{beamer}
\usecolortheme{orchid}
\begin{document}
\begin{frame}
  \begin{columns}[t]
    \begin{column}{0.49\textwidth}
      \begin{block}{This is a headline}
        \begin{quote}
          Here is some text that is shrunk a little bit isn't it?
        \end{quote}
      \end{block}
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{block}{}
      This is another block
    \end{block}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

quote inside block inside column

  • Thanks for your response. This solution does work well, but the codes look a bit tedious. What I wish is a predefined environment, centered, with adjustable width and nice looking padding. – chuan May 23 '11 at 13:33
  • @chuan you could try just putting a quote inside the environment definition you found? – Seamus May 23 '11 at 13:39

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.