[Tex/LaTex] Frame label in the right top corner of slide

beamerlabels

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}

Best Answer

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}