以下例子中,旋转图片会导致图片的中心偏移,希望一直保持中心的位置,该怎么做?
\documentclass{beamer}
\usepackage{tikz}
\usebackgroundtemplate%
{\tikz\node {\includegraphics[width=0.5\paperwidth, angle=\value{page}, origin=c]{example-image}};}
\logo{\includegraphics[width=2cm, angle=\arabic{page}, origin=c]{example-image}}
\begin{document}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\end{document}
另一个小问题是:上述 angle
的参数过于单调,若是想写成一个表达式,如 3*\arabic{page}
之类的,该怎么做?
用 \node
的 rotate
键。
\documentclass{beamer}
\usepackage{tikz}
\usebackgroundtemplate{\begin{tikzpicture}
\draw[use as bounding box] (0,0) rectangle (\paperwidth,\paperheight);
\node[inner sep=0pt,outer sep=0pt,rotate=3*\value{page}] at(.25\paperwidth,.75\paperheight)
{\pgfimage[width=0.5\paperwidth]{example-image}};
\end{tikzpicture}}
\logo{\includegraphics[width=2cm, angle=\arabic{page}, origin=c]{example-image}}
\begin{document}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\frame{\arabic{page}}
\end{document}
perfect. 谢谢大佬砍瓜切菜般的解决了!