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.

For a beamer presentation, I would like to enclose text in a box such that:
- all the line of the box are blank,
- except the upper left corner, and the lower right corner of the box which are color X.

\begin{\mybox}{blue}
     Some text here
\end{\mybox}

box example

(I made this example by hand, the text doesn't have to be centered).

I saw some examples where the box lines all have the same color.
But I don't see how to adapt them.

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Here's one possible solution using the ubiquitous \tikzmark; in fact, this is a variation of a decoration that I use in some of my presentations; the new environment cblock has an optional argument allowing to change the color used:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}

\definecolor{pbblue}{HTML}{0A75A8}
\definecolor{pborange}{HTML}{F57E0F}

\newcommand\tikzmark[1]{\tikz[overlay,remember picture] \coordinate (#1) {};}
\newlength\mylinewd% the length used for the lines
\setlength\mylinewd{30pt}

\def\decorateblock#1{%
  \setbeamertemplate{block begin}{%
    \tikzmark{start}\par{\usebeamercolor{#1}\insertblocktitle}\par}
  \setbeamertemplate{block end}{%
    \tikzmark{end}\par
    \begin{tikzpicture}[remember picture,overlay]
      \coordinate (e) at ($(start)+(-10pt,0)$);
      \coordinate (f) at ($(end)+(\textwidth,0)$);
      \draw[ultra thick,#1] ( $ (e) + (0pt,-\mylinewd) $ ) -- ( $ (e) + (0pt,5pt) $ ) -- ( $ (e) + (\mylinewd,5pt) $ ) ;
      \draw[ultra thick,#1] ( $ (f) + (0pt,\mylinewd) $ ) -- (f) -- ( $ (f) + (-\mylinewd,0pt) $ ) ;
    \end{tikzpicture}%
  }%
}

\newenvironment<>{cblock}[1][pbblue]
  {\decorateblock{#1}\begin{block}}
  {\end{block}}

\begin{document}

\begin{frame}
\begin{cblock}{Example}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{cblock}
\begin{cblock}[pborange]{Example}
text text text text text text text text text text text text text text text text text text text text 
\end{cblock}
\end{frame}

\end{document}

enter image description here

The code needs two runs to stabilize.

share|improve this answer
    
Wonderfull! Thank you. –  Nicolas Essis-Breton Mar 29 '13 at 1:46
    
@NicolasEssis-Breton You're welcome! Glad I could help. –  Gonzalo Medina Mar 29 '13 at 1:52
add comment

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.