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

I tried known approaches without success.



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


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


The test frame is simply:

  • 1
    why do you want to use \include here (which implies a new page) rather than simply \input ? Commented Nov 24, 2016 at 11:14
  • @DavidCarlisle Because I heavily use \includeonly and \excludeonly, to include or exclude frames and framesets and also a lot of hyperrefs. Commented Nov 24, 2016 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? Commented Nov 24, 2016 at 14:56
  • @DavidCarlisle yes, the latter \include<#1>{#2} is my intention. Commented Nov 24, 2016 at 14:57

1 Answer 1



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


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

  • Great! Works perfectly with \input{}too (replace every instance of clude by put).
    – PatrickT
    Commented Jun 1 at 0:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .