# Problems with second beamer slide and displaying notes on second screen with XeLaTeX [duplicate]

I am trying to automatically add a slide to the end of a beamer presentation, but when I show notes on a second screen the text of that added slide does not appear on the slide. Here is a MWE:

% !TeX program = xelatex
\documentclass{beamer}

\AtEndDocument{
\begin{frame}{At End}
Goodbye.
\end{frame}
}

\usepackage{pgfpages} % must come after \AtEndDocument{...}
\setbeameroption{show notes on second screen} % (*)

\begin{document}
\begin{frame}{First Slide}
Hello.
\end{frame}

\end{document}


The above latex produces a PDF with the last slide having a title of "At End" but no text (i.e. "Goodbye." does not appear). Oddly, "Goodbye." does appear in the small copy of the slide that is displayed on the notes part.

For font reasons I must use xelatex, however this problem disappears when using pdflatex. Also if line (*) is commented out the problem disappears.

How can I make "Goodbye." appear on that last slide?

I am using XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017/W32TeX).

# Update (2018-04-02)

I have realized that this has nothing to do with \AtEndDocument. For example, the following seems closer to a true MWE:

% !TeX program = xelatex
\documentclass{beamer}

\usepackage{pgfpages}
\setbeameroption{show notes on second screen} % Both

\begin{document}

\begin{frame}
\end{frame}

\begin{frame}
%\color{black}
Sometimes disappears
\begin{itemize}
\item an item
\end{itemize}
\end{frame}

\end{document}


Note that this issue only appears if all of the following conditions are met:

• The document is compiled with xelatex (as opposed to pdflatex)
• Notes are displayed on the second screen
• The text that vanishes is on the second slide or later
• The text that vanishes is at the top level (and not in an itemize environment, for example)

As @samcarter points out it seems to be a foreground color issue since explicitly setting the foreground makes the text visible again. I found the following answer solved my problem: https://tex.stackexchange.com/a/306662/1078 (although it is clearly a bandaid).

## marked as duplicate by user36296 beamer StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Apr 2 '18 at 18:41

• Funny, using XeLaTeX I can reproduce your issue, but if I use pdfLaTeX or LuaLaTeX the last slide is shown correctly (but throws some warnings during compilation). – Skillmon Mar 29 '18 at 18:21

Interestingly the colour of the "Goodbye" is white, that's why you don't see it.

Workaround:

% !TeX program = xelatex
\documentclass{beamer}

\AtEndDocument{
\begin{frame}{At End}
\color{black}Goodbye.
\end{frame}
}

\usepackage{pgfpages} % must come after \AtEndDocument{...}
\setbeameroption{show notes on second screen} % (*)

\begin{document}
\begin{frame}{First Slide}
Hello.
\end{frame}

\end{document}


• That's perfect! Do you know why this happens? Is it a XeLaTeX bug, which should be reported? – banbh Mar 29 '18 at 21:10
• @banbh Seems to be related to xelatex, but I have no idea what might cause this problem. – user36296 Mar 29 '18 at 21:17
• I added an update explaining that what I thought was a MWE was not! It seems to happen on any slide after the first! – banbh Apr 2 '18 at 18:13