# Note page showing the next frame

I would like to customise the note pages in Beamer to show:

1. the current frame that they refer to with its number,
2. the next frame of the presentation with its number,
3. the section and subsection,
4. the notes themselves.

The reason for this is to make a useful presenter view for presentations on a secondary screen (using SplitShow on a Mac). I have noticed a considerable demand for the same so I am hoping to release the solution as a package or perhaps contact the Beamer maintainer and offer it for incorporation.

The the only problem yet is that due to my inexperience in programming for LaTeX, I can not figure out how to insert the content of next frame. The current frame (or slide) is inserted as follows (beamerbasenotes.sty):

\newcommand{\insertslideintonotes}[1]{{%
\begin{pgfpicture}{0cm}{0cm}{#1\paperwidth}{#1\paperheight}
\begin{pgflowlevelscope}{\pgftransformscale{#1}}%
\color[gray]{1}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\paperheight}}
\pgfusepath{fill}
\color{black}
{\pgftransformshift{\pgfpoint{\beamer@origlmargin}{\footheight}}\pgftext[left,bottom]{\copy\beamer@frameboxcopy}}
\end{pgflowlevelscope}
\end{pgfpicture}%
}}


I do not understand what does \copy\beamer@frameboxcopy represent.

Could you please provide me with a command definition that would produce the same with the next frame instead of the current one?

The intended result:

-
Regarding the display of the next frame, there is a feature request for this in the beamer repository. Somebody even provided an updated version of beamerbasenotes.sty which introduces the \insertnextslideintonotes macro. However, this doesn't work too well, at least with my beamer version 3.12. (If I use the new file in a MWE, the last slide simply vanishes...) –  diabonas Oct 29 '11 at 17:45
In light of diabonas' comment, I'm wary of trying a direct solution to this! However, it strikes me that there may be a dirty hack that would fix this. That would be to fix it so that a notes page consisted of the previous frame, the frame before that, and the notes for that prior frame. Then use a page-reordering tool, such as pdftk, to reorder the pages. If all pages have notes (which would seem reasonable from your use-case) then the reordering is obvious. Would that be an acceptable half-way solution? –  Loop Space Nov 1 '11 at 8:09
@diabonas I am sorry for failing to answer sooner, thank you for bringing my attention to it. I experience the same problem as you when using the code provided – the last frame goes missing. –  Harold Cavendish Nov 5 '11 at 20:55
@AndrewStacey I was primarily interested in how it can be done using LaTeX and while your solution is smart and great for real application, I am still eager to know why it is technically difficult to display the next frame. Could you please explain it to me? For now, I am going to use the method that you suggested. Thank you. –  Harold Cavendish Nov 5 '11 at 21:02
(Didn't see your reply, sorry) The inclusion of the frame in a note is done by saving a copy of the box that it produces. So to use the frame in advance, you are going to have to seriously mess with the order in which boxes are produced. The notes and frames stuff already does a bit of this juggling, but it is Deep Magic and I, for one, would leave it to the experts (this is what I mean by "in light of diabonas' comment". Since there is a feature request, that means that the experts are aware of it and maybe trying to do it. I doubt I could do any better so I wouldn't.) ctd –  Loop Space Dec 9 '11 at 12:06

Here's a sneaky way to accomplish this without using any external tools. It's a "proof of concept" more than a complete solution, but I think it would be usable if a little rough around the edges.

It uses an enhanced pgfpages. The enhancement means that when pgfpages comes to lay out its logical pages on a physical page, it can do so on more than one physical page. So what we do is we gather together the notes page and the next frame page then typeset them as usual: notes followed by frame (since the frame is the next one), but with a little extra: we also put the frame page in the top corner of the notes page.

Modulo a little trickery to ensure that we start and end at the right points, and that we actually don't want to use the full frame but only its contents (ie not the background), this isn't overly complicated. It does mean we get two extra slides: one at the start and one at the end, but even that could be dealt with without too much extra hassle.

The enhanced pgfpages is available from the TeX-SX launchpad directory, it's called pgfmorepages.sty. With that, the following code works-for-me:

\documentclass{beamer}
%\url{http://tex.stackexchange.com/q/33051/86}
\usepackage{pgfmorepages}
\setbeameroption{show notes}

\makeatletter
{%
{%
\scriptsize
\insertvrule{.25\paperheight}{white!90!black}
\vskip-.25\paperheight
\nointerlineskip
\vbox{
\hfill\insertslideintonotes{0.25}\hskip0.25\paperwidth\hskip-\Gm@rmargin\hskip0pt%
\vskip-0.25\paperheight%
\nointerlineskip
\begin{pgfpicture}{0cm}{0cm}{0cm}{0cm}
\begin{pgflowlevelscope}{\pgftransformrotate{90}}
{\pgftransformshift{\pgfpoint{-2cm}{0.2cm}}%
\pgftext[base,left]{\footnotesize\the\year-\ifnum\month<10\relax0\fi\the\month-\ifnum\day<10\relax0\fi\the\day}}
\end{pgflowlevelscope}
\end{pgfpicture}}
\nointerlineskip
\vbox to .25\paperheight{\vskip0.5em
\hbox{\insertshorttitle[width=8cm]}%
\setbox\beamer@tempbox=\hbox{\insertsection}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip4pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{7.5cm}\def\breakhere{}\insertsection\end{minipage}}\fi%
}%
\setbox\beamer@tempbox=\hbox{\insertsubsection}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip17.4pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{7.5cm}\def\breakhere{}\insertsubsection\end{minipage}}\fi%
}%
\setbox\beamer@tempbox=\hbox{\insertshortframetitle}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip30.8pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\insertshortframetitle[width=7cm]}\fi%
}%
\vfil}%
}%
\vskip.25em
\nointerlineskip
\insertnote
}

