![保留迷你幻灯片中的框架背景](https://linux22.com/image/270685/%E4%BF%9D%E7%95%99%E8%BF%B7%E4%BD%A0%E5%B9%BB%E7%81%AF%E7%89%87%E4%B8%AD%E7%9A%84%E6%A1%86%E6%9E%B6%E8%83%8C%E6%99%AF.png)
我想知道是否也可以在迷你幻灯片中保留标准框架中使用的背景:
\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 声明为pgfimage
with\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
模板定义是empty
而background 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}