Tikzpicture 作为背景

Tikzpicture 作为背景

我想绘制一个tikzpicture并将其作为背景放在一张幻灯片上。到目前为止,我有这个:

\documentclass{beamer}

\usepackage{tikz}

\begin{document}

\begin{frame}{Title}

% background
 \begin{figure}
 \centering
 \begin{tikzpicture}[overlay,scale=2.5]
 \pgftransformcm{1}{0.1}{0.2}{1}{\pgfpoint{0cm}{0cm}}
 % draw the grid
 \draw[step=.3cm,black!10,line width=0.01cm] (-3.9,-3.9) grid (3.9,3.9);
 \foreach \x in {-3.9,-3.6,...,3.9}
     \foreach \y in {-3.9,-3.6,...,3.9}
         \filldraw[black!10] (\x,\y) circle (0.4pt);
 \end{tikzpicture}
 \end{figure}

\begin{itemize}
\item<+-> First
\item<+-> Second
\item<+-> Third
\item<+-> Fourth
\end{itemize}

\end{frame}

\end{document}

但背景网格也覆盖了标题。我怎样才能让图片从框架标题栏的正下方开始?

答案1

如果手动检查所需值是可以的,则仍需更改转换和平移:

\documentclass{beamer}

\usepackage{tikz}

\begin{document}

\begin{frame}{Title}

% background
 \begin{figure}
 \centering
 \begin{tikzpicture}[overlay,scale=2.5]
% \pgftransformcm{1}{0.1}{0.2}{1}{\pgfpoint{0cm}{0cm}}
\pgftransformcm{-1}{-0.1}{-0.2}{-1}{\pgfpoint{0cm}{-3cm}}
 % draw the grid
 \draw[step=.3cm,black!10,line width=0.01cm] (-3.9,-3.9) grid (3.9,3.9);
 \foreach \x in {-3.9,-3.6,...,3.9}
     \foreach \y in {-3.9,-3.6,...,3.9}
         \filldraw[black!10] (\x,\y) circle (0.4pt);
 \end{tikzpicture}
 \end{figure}

\begin{itemize}
\item<+-> First
\item<+-> Second
\item<+-> Third
\item<+-> Fourth
\end{itemize}

\end{frame}

\end{document}

在此处输入图片描述

答案2

也许像这样?只需\earmark将此背景添加到您想要的任何框架即可。根据我的回答如何直观地“标记”某些幻灯片?

\documentclass{beamer}
\usepackage{atbegshi}
\usepackage{lipsum,tikz}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
 \AtBeginShipoutNext{\AtBeginShipoutAddToBoxForeground{%
  \smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}}
\def\earmark{%
  \atxy{.5\paperwidth}{.5\paperheight}{\begin{tikzpicture}[opacity=.5,overlay,scale=2.5]
 \pgftransformcm{1}{0.1}{0.2}{1}{\pgfpoint{0cm}{0cm}}
 % draw the grid
 \draw[step=.3cm,black!10,line width=0.01cm] (-3.9,-3.9) grid (3.9,3.9);
 \foreach \x in {-3.9,-3.6,...,3.9}
     \foreach \y in {-3.9,-3.6,...,3.9}
         \filldraw[black!10] (\x,\y) circle (0.4pt);
 \end{tikzpicture}}
}
\begin{document}
\begin{frame}{Title}
\earmark
\begin{itemize}
\item<+-> First
\item<+-> Second
\item<+-> Third
\item<+-> Fourth
\end{itemize}

\end{frame}
\end{document}

在此处输入图片描述

相关内容