保留迷你幻灯片中的框架背景

保留迷你幻灯片中的框架背景

我想知道是否也可以在迷你幻灯片中保留标准框架中使用的背景:

\documentclass{beamer}
\usepackage{blindtext}

\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{lion.jpg}}
\setbeameroption{show notes}

\begin{document}
 \begin{frame}
   \blindtext
 \end{frame}
\note{no lion in the topright minislide :(}
\end{document}

在此处输入图片描述

你可以找到背景这里

据我了解,迷你幻灯片的内容由beamerbasenote.sty 文件的宏\beamer@frameboxcopy内部提供。\insertslideintonotes

是否可以\beamer@frameboxcopy保留原始帧的背景?

答案1

一种可能性是将您的 background-image 声明为pgfimagewith\pgfdeclareimage命令并将其插入到修改后的\insertslideintonotes命令中。

就像是:

\documentclass[notes]{beamer}
\usepackage{blindtext}

\newcommand{\newbackground}[1]{%
    \setbeamertemplate{background canvas}{%
       \includegraphics[width=\paperwidth,height=\paperheight]{#1}}
    \pgfdeclareimage[width=\paperwidth,height=\paperheight]{background}{#1}
}

\makeatletter
\renewcommand{\insertslideintonotes}[1]{{%
  \begin{pgfpicture}{0cm}{0cm}{#1\paperwidth}{#1\paperheight}
    \begin{pgflowlevelscope}{\pgftransformscale{#1}}%
      {\pgftransformshift{\pgfpointorigin}\pgftext[left,bottom]{\pgfuseimage{background}}}
      \color{normal text.fg}
      {\pgftransformshift{\pgfpoint{\beamer@origlmargin}{\footheight}}\pgftext[left,bottom]{\copy\beamer@frameboxcopy}}
    \end{pgflowlevelscope}
  \end{pgfpicture}%
  }}
\makeatother

\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth,height=\paperheight]{lion_in_masai_mara.jpg}}

\setbeameroption{show notes}

\begin{document}
\newbackground{lion_in_masai_mara}
 \begin{frame}
   \blindtext
 \end{frame}
\note{A lion in the topright minislide :(}

\newbackground{lion_in_masai_mara_2}
 \begin{frame}
   \blindtext
 \end{frame}
\note{Another lion in the topright minislide :(}    
\end{document}

在此处输入图片描述

改良版

什么是新的?

1.- 可以使用\newbackground{}返回默认(空)背景。它使用\@ifmtarg命令(例如,参见沃纳的回答如何检查宏值是否为空或不会使用纯 TeX 条件创建文本?

2.- 范围背景:{\newbackground{figure}\begin{frame}....\end{frame}\notes{...}}作品。

3.- 微笑已修复;-)

有什么改变?

它使用\setbeamertemplate{background}而不是\setbeamertemplate{background canvas}因为默认background模板定义是emptybackground canvas不是。因此更容易使用\ifbeamertemplateempty条件,而不会影响默认背景画布。

新代码和示例:

\documentclass[notes]{beamer}
\usepackage{ifmtarg}
\usepackage{blindtext}


\makeatletter
\newcommand{\newbackground}[1]{%
\@ifmtarg{#1}{%
    \setbeamertemplate{background}[default]
     }{ 
    \setbeamertemplate{background}{\includegraphics[width=\paperwidth,height=\paperheight]{#1}}
    \pgfdeclareimage[width=\paperwidth,height=\paperheight]{background}{#1}
    }%
}
%
\renewcommand{\insertslideintonotes}[1]{{%
  \begin{pgfpicture}{0cm}{0cm}{#1\paperwidth}{#1\paperheight}
    \begin{pgflowlevelscope}{\pgftransformscale{#1}}%
    \ifbeamertemplateempty{background}{%
      \color{normal text.bg}
      \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\paperheight}}
      \pgfusepath{fill}
     }{%
      \pgftransformshift{\pgfpointorigin}\pgftext[left,bottom]{\pgfuseimage{background}}
    }
      \color{normal text.fg}
      {\pgftransformshift{\pgfpoint{\beamer@origlmargin}{\footheight}}\pgftext[left,bottom]{\copy\beamer@frameboxcopy}}
    \end{pgflowlevelscope}
  \end{pgfpicture}%
  }}

\makeatother

\setbeameroption{show notes}
%\setbeamertemplate{background canvas}{}

\begin{document}

{
\newbackground{lion_in_masai_mara}
 \begin{frame}
   \blindtext
 \end{frame}
\note[itemize]
{\item A lion in the topright minislide :)
\item Only for this frame. Next one should be empty.}
}

\begin{frame}
   \blindtext
 \end{frame}
\note[itemize]{
\item No lion in the topright minislide :))
\item As I told you.
\item Next one will have a different lion.
}

\newbackground{lion_in_masai_mara_2}
 \begin{frame}
   \blindtext
 \end{frame}
\note[itemize]{
\item Another lion in the topright minislide :)))
\item Used \texttt{\textbackslash{}newbackground\{lion\_in\_masai\_mara\_2\}} }

\newbackground{}
\begin{frame}
   \blindtext
 \end{frame}
\note[itemize]{
\item No lion in the topright minislide :))
\item Made empty with \texttt{\textbackslash{}newbackground\{\}} }

\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容