5

I'd like to know if it is possible to keep the background used in standard frames in minislides too:

\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}

enter image description here

You can find the background here.

As far as I understand, the content of the minislide is provided by \beamer@frameboxcopy inside the \insertslideintonotes macro from the beamerbasenote.sty file.

Is it possible to let \beamer@frameboxcopy keep the background of the original frame?

d-cmst
  • 23,095

1 Answers1

8

One possibility would be to declare your background-image as a pgfimage with \pgfdeclareimage command and insert it in a modified \insertslideintonotes command.

Something like:

\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}

enter image description here

Improved version

What's new?

1.- It's possible to use \newbackground{} to go back to default (empty) background. It uses \@ifmtarg command (see, for example, Werner's answer to How to check if a macro value is empty or will not create text with plain TeX conditionals?)

2.- Scoping background: {\newbackground{figure}\begin{frame}....\end{frame}\notes{...}} works.

3.- Smiles fixed ;-)

What's changed?

It uses \setbeamertemplate{background} instead of \setbeamertemplate{background canvas} because default background template definition is empty while background canvas is not. Therefore it's easier to use \ifbeamertemplateempty condition without having to affect default background canvas.

New code and examples:

\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}

enter image description here enter image description here

Ignasi
  • 136,588
  • Thank you, +1, but I'd like a more general solution – d-cmst Jun 20 '13 at 12:38
  • @dcmst: I've updated my answer. This solution allows to change background image. But it's not perfect, it needs always a background image. Let me learn how to use some if and I'll try do do it better. – Ignasi Jun 20 '13 at 13:30
  • this is a nice improvement but you should definitely fix your smiles :P – d-cmst Jun 20 '13 at 13:56
  • @dcmst: New update. Hope it helps. – Ignasi Jun 21 '13 at 09:35
  • This wasn't the approach I thought in the first place but it actually solves my problem, so I think it's fair to accept this answer. Many thanks. – d-cmst Jun 21 '13 at 09:47
  • Just as something to keep in mind: this won't honor the \graphicspath for the thumbnail backgrounds so the backgrounds better be in a consistent place (I hardcoded my path into the \pgfdeclareimage call which is ugly but works). Related: http://sourceforge.net/p/pgf/feature-requests/41/ – Christian Jan 31 '15 at 22:42