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.

Is it possible to create a customised beamer block environment that only has a body and not a title?

For example, I wish to typeset the following quote within a coloured block so that it stands out but I have no need for the block's title. I just want the quote to be superimposed on a coloured, rounded, and shadowed box.

\begin{example}
{\large ``To be, or not to be: that is the question.''}
\vskip5mm
\hspace*\fill{\small--- William Shakespeare, Hamlet}
\end{example}

If not, are there suggestions for how to do this in another package, like tikz?

share|improve this question
1  
Just leave the title empty... –  Seamus Aug 22 '11 at 12:36
    
Certainly when I've done this, it's been by leaving the title empty as Seamus says. This might be theme-dependent so if it doesn't work, be sure to say which themes you are using. –  Loop Space Aug 22 '11 at 12:39
    
Leaving the title empty works on an ordinary block but not an example block (which always has the title "Example"). So my next step would be to change the colour of the body section, to something similar to the example block for my theme. In the beamer user guide there are instructions for changing the font colour, is it possible to change the background colour. –  Steve Aug 22 '11 at 12:49
    
Forgot to add, the problem with using an ordinary block is that the block's body background colour is light grey for the theme I am using (Warsaw) and I would prefer the light green of the example block. Perhaps I should edit the question to make this clearer? –  Steve Aug 22 '11 at 12:57
    
@Steve: Those comments would have been helpful to have had in the question! They make it easier to see exactly where the problem lies and so easier to find an answer (as Gonzalo has now done for you). Neither Seamus nor I twigged that the example block puts "Example" in its title (had either of us actually compiled some code we would have seen it!). Incidentally, it is possible to change background colours in beamer. The manual has the details, and if that's not clear then ask a fresh question about it. –  Loop Space Aug 22 '11 at 13:20

5 Answers 5

up vote 18 down vote accepted

You could use an exampleblock environment with empty title:

\documentclass{beamer}
\usetheme{Warsaw}

\begin{document}

\begin{frame}
\begin{exampleblock}{}
  {\large ``To be, or not to be: that is the question.''}
  \vskip5mm
  \hspace*\fill{\small--- William Shakespeare, Hamlet}
\end{exampleblock}
\end{frame}

\end{document}

enter image description here

share|improve this answer
    
Thanks, this specifically answers the question! For a more general solution see that given by percusse below. –  Steve Aug 22 '11 at 14:24

A simple solution, as given in the Beamer manual p.124, might be customizing the following code to your needs.

\setbeamercolor{postit}{fg=black,bg=yellow}
\begin{beamercolorbox}[sep=1em,wd=5cm]{postit}
Place me somewhere!
\end{beamercolorbox}

Also you can make it look like a block without its title.

share|improve this answer
1  
Thanks, this is also great answer as it offers a general solution to the problem of framing text in beamer. I am able to recreate Gonzalo's solution with the following code: \setbeamercolor{postit}{fg=black,bg=example text.fg!75!black!10!bg} \begin{beamercolorbox}[wd=\textwidth,rounded=true,shadow=true]{postit} Quote here. \end{beamercolorbox} –  Steve Aug 22 '11 at 14:27
    
Well, I just copied it from the manual but you are a quick study, good luck. :) –  percusse Aug 22 '11 at 19:29

This is just a remark regarding percusses solution and Steve's usage, but i can't add a comment, because their discussion has been over too long ago. Instead of creating a new beamer color with approximately the same colors as the block body example color, it would be wiser to just use the predefined color if one intents to create a block with the same appearance:

\begin{beamercolorbox}[wd=\textwidth,rounded=true,shadow=true]{block body example}
   Quote here.
\end{beamercolorbox}
share|improve this answer
    
Good point! Thanks. –  Steve Apr 30 '13 at 15:18

My solution would be to change the block begin template. It's default is defined in beamerinnerthemedefault.sty as

\defbeamertemplate*{block begin}{default}
{
  \par\vskip\medskipamount%
  \begin{beamercolorbox}[colsep*=.75ex]{block title}
    \usebeamerfont*{block title}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

In your document you can create an additional option for block begin with has no title by deleting the first few lines of the definition:

%create template for block without title
\defbeamertemplate{block begin}{notitle}
{
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

Now you can turn off the title bar with \setbeamertemplate{block begin}[notitle] and turn it back on with \setbeamertemplate{block begin}[default].

Of course this is only true if you use a inner theme which uses \setbeamertemplate{block begin}[default]. If your inner theme uses another option for block begin, you need to make a copy of that and change it accordingly. rounded for example (used by inner theme rounded) is defined in beamerauxtemplates.sty. Also the command to turn titles back on would need to be copied from your theme, in that case from beamerinnerthemerounded.sty.

share|improve this answer

Another working quick-fix in cases where \begin{block}{} causes some ugliness at the top of the block, you can use negative vertical space as the block title:

\documentclass{beamer}

\usetheme{Copenhagen}

\setbeamertemplate{blocks}[default]

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}

\begin{block}{abc}
abcabc
\end{block}

\begin{block}{}
defdef
\end{block}

\begin{block}{\vspace*{-3ex}}
ghighi
\end{block}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}
share|improve this answer

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.