I have a problem with latex ignoring text after \mode<presentation> or \mode<article> was set.

MWE description

I have a large document that changes modes often, and I also \include some more latex files. I've reduced it to the following MWE.




  1. Text without a mode being set. This should be shown
     in both presentation and article mode.

      2. This is text inside a frame. It should only appear in presentation

    3. Text outside a frame. Only in article.



With the file in.tex closely following the example in the beamer user guide ver. 3.26, p. 210

4. This is some text outside a frame. Shouldn't be shown in presentation mode.

  5. This is text inside a frame. This is expected to show in article mode.


Problem description

There are two cases to be considered here, compiling with \documentclass{beamer}, or with \documentclass{article} and \usepackage{beamerarticle}.

As I understand the relevant documentation, I should get the results as described in the body of the MWE. Instead, I get the following:

  • Case "article"

    • Everything after \mode<presentation> seems to be ignored. I get a single page with sentence 1. Switching back to \mode<article> does not produce sentence 3, and the \include command does not seem to be processed.
  • Case "beamer"

    • Sentence 1. and 2. get typest, the included file is ignored, even though it should be processed in all modes.

Experimentation with the third flavour of the mode command and ignorenonframetext has yielded the same results, please see the output here and here (can't include directly due to lack of reputation). I am using the second mode flavour for \include to work, and because I need to do fancy things like set backgrounds on some slides.


What am I missing here? As far as I can tell I have structured the document correctly. Am I misunderstanding how modes are set and processed? Is this a bug in beamer or beamerarticle? I would like to achieve the result as described in the MWE.

I am compiling this document on Arch Linux with texlive 2012, which at the moment represents rev. 28273.

  • 1
    Do you have those spaces at the start of the line before \mode in your document? As the manual says, the line has to consist of \mode or \mode* alone for 'change mode' command to work. Also, I think you want \input not \include.
    – Joseph Wright
    Commented Feb 7, 2013 at 9:23
  • @JosephWright My guess is that \include will be needed for a more complex document e.g. because article mode ignores \includeonlylecture.
    – fheub
    Commented Feb 7, 2013 at 9:43
  • 1
    @JosephWright Thank you! That was exactly what was wrong with it. I've re-read that section of the manual probably 10 times and saw the remark about how not even a comment was allowed, but that whitespace would also screw it up never even crossed my mind. If you want to convert your comment to an answer, I'll happily accept it, otherwise I'll just type it up myself. @fheub I do actually have \input in my main document, so that I can \include further stuff from there. That just got lost somewhere in creating the MWE and cross-checking with the userguide, where they use \include.
    – halcyon
    Commented Feb 7, 2013 at 10:09

1 Answer 1


When using the \mode command in the 'ongoing' sense (without a braced argument), the command has to be on a line on its own with no comments or whitespace. This is becuase the line needs to be compared 'verbatim-like' with the check value. Thus

Some text

will work but

Some text

will fail. (\mode* is also allowed, but again with nothing else on the line.) The example in the question works correctly if the whitespace is tidied up.

  • Facing the same issue, I figured out that the mode specification must be on the next line. You cannot simply write \mode<all> you have to write \mode[linebreak here]<all>.
    – Ger
    Commented Feb 6, 2023 at 11:01

You must log in to answer this question.

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