1.6.12

Add a textbox overtop an image in a beamer slide

Just put the image inside a TikZ node and you can position anything on top of it wherever you want.

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\begin{document}
\begin{frame}
    \frametitle{\emph{Mycena interrupta}} 

    \begin{center}
        Known as the Pixies' parasol.
    \end{center}

    \begin{center}
        \begin{tikzpicture}
            \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=1\textheight]{some_image.jpg}};
            \node[align=center,red,font={\Huge\bfseries}] at (image.center) {Do NOT eat\\these!};
        \end{tikzpicture}
    \end{center}
\end{frame}
\end{document}

example
(Actually, I have no idea whether they are dangerous; the Wikipedia article is rather short and I don't know anything about mushrooms ­­­­— this was just the first nice picture I found on Wikimedia Commons.)
Image attribution: Wikimedia Commons, JJ Harrison.
Other way using the casper image just for a trivial purpose.
alt text
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{pstricks}

\newdimen\ImageW
\ImageW=8cm
\newdimen\ImageH
\ImageH=6cm
\fboxrule=0pt
\begin{document}
\begin{frame}[t]{ESR1} 

    \begin{center}
        Functional analysis
    \end{center}

    \begin{center}
      \pspicture(\ImageW,\ImageH)
        \rput(0.5\ImageW,0.5\ImageH){\includegraphics[width=\ImageW]{CasperFunny}}
        \rput[c](0.5\ImageW,0.75\ImageH)%
        {\fbox{\parbox{6cm}{\color{red}\Huge\bf\centering la la la la la! Casper the friendly ghost}}}      
        \endpspicture
    \end{center}
\end{frame}
\end{document}

No hay comentarios:

Publicar un comentario