# \input{…} is ignored with beamer option ignorenonframetext

I'm using beamer to create my slides and wanted to use beamerarticle to create written paper which is not just printed slides 3 on 1 page.

The option ignorenonframetext for the beamer class forces it to ignore any text but \section{} etc. that is not inside a frame environment. This is intended for interaction with the beamerarticle class to edit all information (frames and additional text) at the same place.

Unfortunately the \input{} command is ignored as well, making it impossible to organize my document in the usual way, i.e. one file for any section for example.

Is there any additional option to activate this kind of "infrastructure" command in beamer?

Example

\documentclass[ignorenonframetext]{beamer}
%\documentclass{scrartcl} \usepackage{beamerarticle}

\usetheme{Goettingen}
\usecolortheme{crane}
\title{Test slides}
\author{Christoph Juengling}

\begin{document}
\maketitle
\begin{frame}
\titlepage
\end{frame}

\input{sec-one}

This is explaning text at the end of the first section.

\input{sec-two}

\end{document}


In this example, using the beamerarticle class all looks fine, but with the beamer class activated with the specified option, nothing but the title frame will be created. The two additional files do contain valid LaTeX code with frames!

-
As Vedran has commented in bitbucket.org/rivanvx/beamer/issue/130/…, this is a lot trickier than it looks! Catching the \input is fine, but ensuring that the correct mode continues after input is much more awkward. I'm a bit busy this weekend, but I will make an effort to sort this over the next few days. –  Joseph Wright Sep 24 '11 at 12:05
@JosephWright: Do you see any problems with my suggestion? –  Marco Daniel Sep 24 '11 at 12:26
@Marco Nothing wrong with it, but really this behaviour should be sorted at the class level. –  Joseph Wright Sep 24 '11 at 12:34
@JosephWright: But then you need two different input commands. One for input frame and one for input text. –  Marco Daniel Sep 24 '11 at 12:58
@Macro I'm quite sure I follow: \input should always include the referenced file as though it was 'typed in here'. –  Joseph Wright Sep 24 '11 at 13:06

In the documentation of beamer on pages 211 and 212 you find the explanation and also an example. To use input or inlcude with the option ignorenonframetext you must enable ignorenonframetext for this part. \mode* is equivalent to the option ignorenonframetext. You can enable it with \mode<all> or \mode<presentation>. Here an example:

\RequirePackage{filecontents}
\begin{filecontents}{sec-one.tex}
\begin{frame}
\frametitle{sec one}
foo
\end{frame}
\end{filecontents}
\begin{filecontents}{sec-two.tex}
\begin{frame}
\frametitle{sec two}
foo
\end{frame}
\end{filecontents}

\documentclass[ignorenonframetext]{beamer}
%\documentclass{scrartcl} \usepackage{beamerarticle}

\usetheme{Goettingen}
\usecolortheme{crane}
\title{Test slides}
\author{Christoph Juengling}

\begin{document}
\maketitle

\begin{frame}
\titlepage
\end{frame}
\mode<all>
\input{sec-one}
\mode*
This is explaning text at the end of the first section.

\input{sec-two}

\end{document}

-
As far as I understand this, (1) every input command has to be bracketed with \mode<all> ... \mode* and (2) the additional text must be between a \mode* and the next \mode<all> on the highest level! –  Christoph Jüngling Sep 24 '11 at 14:01
@ChristophJüngling: With the option ignorenonframetext you set \mode* global. To use input you must deactivate \mode*. This is done by \mode<all>. Now no text will be ignored. But you want to use the option ignorenonframetext further so you must activate \mode*. I hope you understand my English ;-) –  Marco Daniel Sep 24 '11 at 14:05
There is no problem with your english, and I quite understand the mechanisms behind this a little better now. My previous knowledge was that \input just inserts the file's content as if it were written here. Your solution doesn't solve my whole problem, because commented text between frames in an \inputted :-) file is nevertheless printed on a slide, too. –  Christoph Jüngling Sep 24 '11 at 14:12
@ChristophJüngling: In the link documentation you find the following sentences: The difference is that the text is now read token-wise, not line-wise. The text is gobbled token by token until one of the following tokens is found: \mode, \frame, \againframe, \part, \section, \subsection, \appendix, \note, \begin{frame}, and \end{document} –  Marco Daniel Sep 24 '11 at 14:19
I read some more in the beamer's documentation, and I suppose that \mode<article>{Extra detail mentioned only in the article version.} would do the job best for me. I can place this in any position between frames and in files that are read via \input, and for the moment, this looks very good. Ok, it's some extra stuff to type, but that's quite ok. –  Christoph Jüngling Sep 24 '11 at 14:54