5

I am using this code to get an untitled example block.

\begin{exampleblock}{}
\end{exampleblock}

As we know, this box has a width equal to the text width. How can I modify the code to get a box that spans over the entire page as shown below ?

Beamer box

Any suggestion on this would be really helpful to me...

Thanks in advance.

  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – user36296 Mar 20 '15 at 12:37
  • You are correct... This will be kept in mind... Thank you... – Ashok Mar 22 '15 at 6:36
6

You can use the tcolorbox package to easily create your box (you can use the beamer skin). Setting the desired width for the box (and the text width inside the box) is just a matter of setting the appropriate keys. A little example; since the original beamer theme used was not specified in the question, I defined my own colors to emulate the original ones; adjust the settings according to your needs:

\documentclass{beamer}
\usepackage[many]{tcolorbox}

\definecolor{myblue}{RGB}{0,112,214}
\makeatletter
\newtcolorbox{tcbexample}[1][]{
  skin=beamer,
  enhanced,
  title=#1,
  width=\paperwidth,
  left=\Gm@lmargin,
  right=\Gm@rmargin,
  enlarge left by=-\Gm@lmargin,
  enlarge right by=-\Gm@rmargin,
  arc=0pt,
  outer arc=0pt,
  colback=myblue,
  boxrule=0pt,
  colupper=white,
  colbacktitle=myblue!40!black
}
\makeatother

\begin{document}

\begin{frame}
\begin{tcbexample}
Some test text.
\end{tcbexample}
\begin{tcbexample}[A box with title]
Some longer test text that will span more than a line to illustrate text wrapping.
\end{tcbexample}
\end{frame}

\end{document}

The result:

enter image description here

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.