# How to better adjust placement of frametitle converted to marginpar in beamerarticle?

I'm using beamer and beamerarticle for my class notes. I would like to include frametitles as margin notes in <article> mode aligned with frame content but they are a little bit misplaced.

According to LaTeX reference manual

The \marginpar command creates a note in the margin. The first line of the note will have the same baseline as the line in the text where the \marginpar occurs.

So, I think this misalignment is produced because there is no line (frametitle disappears) to be used as reference. Do you know how can it be improved?

Previous example was obtained with next code

%\documentclass{beamer}
\documentclass{article}
\usepackage{beamerarticle}

\usepackage{lipsum}

\mode<article>{\setbeamertemplate{frametitle}{%
\marginpar{\insertframetitle\\%
\scriptsize\insertframesubtitle}}}

\begin{document}

\begin{frame}{Frame 1}
\lipsum[1]
\end{frame}

\begin{frame}{Frame 2}
\only<article>{\lipsum[3]}
\lipsum[2]
\end{frame}

\begin{frame}{This is a long frame title}
\lipsum[3]
\end{frame}

\end{document}


Instead of \marginpar you could use \marginnote from the marginnote package; this gives you the right position automatically:

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{marginnote}

\usepackage{lipsum}

\mode<article>{\setbeamertemplate{frametitle}{%
\marginnote{%
\if\insertframetitle\empty\relax
\else
\insertframetitle\newline%
\fi%
\scriptsize\insertframesubtitle}}}

\begin{document}

\begin{frame}{Title}{Subtitle}
\lipsum[1]
\end{frame}

\begin{frame}{}{Subtitle with no title}
\only<article>{\lipsum[3]}
\lipsum[2]
\end{frame}

\begin{frame}{This is a long frame title}
\lipsum[3]
\end{frame}

\end{document}


I also made change to the original definition, to produce a line break conditionally only if the title is provided.

It seem that margin notes are misplaced 5pt, so simply add \vspace{5pt} before \insertframetitle. However, it could better a relative space as \vspace{.44\baselineskip} since in this way could work also with other font sizes.

• How did you find this 5pt value? Is it somewhere documented? Did you find by trial and error? – Ignasi Aug 12 '13 at 12:35
• @Ignasi, First I was thinking that margin notes are displaced just one half of \baselineskip (6pt) but for some reason it is really something less, so I adjusted this manually. – Fran Aug 12 '13 at 15:18