# Beamer ovalbox frame thickness

I'm working with Beamer and I would like to create boxes with round corners. I use \ovalbox, but I would like to control the thickness of the line. How can I do this? I also tried \thinlines, but I still not understand the sintax since I didn't find a minimal example.

-
Do you mean something like the box created in this answer? – Claudio Fiandrino Jul 6 '12 at 15:05
No, I would like a framed word as created by \ovalbox{hello}, for instance. But I need to control the thikness of the line. – Marco Jul 6 '12 at 15:54
I can't find in which package ovalbox is defined. It appears not to be part of beamer. Are you using fancybox, perhaps? – JLDiaz Jul 6 '12 at 16:15
The beamer user guide says: More frame types are offered by the package fancybox, which defines the following commands:\shadowbox, \doublebox, \ovalbox, and \Ovalbox, so to use those commands you should load the fancybox package. – Claudio Fiandrino Jul 6 '12 at 16:20
Ok, so if fancybox is being used, use \Ovalbox instead of \ovalbox to get a thicker border. – JLDiaz Jul 6 '12 at 22:32

Here is a solution based on TikZ which leads to:

Basically, all boxes are realized by means of a command, \tframed, defined as:

\newcommand{\tframed}[2][]{\tikz[baseline=(h.base)]\node[rndblock,#1] (h) {#2};}


where the rndblock style is:

\tikzset{rndblock/.style={rounded corners,rectangle,draw,outer sep=0pt}}


Complete code:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}

% Style definition
\tikzset{rndblock/.style={rounded corners,rectangle,draw,outer sep=0pt}}

% Command Definition
% 1 optional to customize the aspect, 2 mandatory: text to be framed
\newcommand{\tframed}[2][]{\tikz[baseline=(h.base)]\node[rndblock,#1] (h) {#2};}

\begin{document}
\begin{frame}
This is text \tframed[line width=2bp]{hello} {\tiny\tframed[red]{hello again} } \tframed[draw=red,line width=0.1pt]{word} this is other text    \\

This is text \tframed[line width=3bp,fill=green!50]{hello} {\tiny\tframed[blue,fill=blue!10]{hello again} } \tframed[text=red,line width=0.1pt]{word} this is other text
\end{frame}

\end{document}


To choose the options, especially the line width, you can refer to the pgfmanual (version October 25, 2010) 15.3.1 Graphic Parameters: Line Width, Line Cap, and Line Join.

IMPROVEMENT

Here is a way to add overlay specifications to the \tframed command; the solution is based on the nice code provided by Daniel in tikzpicture in beamer. Basically this allows to not modify at all the previos definition of \tframed thus IMHO is very suitable in this case. Indeed, overlay specification can be added simply in the optional argument by means of visible on=<*overlay specification*>.

Example:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}

%%% Overlay definition
% based on Daniel's code
% http://tex.stackexchange.com/questions/55806/tikzpicture-in-beamer/55849#55849
\tikzset{
invisible/.style={text opacity=1,opacity=0},
visible on/.style={alt=#1{}{invisible}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
},
}

%%% Style definition
\tikzset{rndblock/.style={rounded corners,rectangle,draw,outer sep=0pt}}

%%% Command Definition
% 1 optional to customize the aspect, 2 mandatory: text to be framed
\newcommand{\tframed}[2][]{\tikz[baseline=(h.base)]\node[rndblock,#1] (h) {#2};}

\begin{document}
\begin{frame}
This is text \tframed[line width=2bp,visible on=<3->]{hello} {\tiny\tframed[red,visible on=<2->]{hello again}} \tframed[draw=red,line width=0.1pt,visible on=<4->]{word} this is other text    \\

This is text \tframed[line width=3bp,fill=green!50,visible on=<4->]{hello} {\tiny\tframed[blue,fill=blue!10,visible on=<3->]{hello again}} \tframed[text=red,line width=0.1pt,visible on=<2->]{word} this is other text
\end{frame}

\end{document}


Result:

-