3

The following code

\documentclass{beamer}
\pagestyle{headings}

\begin{document}
\begin{frame}
Hello beamer world.
\end{frame}
\end{document}

gives me

! Undefined control sequence.
<argument> \undefinedpagestyle 

while

\pagestyle{empty}

and

\pagestyle{plain}

work fine. Any ideas on how to solve this? Thanks in advance.

3
  • 1
    Remove line 2 with the \pagestyle{headings} command. It makes no sense to use that in beamer. (Don't use \pagestyle at all here - it doesn't make any sense.)
    – cfr
    Jul 21, 2015 at 20:48
  • There is a difference between the pagestyles empty and plain and no pagestyle at all. I want to have a heading telling the viewer which section the current slide belongs to. I thought this could be the way to go. Jul 21, 2015 at 20:51
  • Have you... er... looked at Beamer's documentation at all? Pick a theme and use that.
    – cfr
    Jul 21, 2015 at 20:54

2 Answers 2

2

The pagestyles empty and plain are defined by default, see latex.ltx:

\def\ps@empty{%
  \let\@mkboth\@gobbletwo\let\@oddhead\@empty\let\@oddfoot\@empty
  \let\@evenhead\@empty\let\@evenfoot\@empty}
\def\ps@plain{\let\@mkboth\@gobbletwo
     \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\thepage
     \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}

where \ps@headings is not. For instance, the standard classes (article.cls, report.cls and book.cls) define this. Hence, you can't use it in beamer.

Apart from that it does not makes sense to use \pagestyle as headers/footers are built differently here. You should just cancel it out to fix your code.

4

beamer is not a standard class: it is a specialist class for making presentations. As such, you cannot expect that all of the standard LaTeX commands will do something appropriate or, even, be recognised.

The class provides a wide range of customisation options, including overall themes, inner themes, outer themes, font themes, colour themes and templates. Look at the documentation and/or around this site for examples.

Here is just one:

\documentclass{beamer}
\usetheme{Berlin}% overall theme: inner, outer & colours
\title{Title}
\subtitle{Sub-Title}
\author{Author}
\institute{Institute}
\begin{document}
  \begin{frame}
    \titlepage
  \end{frame}
  \section{Section}
  \begin{frame}
    Hello beamer world.
  \end{frame}
\end{document}

Berlin theme

3
  • Better answer, more to the point and containing pictures and no upvotes? I alsways knew, that voting system is scrap.
    – Johannes_B
    Mar 21, 2016 at 12:22
  • Perhaps, but I took 10 minutes longer to write it ;). The other answer does explain why plain and empty work. Though I admit that wasn't the question....
    – cfr
    Mar 21, 2016 at 13:43
  • The two answers are somewhat complementary. The accepted one gives more reason, yours gives a constructive example. Both state the most important: don't use pagestyle in beamer class. Thanks! upvote Dec 14, 2017 at 14:24

You must log in to answer this question.

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