1

Is it possible to patch \include to be overlay aware?

I tried known approaches without success.

MWE

\documentclass{beamer}

\newcommand<>{\includex}[1]{\only#2{\include{#1}}}                   % works
%\renewcommand<>{\include}[1]{\only#2{\beamerorginal{\include}{#1}}}  % does not work

\begin{document}

\include{testframe}
\only<handout:0>{\include{testframe}}   % works 
\includex<handout:0>{testframe}         % works
%\include<handout:0>{testframe}         % does not work

\end{document}

The test frame is simply:

\begin{frame}testframe\end{frame}
  • 1
    why do you want to use \include here (which implies a new page) rather than simply \input ? – David Carlisle Nov 24 '16 at 11:14
  • @DavidCarlisle Because I heavily use \includeonly and \excludeonly, to include or exclude frames and framesets and also a lot of hyperrefs. – Robert Seifert Nov 24 '16 at 13:13
  • probably something is possible but it would be more natural to use the <> within the file in that case. \foo<2> means put stuff in layer 2 in this frame but \include{foo} is \clearpage stuff \clearpage so <> seems the wrong level. that said you could obviously define\include to look for a < and if it sees one do \only<#1>{\originalinclude{#2}} for \include<#1>{#2}if that's what you need? – David Carlisle Nov 24 '16 at 14:56
  • @DavidCarlisle yes, the latter \include<#1>{#2} is my intention. – Robert Seifert Nov 24 '16 at 14:57

1 Answers1

2
\documentclass{beamer}

\let\originalinclude\include

\renewcommand<>{\include}[1]{\only#2{\originalinclude{#1}}}  % does not work

\begin{document}

\include{testframe}
\only<handout:0>{\include{testframe}}   % works 
\include<handout:0>{testframe}         % 

\end{document}
David Carlisle
  • 757,742