![如何在 Beamer 框架内移动 tikz 图片](https://linux22.com/image/311183/%E5%A6%82%E4%BD%95%E5%9C%A8%20Beamer%20%E6%A1%86%E6%9E%B6%E5%86%85%E7%A7%BB%E5%8A%A8%20tikz%20%E5%9B%BE%E7%89%87.png)
我正在尝试将一个放置tikzpicture
在图像顶部的投影仪框架中。原则上这应该很容易,但是更改坐标at(x,y)
似乎没有任何效果。
我的代码是
\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}
使用at(0,0)
给我
如果我使用,则输出是相同的at(10cm,10cm)
。
知道为什么会发生这种情况吗?可以解决吗?
答案1
您应该使用所描述的技术在这个答案
\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}
我已经使用它onlyenv
来获得更好的可读性。