Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 http://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:

This answer to another question might contain the answer.

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.

share|improve this question
1  
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

1 Answer 1

up vote 2 down vote accepted

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)
\addtobeamertemplate{sidebar right}{\setbeamertemplate{navigation symbols}{}}{}
\addtobeamertemplate{footline}{\hfill\usebeamertemplate***{navigation symbols}%
    \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}

illustration of output

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

Other notes about pgfpages

Note that other considerations also apply when using pgfpages (even if indirectly), such as page numbers etc. The main advice is to fully compile the document without pgfpages active, then activate it and compile again with \nofiles invoked also.

share|improve this answer
    
Thanks for this suggestion! Not in the MWE, but in my document, this generates "Package xkeyval Error: '0' undefined in families 'beamerfootnote'.", do not yet know why. (The possibility for several sources is good, but their space is fixed at a rather large value, which is too small for two (or even three) line sources. Not dramatic.) –  Thomas Jan 6 '13 at 21:54
    
@Thomas: I am not sure why you get that error either, I have edited the code to use a different approach that might avoid it, and have also reduced the spacing between the sources as requested. –  cyberSingularity Jan 6 '13 at 22:56
    
Thanks again! No error left. Looks good, more tests tomorrow. (Note: using this version of source within a caption of a figure causes a missing-number-treated-as-zero-error.) –  Thomas Jan 6 '13 at 23:30
    
@Thomas: I have been unable to reproduce the error you describe when using \source inside a figure \caption. Perhaps you are loading some other packages that interfere with beamer's floats, or otherwise referring to the captions somewhere, eg in a list of figures? –  cyberSingularity Jan 7 '13 at 0:21
    
The error apparantly appears when using \usepackage{caption} \captionsetup{labelformat=empty,labelsep=none}. Is it possible to achieve suppress the "Figure :" with beamer commands? –  Thomas Jan 9 '13 at 22:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.