17

I have a slide with a figure in it. I want show a vertically and horizontally centered (relative to the image if possible) text box overtop of it as an overlay which will contain a few lines of text.

alt text

\documentclass{beamer}
\usepackage[T1]{fontenc}

\begin{document}

\begin{frame}
    \frametitle{ESR1} 

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

    \begin{center}
        \includegraphics[width=1\textwidth]{some_image.jpg}
    \end{center}
\end{frame}
\end{document}
0

2 Answers 2

26

Basically, the same solution as in your last question works: 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.

1
  • How could I add a caption? Also with a simple node?
    – ikreb
    Commented Sep 20, 2023 at 8:37
7

I use 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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .