beamerarticle - problem with commands in sections

I encountered the following problem with the beamerarticle package. If I use commands like \textit{} I get the following error massage:

./test.tex:7: Argument of \@sect has an extra }.
<inserted text>
\par Runaway argument?
{\normalfont \Large \bfseries }{\beamer@sortzeroread {\beamerx@\textit \ETC.
./test.tex:7: Paragraph ended before \@sect was complete.
<to be read again>
\par
l.7 \section{Test \textit{test} test}

?
l.7 \section{Test \textit{test} test}

?


Here is a minimal example:

\documentclass{article}
\usepackage{beamerarticle}
\begin{document}
\section{Test \textit{test} test}
\end{document}


Without the package or without the \textit{} the example works. Furthermore, if I use an optional argument in the section, it works as well, but if it contains any formatting commands. That is,

\section[\textit{test}]{Test \textit{test} test}


works, while

\section[test]{Test \textit{test} test}


doesn't.

Any ideas what is going on here or how to solve it?

-
This is a fragile command in a moving argument you need \protect\textit –  David Carlisle Apr 18 '12 at 12:47
@DavidCarlisle \textit is supposed to be robust: \show\textit produces \protect \textit  . But beamerarticle changes it into \beamer@sortzero{\beamerx@\textit}. :( –  egreg Apr 18 '12 at 12:51
Closely related question: error with bold font in section title with beamer. –  diabonas Apr 18 '12 at 17:05

While the \textit command is normally robust and doesn't need protection in moving arguments (which are the arguments to \section and siblings, \caption and some others), with the beamerarticle package it is not robust any more.

So the answer is, with that package

\section{Test \protect\textit{test} test}


or, if you use the command in the optional argument,

\section[Test \protect\textit{test}]{Test \textit{test} test}


(the moving argument is the mandatory one, if the optional argument is missing, otherwise the optional argument).

Also the other font changing commands are not robust any more.

Note: I'm inclined to consider this a bug of beamerarticle (or beamer in general), as it's not mentioned in the user manual, while LaTeX user guides tell that \textit is OK in moving arguments.

-
Thanks a lot! That helped. –  Daniel Apr 18 '12 at 19:04