# Absolute positioning in beamer when using show notes on second screen: text on wrong page

If you compile the example below, you have a very comfortable way to put sources on the slides for for LaTeX beamer.

However, if you uncomment the line with the option show notes on second screen, then the text is set on the wrong page, namely the previous page.

Here is a(n) (almost) minimal working example:

\documentclass{beamer}

\usepackage{pgfpages}
% the following line, if not commented, moves the source'' to the previous page
%\setbeameroption{show notes on second screen}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% ----------
% from https://tex.stackexchange.com/a/48485/17127
\usepackage[absolute, overlay]{textpos}

\setbeamercolor{framesource}{fg=gray}
\setbeamerfont{framesource}{size=\tiny}

\newcommand{\source}[1]{\begin{textblock*}{8cm}(4.7cm,8.6cm)
\begin{beamercolorbox}[ht=0.5cm,right]{framesource}
\usebeamerfont{framesource}\usebeamercolor[fg]{framesource} Source: {#1}
\end{beamercolorbox}
\end{textblock*}
}
% ----------

\title{MWE}

\begin{document}

\begin{frame}
\titlepage
\note{my note}
\end{frame}

\begin{frame}{title}
a diagram
\source{some article or url}
\end{frame}

\end{document}

The answers to this question did not really help me.

Update:

Is this correct? Are there a better solutions to the problem? Or are there alternatives for the \source-command?

Can the above \source-command be extended to support multiple sources?

Footnotes are an easy substitute, but they are more obtrusive than the above \source-command. Could this easily be changed and how?

Solution:

The accepted answer provides the desired \source-command. It is convenient to use, provides a correct and unobtrusive placement, and works with show notes on second screen. It even supports multiple sources.

• This seems related to the use of the absolute option to the textpos package in combination with the use of pgfpages (which is internally used by beamer when you enable the option show notes on second screen), and this type of problem has come up repeatedly. – cyberSingularity Jan 6 '13 at 0:24

## Notes on textpos and pgfpages

When pgfpages is active, note that any textblocks positioned through use of the textpos package with the absolute option will most likely be incorrectly positioned, as witnessed here. I haven't entirely worked out what the positioning behaviour is though...

Also, you should be aware of other warnings that textpos emits in your MWE, even though they don't appear to influence the output in this case (these warnings can be avoided by ensuring there is a paragraph break immediately before the textblock environments):

Package textpos Warning: environment textblock* not in vertical mode.
(textpos)                Environment textblock* should not have any text
(textpos)                or printable material appearing before it.
(textpos)                Alignment may work out wrongly.

I therefore present a solution that doesn't rely on using textpos, and therefore has other advantages. Alternative options include use of textpos but only using relative positioning; in this case, one should ensure that all textblocks have their origins at fixed locations in the slide (else they may move as the slide content changes), and this is harder.

## Solution avoiding textpos

My idea is to use the footnote facilities instead (one can still keep the original formatting and it should interact well with multiple \sources and real footnotes). I have shrunk the height of the beamercolorbox used by \source and the distance between the footnotes:

\documentclass{beamer}
\usepackage{pgfpages}
\setbeameroption{show notes on second screen}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\setbeamercolor{framesource}{fg=gray}
\setbeamerfont{framesource}{size=\tiny}

\makeatletter
\renewcommand{\footnoterule}{}
\define@key{beamerfootnote}{nonumber}[true]{\edef\beamer@footarg{0}\def\@makefnmark{}}% have to set a number in \beamer@footarg, then it won't be automatically generated one. setting \@makefnmark to be empty means the number isn't printed. but only use this in a group else it affects following footnotes!
% instead of 'nonumber', could just use 0 as an optional argument to \footnote, but OP reports that keyval complains about this in some situations
% http://tex.stackexchange.com/questions/89539
\newcommand{\source}[1]{{\footnote[nonumber]{%
\begin{beamercolorbox}[right,wd=\dimexpr\hsize-1.8em\relax]{framesource}
\usebeamerfont{framesource}\usebeamercolor[fg]{framesource} Source: {#1}
\end{beamercolorbox}}}}
\setlength{\footnotesep}{0cm}%\footnotesep is the space between footnotes (generated with a \rule)
\makeatother

% inspired by [beamer: footnote text collides with navigation symbols](http://tex.stackexchange.com/a/5855)
\hspace*{0.1cm}\par\vskip 2pt}{}

\title{MWE}

\begin{document}

\begin{frame}{title}
a diagram
\footnote{a real footnote}%
\footnote{a real footnote}%
\source{some article or url}%
\source{some article or url}%
\footnote{a real footnote}%
\end{frame}

\end{document}

Note that the magic number 1.8em that needs to be removed from the width of the beamercolorbox (to avoid overfull \hboxes) is defined in the default beamer template for footnote, and this is the space reserved for the footnote number:

\defbeamertemplate*{footnote}{default}
{
\parindent 1em\noindent%
\raggedright
\hbox to 1.8em{\hfil\insertfootnotemark}\insertfootnotetext\par%
}