{%
\edef\pgfpageoptionheight{\the\paperwidth}
\edef\pgfpageoptionwidth{\the\paperheight}
\def\pgfpageoptionborder{0pt}
\def\pgfpageoptionfirstshipout{1}
\def\pgfpageoptioninitialshipout{2}
}%
{%
\pgfpagesphysicalpageoptions
{%
logical pages=3,%
physical pages=2,%
physical height=\the\paperheight,%
physical width=\the\paperwidth,%
current logical shipout=2,%
last logical shipout=2,%
}
\pgfpagesphysicalpage{1}{%
skip code={\ifnum\the\pgfactualpage=1\relax\pgfpagesshipfalse\fi}
}%
\pgfpageslogicalpageoptions{1}%
{
resized width=\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{3}%
{
resized width=.25\pgfphysicalwidth,%
resized height=.25\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight},%
border code={\color[gray]{0.8}\pgfusepath{stroke}},%
skip code={%
\ifvoid\csname pgfpages@box@2\endcsname\else
\setbox\csname pgfpages@box@3\endcsname=\copy\beamer@frameboxcopy\fi
}
}
\pgfpagesphysicalpage{2}{%
skip code={\ifvoid\csname pgfpages@box@2\endcsname\pgfpagesshipfalse\fi}%
}%
\pgfpageslogicalpageoptions{2}%
{
resized width=\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}
\makeatother

\begin{document}
\begin{frame}{The first frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The second frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The third frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The fourth frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\end{document}


Of course, one ought to hide that horrible stuff in another .sty file. Also, I've no doubt that there are better layouts - I just hacked the current one that puts the image of the previous slide in the top corner.

This produces the following.

Edit 2014-09-20

In response to anderfo's comment (which I never got round to looking at) and a similar question by email, I proffer the following. First, I should say that as it has been a long time since I looked at this code, I find I no longer fully understand it! However, by my usual 'hack and see' approach, I've managed to get something that (I think!) simulates the "show notes on second screen=left" layout. It also corrects the offset that Jim points out (again by "magic numbers", not by understanding what's going on).

(One minor annoyance is that on the last slide, a "next slide" still appears. I've not figured out how to get rid of that.)

\documentclass{beamer}
%\url{http://tex.stackexchange.com/q/33051/86}
\usepackage{pgfmorepages}
\setbeameroption{show notes}

\makeatletter
{%
{%
\scriptsize
\insertvrule{.25\paperheight}{white!90!black}
\vskip-.25\paperheight
\nointerlineskip
\vbox{
\hfill\insertslideintonotes{0.25}\hskip0.25\paperwidth\hskip-\Gm@rmargin\hskip0pt%
\vskip-0.25\paperheight%
\nointerlineskip
\begin{pgfpicture}{0cm}{0cm}{0cm}{0cm}
\begin{pgflowlevelscope}{\pgftransformrotate{90}}
{\pgftransformshift{\pgfpoint{-2cm}{0.2cm}}%
\pgftext[base,left]{\footnotesize\the\year-\ifnum\month<10\relax0\fi\the\month-\ifnum\day<10\relax0\fi\the\day}}
\end{pgflowlevelscope}
\end{pgfpicture}}
\nointerlineskip
\vbox to .25\paperheight{\vskip0.5em
\hbox{\insertshorttitle[width=8cm]}%
\setbox\beamer@tempbox=\hbox{\insertsection}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip4pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{7.5cm}\def\breakhere{}\insertsection\end{minipage}}\fi%
}%
\setbox\beamer@tempbox=\hbox{\insertsubsection}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip17.4pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{7.5cm}\def\breakhere{}\insertsubsection\end{minipage}}\fi%
}%
\setbox\beamer@tempbox=\hbox{\insertshortframetitle}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip30.8pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\insertshortframetitle[width=7cm]}\fi%
}%
\vfil}%
}%
\vskip.25em
\nointerlineskip
\insertnote
}

