Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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

1 Answer 1

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

share|improve this answer
    
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
    
Right, forgive my dumbness. Thanks! –  chuan May 23 '11 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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