3

I'm trying to redefine beamer's blocks to obtain something like this (upper block) : enter image description here

I've found 3 sites (with codes and pictures) which may help, but I'm unable to reach this goal on my own.

Here's the sites :

Thanks for any help.

  • Well, we should follow three links in order to assemble a solution? ;-) – user31729 Sep 21 '14 at 10:03
  • Please add a full minimal working example so that people can see what you have tried so far and how close you have come to a solution (but don't add unnecessary code). This code should start with \documentclass and end with \end{document} and it should compile. Doing this makes it much easier for people to help you - and much more likely that they will:) As it is we have no idea what beamer styles etc you are using and so we'd have to waste a lot time starting from scratch – Andrew Sep 21 '14 at 10:09
6

This is a tcolorbox based implementation.

\documentclass{beamer}

\usepackage{tikz,tcolorbox}
\usetikzlibrary{shapes,calc}
\tcbuselibrary{skins}
\definecolor{myblue}{rgb}{0.15,0.15,0.53}

\makeatletter

\newtcbox{\titlebox}{
    enhanced,
    overlay={
        \draw[myblue,fill=myblue](frame.south east)--+(0,.2)to[bend right]+(.2,-0)--cycle;},
        colback=myblue,
        top=-1pt,bottom=-2pt,left=2pt,right=2pt,
        boxrule=1pt,
        colframe=myblue,
        sharp corners=south,
        colupper=white,
        fontupper=\bfseries
}

\newtcolorbox{myblock}[1][]{
    enhanced,
    left=2pt,
    right=2pt,
    colframe=myblue,
    boxrule=1pt,
    colback=blue!10,
    overlay={
        \def\myblock@tempa{#1}
        \ifx\myblock@tempa\@empty
        \else
        \draw[myblue,fill=myblue]($(frame.north west)+(.2pt,-.2pt)$)--+(.1,0)to[bend right]+(-0,-.1)--cycle;
        \node [
            anchor=south west,
            inner sep=0pt,
            outer sep=0pt
        ]at(frame.north west){\titlebox{#1}};
    \fi
    },
}
\makeatother
\begin{document}
\begin{frame}
   \begin{myblock}[Corollary]
      \textit{If $_{\chi PP}(M)=2$ a haplotype matrix M we can find an optimal pp-partition in polynomial time}
   \end{myblock}

   \begin{myblock}
      this block has no title
   \end{myblock}
\end{frame}

\end{document}

enter image description here

The fancy stuff (rounded corners etc. is done with TikZ and is conditionally excluded if the box has no title.

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.