有时我想用绝对坐标绘制一些图片beamer
。但是下面的例子在画一个圆时似乎有一些偏移。我怎样才能在绝对坐标处绘制图片?
当前代码:
\documentclass[t]{beamer}
\usepackage{tikz}
\setbeamertemplate{background canvas}{%
\begin{tikzpicture}
\fill[color=orange!10] (0,0) rectangle (\paperwidth,\paperheight);
\draw[step=1.0,black,thin] (0,0) grid (\paperwidth,\paperheight);
\end{tikzpicture}}
\begin{document}
\begin{frame}[t]{Title here}
\begin{tikzpicture}[very thick]
\def\r{2}
\def\x0{5}
\def\y0{5}
\draw[fill=black] (\x0,\y0) circle (5pt);
\draw (\x0,\y0) circle (\r);
\draw [->] (\x0,\y0) -- (\x0+\r,\y0);
\end{tikzpicture}
\end{frame}
\end{document}
我希望在 (5,5) 处画一个圆,但是当前的输出是:
答案1
然后你需要切换到overlay,remember picture
模式并移动图片到页面。然后编译足够多次
\documentclass[t]{beamer}
\usepackage{tikz}
\setbeamertemplate{background canvas}{%
\begin{tikzpicture}
\fill[color=orange!10] (0,0) rectangle (\paperwidth,\paperheight);
\draw[step=1.0,black,thin] (0,0) grid (\paperwidth,\paperheight);
\end{tikzpicture}}
\begin{document}
\begin{frame}[t]{Title here}
\begin{tikzpicture}[very thick,overlay,remember picture]
\def\r{2cm}\def\x0{5cm}\def\y0{5cm}
\begin{scope}[shift={(current page.south west)}]
\draw[fill=black] (\x0,\y0) circle (5pt);
\draw (\x0,\y0) circle (\r);
\draw [->] (\x0,\y0) -- (\x0+\r,\y0);
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}