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 Mindmap tikzpicture in beamer (reveal step by step). 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
% https://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:
Best Answer
Use of
tikz
is one possible solution. An ellipse shape is defined asell
style.Code
Edit: If need to move this ovalbox around, for example,
Use
[remember picture,overlay] with shift={(x,y)}
skill, shown below