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.
\documentclass{beamer}
\usetheme{Rochester}

\setbeamertemplate{block title}[horizontal shading][left=black, right=white]

\begin{document}
\begin{frame}
  \frametitle{MWE}
  \begin{block}{Title}
    Test
  \end{block}
\end{frame}
\end{document}

The template sidebar canvas left can be set in this fashion; is there any way the same can be done for block titles using templates?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

Unfortunately, due to the way boxes are built in beamer (take a look at the definition of \beamerboxesrounded and \endbeamerboxesrounded in beamerbaseboxes.sty to see how different chunks are pieced together to build a box), this would require a major rewriting of the code producing the boxes and quite frankly I am not sure if the work is worthy the effort.

You can however, get this effect using the beamer skin for a tcolorbox and a convenient definition for interior titled code using \shade; something along these lines:

\documentclass[dvipsnames,svgnames,x11names]{beamer}
\usetheme{PaloAlto}
\usepackage[many]{tcolorbox}
\usetikzlibrary{shadings}

\newtcolorbox{myblock}[1][]{
  beamer,
  width=\textwidth+7pt,
  enlarge left by=-3pt,
  colback=structure,
  colframe=block body.bg,
  bottom=0pt,
  top=-2pt,
  left=0pt,
  right=0pt,
  toptitle=-1pt,
  bottomtitle=-1pt,
  fonttitle=\normalfont,
  adjusted title=#1,
  interior titled code={
    \shade[left color=Maroon!80,right color=Dandelion,middle color=Salmon] 
      (title.south west) --
      (title.south east) {[rounded corners] -- 
      (title.north east)  -- 
      (title.north west)} --
      (title.south west); 
  }
}

\begin{document}

\begin{frame}

\begin{block}{The title}
This box ia a box provided by the \texttt{beamer} class.
\end{block}

\begin{myblock}[An example with \texttt{tcolorbox}]
This box looks like a box provided by the \texttt{beamer} class.
\end{myblock}
\end{frame}

\end{document}

enter image description here

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.