3

I am trying to place a tikzpicture in a beamer frame on top of an image. In principle this should be easy, however changing the at(x,y) cordinate doesn't seem to have any effect at all.

My code is

\documentclass[demo]{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{%
    calc,%
    fadings,%
    shadings%
}

\usetikzlibrary{arrows,shapes}
\usetikzlibrary{shapes.geometric,calc}
\usetikzlibrary{backgrounds,fit}
\usetikzlibrary{shadows}
\usetikzlibrary{snakes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning}
\usepackage{graphicx}
\begin{document}
  \begin{frame}
 \only<1>{\hspace*{-0.5cm}\includegraphics[width=1.1\columnwidth]{Stack_1}\begin{tikzpicture}
  \node[align=center,color=gray!20, draw,fill=gray!20, text=red, cloud, cloud puffs=17, cloud puff arc=145, aspect=10,scale=0.5] at (-5cm,0cm) {\textbf{\large ``Fortunately our $\gamma$-flash has a constant shape''}};
 \end{tikzpicture}}
 \only<2>{\hspace*{-0.5cm}\includegraphics[width=1.1\columnwidth]{Stack_2}} 
\end{frame}
\end{document}

Using at(0,0) gives me

enter image description here

which is the same output if I use at(10cm,10cm).

Any idea on why is this hapening and can it be fixed?

3
  • 1
    The coordinate of the node inside a tikzpicture has no relation with the page coordinates.
    – Sigur
    May 11, 2015 at 15:16
  • It would probably be easier to put the picture in a node in the tikzpicture. Most tikz commands are overlay-aware, and can be used like \node<1>[options].... See also: tex.stackexchange.com/q/9559/32374
    – darthbith
    May 11, 2015 at 15:17
  • Use a simple line break?
    – Johannes_B
    May 11, 2015 at 15:21

1 Answer 1

1

You should use the techniques described at this answer

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{%
    calc,%
    fadings,%
    shadings%
}

\usetikzlibrary{arrows,shapes}
\usetikzlibrary{shapes.geometric,calc}
\usetikzlibrary{backgrounds,fit}
\usetikzlibrary{shadows}
\usetikzlibrary{snakes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{positioning}
\usepackage{graphicx}
\begin{document}
  \begin{frame}
  \begin{onlyenv}<1>
  \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=\textwidth]{example-image}};
    \begin{scope}[x={(image.south east)},y={(image.north west)}]
        \node[align=center,color=gray!20, draw,fill=gray!20, text=red, cloud, cloud puffs=17, cloud puff arc=145, aspect=10,scale=0.5,font=\bfseries\large] at (0.5,0.7) { ``Fortunately our $\gamma$-flash has a constant shape''};
    \end{scope}
\end{tikzpicture}
\end{onlyenv}
\end{frame}
\end{document}

enter image description here

I have used onlyenv for better readability.

You must log in to answer this question.

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