2

I want to place a line of text at the top of a frame (above the frame title and default frame headline} such as:

\begin{frame}
    My top of frame text
    \frametitle{My title}
    My frame body
\end{frame}

but beamer automatically reformats. Do you have any suggestions? Thanks.

  • Is this meant to be how you want all of your slides to be arranged or a hack for a specific slide? – Bordaigorl Oct 2 '14 at 15:32
1

Here, I added a left-aligned \smashed stack on top of the frame title. It appears to have the same spacing as when the \frametitle is merely plain text. Having a full MWE from the OP would have helped to understand if this approach is adequate.

\documentclass{beamer}
\usepackage{stackengine}
\renewcommand\stackalignment{l}
\begin{document}
\begin{frame}
    My top of frame text
%\frametitle{My title}
    \frametitle{\stackon{My title}{%
      \smash{\scriptsize extra text above the frame title}}}
    My frame body
\end{frame}
\end{document}

enter image description here

  • Unfortunately I am unable to download the stackengine package. – guest Oct 2 '14 at 14:24
  • @guest It can be found at ctan.org/pkg/stackengine. Putting the .sty file in your working directory should allow compilation, though in the long term, it should be added to your local installation directory. Documentation is available at the site, too. – Steven B. Segletes Oct 2 '14 at 14:56
1

This is a "native" Beamer solution:

\documentclass{beamer}

\makeatletter
\newenvironment{myframe}[2][c]{%
    \addtobeamertemplate{frametitle}{\hskip-.7\beamer@leftmargin\scriptsize #2\vspace*{-.2cm}}{}
    \begin{frame}[#1]%
}{%
    \end{frame}
}
\makeatother

\begin{document}
\begin{myframe}{text above}
\frametitle{frame title}
\end{myframe}

\begin{frame}
\frametitle{frame title}
\end{frame}
\end{document}

enter image description here

Basically this creates a custom frame environment which embed a patched frametitle template. This way you can call the myframe whnever you want the text above title and the default frame when you don't.

If needed the patching can be made global (just remove the newenvironment).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.