{%
\edef\pgfpageoptionheight{\the\paperwidth}
\edef\pgfpageoptionwidth{\the\paperheight}
\def\pgfpageoptionborder{0pt}
\def\pgfpageoptionfirstshipout{1}
\def\pgfpageoptioninitialshipout{2}
}%
{%
\pgfpagesphysicalpageoptions
{%
logical pages=3,%
physical pages=2,%
physical height=\the\paperheight,%
physical width=\the\paperwidth,%
current logical shipout=2,%
last logical shipout=2,%
}
\pgfpagesphysicalpage{1}{%
skip code={\ifnum\the\pgfactualpage=1\relax\pgfpagesshipfalse\fi}
}%
\pgfpageslogicalpageoptions{1}%
{
resized width=\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{3}%
{
resized width=.25\pgfphysicalwidth,%
resized height=.25\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight},%
border code={\color[gray]{0.8}\pgfusepath{stroke}},%
skip code={%
\ifvoid\csname pgfpages@box@2\endcsname\else
\setbox\csname pgfpages@box@3\endcsname=%
\hbox to \pgfphysicalwidth{%
\hskip-.6in% No idea why this is the right value
\vbox to \pgfphysicalheight{%
\vskip-1in%
\copy\beamer@frameboxcopy}}\fi
}%
}
\pgfpagesphysicalpage{2}{%
skip code={\ifvoid\csname pgfpages@box@2\endcsname\pgfpagesshipfalse\fi}%
}%
\pgfpageslogicalpageoptions{2}%
{
resized width=\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}

\pgfpagesdeclarelayout{notes page on second screen left with look ahead}%
{%
\edef\pgfpageoptionheight{\the\paperwidth}
\edef\pgfpageoptionwidth{\the\paperheight}
\def\pgfpageoptionborder{0pt}
\def\pgfpageoptionfirstshipout{1}
\def\pgfpageoptioninitialshipout{2}
}%
{%
\pgfpagesphysicalpageoptions
{%
logical pages=3,%
physical pages=1,%
physical height=\the\paperheight,%
physical width=2\paperwidth,%
current logical shipout=1,%
last logical shipout=2,%
}
\pgfpagesphysicalpage{1}{%
}%
\pgfpageslogicalpageoptions{2}%
{
resized width=\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{3}%
{
resized width=.25\pgfphysicalwidth,%
resized height=.25\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.4375\pgfphysicalwidth}{.875\pgfphysicalheight},%
border code={\color[gray]{0.8}\pgfusepath{stroke}},%
skip code={%
\ifvoid\csname pgfpages@box@2\endcsname\else
\setbox\csname pgfpages@box@3\endcsname=%
\hbox to \pgfphysicalwidth{%
\hskip-.6in% No idea why this is the right value
\vbox to \pgfphysicalheight{%
\vskip-1in%
\copy\beamer@frameboxcopy}}\fi
}%
}
\pgfpageslogicalpageoptions{1}%
{
resized width=.5\pgfphysicalwidth,%
resized height=\pgfphysicalheight,%
border shrink=\pgfpageoptionborder,%
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}
\makeatother
\pgfpagesuselayout{notes page on second screen left with look ahead}

\begin{document}
\begin{frame}{The first frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The second frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The third frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\begin{frame}{The fourth frame}
\begin{enumerate}
\item An item
\note[item]{with a note}
\item Another item
\note[item]{with another note}
\end{enumerate}
\vfill
Something near the bottom
\end{frame}
\end{document}

-
Excellent, this is a nice solution, thank you! (I was on a holiday so excuse my late reaction, please.) –  Harold Cavendish Jul 4 '12 at 16:27
Given that the question was over half a year ago, I think you're excused! Incidentally, the latest version of the code can get rid of the extra pages. If you ever use this "for real", let me know how you get on. –  Loop Space Jul 4 '12 at 17:57
This solution is great (and works), but is there any way to make it work with the show notes on second screen=left option? –  anderfo Apr 23 '13 at 10:26
@anderfo I've no idea! I'll have a look when I get a minute. –  Loop Space Apr 23 '13 at 10:53
@anderfo Don't know if it's still useful, but I hacked something together. –  Loop Space Sep 20 '14 at 19:50