3

How can I access the frame label inside the frame?

I have a big master file with hundreds of slides and I would like to use slides from it in my other presentations using method described in how to include existing pdf slides into my beamer?. However, to easier track the slides in master file I would like to print the frame label on top of everything in the top right corner of the frame. I have not succeeded to find answer to my problem in this forum.

The example below is my attempt on working example but it puts just text 'frame-label' where I would like to see the real frame label.

\documentclass{beamer}
\usepackage[absolute,overlay]{textpos}

\addtobeamertemplate{headline}{}{%
\begin{textblock*}{3cm}(0\textwidth,0cm)%
        \tiny \textcolor{gray}{slide:frame-label}%
\end{textblock*}%
}

\begin{document}

%%%%%%% Frame 1
\begin{frame}[label=738473]{Frame1 title}
frame1 text
\end{frame}

%%%%%%% Frame 2
\begin{frame}[label=847242]{Frame2 title}
frame2 text
\end{frame}

\end{document}
  • Welcome to TeX.SX! Please add a fully compilable minimal working example (MWE) that illustrates your problem. – bodo Sep 5 '12 at 6:45
  • Welcome to TeX.SX. If you want to print the frame label for the master file you should first specify which is the Beamer theme adopted. – Claudio Fiandrino Sep 5 '12 at 7:06
  • Would some label descriptor macro be allowed in the frmetitle, or does it have to come from the frame's label? – Tom Bombadil Sep 5 '12 at 20:14
  • Sorry, I do not understand this. To make as little error as possible I imagine that I would like to have something like in my MWE, i.e. the frame label has to be entered only once, preferentially in the standard way. @TomBombadil – andris Sep 7 '12 at 6:18
1

My solution is not very robust but it works with your example (with a first frame without label).

\documentclass{beamer}
\usepackage[absolute,overlay]{textpos}

\makeatletter
\newcommand\insertlabelofcurrentframe{%
  \ifx\beamer@againname\@undefined%
  no label%
  \else%
  \beamer@againname%
  \fi%
}
\makeatother

\addtobeamertemplate{headline}{}{%
  \begin{textblock*}{3cm}(0\textwidth,0cm)%
    \tiny \textcolor{gray}{\insertlabelofcurrentframe}%
  \end{textblock*}%
}

\begin{document}

%%%%%%% Frame 0
\begin{frame}{No label...}

\end{frame}

%%%%%%% Frame 1
\begin{frame}[label=738473]{Frame1 title}
frame1 text
\end{frame}

%%%%%%% Frame 2
\begin{frame}[label=847242]{Frame2 title}
frame2 text
\end{frame}

\end{document}

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.