模板的“背景”和“背景画布”有什么区别?

模板的“背景”和“背景画布”有什么区别?

有什么区别:

\setbeamertemplate{background}{
\begin{tikzpicture}[remember picture,overlay]
\shade[top color=yellow!75!green!33,bottom color=blue!66!green!33,middle color=blue!6!green!33]
  ([shift={(0.0cm,0.0cm)}]current page.north west)
     rectangle
  ([shift={(0.0cm,0.0cm)}]current page.south east);
\end{tikzpicture}  
}

和:

\setbeamertemplate{background canvas}{
\begin{tikzpicture}[remember picture,overlay]
\shade[top color=yellow!75!green!33,bottom color=blue!66!green!33,middle color=blue!6!green!33]
  ([shift={(0.0cm,0.0cm)}]current page.north west)
     rectangle
  ([shift={(0.0cm,0.0cm)}]current page.south east);
\end{tikzpicture}  
}

第一个表现正常,第二个每次重建时表现随机?我用pdflatexgummi(预览)构建它。第二个在我不重建而是从头构建时不显示任何背景。对我来说很奇怪。

编辑:甚至第一个也以不同的主题随机行事......

答案1

来自beamer用户指南:

在此处输入图片描述

因此,background canvas一切都在后面,然后才是background主要内容。

比较这些代码:

\documentclass{beamer}
\usepackage{tikz}
\setbeamertemplate{background}{
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {here};
\end{tikzpicture}
}
\setbeamertemplate{background canvas}{
\begin{tikzpicture}[remember picture,overlay]
\shade[top color=yellow!75!green!33,bottom color=blue!66!green!33,middle color=blue!6!green!33]
  ([shift={(0.0cm,0.0cm)}]current page.north west)
     rectangle
  ([shift={(0.0cm,0.0cm)}]current page.south east);
\end{tikzpicture}
}
\begin{document}
  \begin{frame}
    Some
  \end{frame}
\end{document}

在此处输入图片描述

\documentclass{beamer}
\usepackage{tikz}
\setbeamertemplate{background canvas}{
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {here};
\end{tikzpicture}
}
\setbeamertemplate{background}{
\begin{tikzpicture}[remember picture,overlay]
\shade[top color=yellow!75!green!33,bottom color=blue!66!green!33,middle color=blue!6!green!33]
  ([shift={(0.0cm,0.0cm)}]current page.north west)
     rectangle
  ([shift={(0.0cm,0.0cm)}]current page.south east);
\end{tikzpicture}
}
\begin{document}
  \begin{frame}
    Some
  \end{frame}
\end{document}

在此处输入图片描述

首先,您看到的here是中心,其次,它位于后面(因为它在里面)background canvas

相关内容