usebackgroundtemplate after section

I am attempting to insert a full-page figure into my slides, see the MWE below.

The first experience, that 'Title' and 'subtitle' appear at their normal position. With the option 'plain' I expected to not appear.

The second one, that if I uncomment the 'section' command, I do have an extra slide, with section 'title' as frame title, on the top of the background figure, although the template is local. Do I misunderstand something?

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\begin{document}

%\section{sec}{title}
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{YourFigureHere}}%
\begin{frame}[plain]{Title}{Subtitle}
\end{frame}
}

\end{document}
• For the first question, in the beamer manual, section 8.1: "plain causes the headlines, footlines, and sidebars to be suppressed". Titles and subtitles are not in those suppressed areas. – Mike Renfro Jan 24 '15 at 18:38
• And as for your second question: this only happens if you give superfluous arguments to section. Try \section{title} or \section[sec]{title} instead – user36296 Jan 24 '15 at 19:18
• And for your first question: it sounds that you do not want the title and subtitle to appear on the slide? Then just do not define them \begin{frame}[plain] \end{frame} – user36296 Jan 24 '15 at 19:24
• @samcarter Concerning title and subtitle for frame, I could not figure out when the first items of the frame content will be taken for title and subtitle. Yes, the first brackets should be squared. But, even in that case, the {title} should be taken as an independent text, outside frame; and also the figure is local; so I did not expect to double it, anyhow. – katang Jan 24 '15 at 21:02
• @katang When you do not give a frametitle it remains empty and will not take anything from the frame content. You can try yourself with  \begin{frame} b \insertframetitle \end{frame} – user36296 Jan 24 '15 at 21:45

The template is local. But the frame on which the stray text appears is not complete when the group containing the template specification opens. So the template is set while material is being collected for that frame. When you start the next frame properly, the previous one is finished and shipped out with the background template.

If you add stray text following the frame, but before the group is closed, you can see the reverse effect. The stray text is put into a new frame. At this point, the background is active. However, the group is closed while material is still being collected for the frame. So the background setting is switched off while that material is being collected. When the next frame begins outside of the local group, the previous frame is ended and the frame is shipped out with the current, default background template.

This is easier to show than to explain...

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\begin{document}

\section[sec]{title}
\color{blue!75!white}
This text is lost, so \texttt{beamer} starts a new frame (1) to collect the stray material.

\dots collecting material for frame 1\dots

{
\alert{A local group is started while material is being collected for frame 1.}

\usebackgroundtemplate{\includegraphics[width=\paperwidth]{example-image-a}}
\alert{The background template is changed, limited by the local group.}

When \texttt{beamer} is told to begin the \emph{next} frame i.e.\ frame 2, it will have to end this one, frame 1.

Frame 1 will be shipped out with the current, local background.

\begin{frame}[plain]{Title}{Subtitle}
This is frame 2. This text is where it should be. This frame begins and ends within the local group, so it will be shipped out with the current, local background.
\end{frame}
This is some more lost text, so \texttt{beamer} will try to find it a home.

Since no frame is currently in progress, a new frame, frame 3, will be started and material will be collected.

\alert{At this point, the local background is still in place\dots but frame 3 is not yet complete\dots}
}

\alert{Now we are outside the local group, so the background is reset to the default.}

When frame 4 is started, \texttt{beamer} will finish frame 3 and ship it out with the current, non-local background.
\begin{frame}[plain]{Another Frame}
This is frame 4. This frame begins and ends outside the local group so it will be shipped out with the non-local background now current.
\end{frame}

\end{document}