This gives you the ratio of the current page to total page number:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\def\insertframeratio{%
\pgfmathparse{\insertframenumber*100/\inserttotalframenumber}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% %
}
\def\insertpageratio{%
\pgfmathparse{\insertpagenumber*100/\insertdocumentendpage}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% %
}
\begin{document}
\begin{frame}
\frametitle{title 1}
\only<1>{
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\only<2>{
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\end{frame}
\begin{frame}
\frametitle{title 2}
\only<1>{
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\only<2>{
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\end{frame}
\end{document}
Just in case anybody might want to calculate the ratio for slides within a frame:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\def\insertframeratio{%
\pgfmathparse{\insertframenumber*100/\inserttotalframenumber}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% %
}
\def\insertpageratio{%
\pgfmathparse{\insertpagenumber*100/\insertdocumentendpage}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% %
}
\def\insertslideratio{%
\pgfmathparse{(\insertpagenumber-\insertframestartpage+1)*100/(\insertframeendpage-\insertframestartpage+1)}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% %
}
\def\insertslides{%
\pgfmathparse{\insertframeendpage-\insertframestartpage+1}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}%
}
\def\inserttheslide{%
\pgfmathparse{\insertpagenumber-\insertframestartpage+1}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}%
}
\begin{document}
\begin{frame}
\frametitle{title 1}
\only<1>{
Slide in Frame: \inserttheslide{} of \insertslides: \insertslideratio\\
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\only<2>{
Slide in Frame: \inserttheslide{} of \insertslides: \insertslideratio\\
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\end{frame}
\begin{frame}
\frametitle{title 2}
\only<1>{
Slide in Frame: \inserttheslide{} of \insertslides: \insertslideratio\\
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\only<2>{
Slide in Frame: \inserttheslide{} of \insertslides: \insertslideratio\\
Frames: \insertframenumber{} of \inserttotalframenumber: \insertframeratio\\
Page: \insertpagenumber{} of \insertdocumentendpage: \insertpageratio
}
\end{frame}
\end{document}
\the\c@ratio
, but this will print it with a trailingpt
(which is probably not what you want)You can't use '\unhbox' after \the. \end{frame}
%
or remove them.beamer@slidesinframe
. It can be shown with\the\beamer@slidesinframe