I am creating lecture notes and slides simultaneously using beamerarticle. In beamer, I'm using a theme called Berlin which puts all section titles in the slide header. Because some section titles are long and don't fit, I have specified short titles such as:
\section[short title 1]{First Section's Full Title}
The short titles now appear in the slide header. However, this has an undesirable effect on the article: by default the short section titles now show up in the article's table of contents.
I read this, and so tried using \sectionmark instead as follows:
\section{First Section's Full Title}
\sectionmark{short title 1}
However, beamer does not recognize sectionmark and now reverts to putting the full section titles in the slide header.
It seems to me that I need to somehow edit the default options of either the table of contents in the documentclass article, or the Berlin theme in beamer. Unfortunately I am quite new to LaTeX and have no idea how to do either. Help appreciated.
Among the packages I am using are titlesec and tocloft, but my problem occurs regardless of whether the packages are in use, thus I have commented them out in the minimal working example below. The code for the m.w.e. needs to be saved as three separate tex files in the same folder, as specified below. Compile example.article.tex and example.beamer.tex, not example.tex
%NOTE: The following should be saved as example.article.tex:
\documentclass{article}
\usepackage{beamerarticle}
\input{example.tex}
%NOTE: The following should be saved as example.beamer.tex:
\documentclass[ignorenonframetext]{beamer}
\input{example.tex}
%NOTE: The following should be saved as example.tex:
%\mode<article>{
% \usepackage{tocloft}
% \usepackage[compact]{titlesec}
%}
\mode<presentation>{\usetheme{Berlin}}
% everyone:
\usepackage[english]{babel}
\begin{document}
\begin{frame}
\title{Title}
\maketitle
\end{frame}
\begin{frame}{\only<presentation>{Outline}}
\setcounter{tocdepth}{1}
\tableofcontents
\end{frame}
\section[short title 1]{First Section's Full Title}
%\sectionmark{short title 1}
\begin{frame}{First Frame}
Blah blah text
\end{frame}
\begin{frame}{Second Frame}
Blah blah text 2
\end{frame}
\section[short title 2]{Second Section's Full Title}
%\sectionmark{short title 2}
\begin{frame}{Third Frame}
Blah blah text 3
\end{frame}
\end{document}

