5

In certain beamer themes, the frame number is displayed as No./tot in the bottom right corner, following the date. Since the frame number is not constant in width, this makes the date “move” from frame to frame, and that bugs me. (With the default font, I see it only when the number of digits changes. But with the cabin font which I am using, I see the effect at every frame change.)

I didn't want go into defining my own footline, but I can force the frame number to take a fixed width with a simple redefinition, commented out in this MWE:

\documentclass{beamer}

\usepackage[sfdefault]{cabin} % this makes the effect worse

\usetheme{Boadilla} % for footer

%% Proper formatting with:
%\let\ofn\insertframenumber
%\renewcommand{\insertframenumber}{\protect\makebox[1em]{\ofn}}

\begin{document}
\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\end{document}

This solves the problem I described, but creates another (minor) one: The page number as displayed in a PDF viewer is screwed up (it reads, e.g., “[1em]1”).

To be sure, I can live with that. At this point I am asking more out of curiosity than to solve a practical problem. Is there a better way to achieve the desired effect?

4

Use

\let\ofn\insertframenumber
\renewcommand{\insertframenumber}{%
  \texorpdfstring{\protect\makebox[1em]{\ofn}}{\ofn}%
}

so the box is used only for printing, while the naked number is used in the bookmarks.

Here's a possibly better idea:

\documentclass{beamer}

\usepackage[sfdefault]{cabin} % this makes the effect worse

\usetheme{Boadilla} % for footer

\makeatletter
\defbeamertemplate*{footline}{infolines theme changed}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \makebox[4em][r]{\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}}% 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother
%\setbeamertemplate{footline}[infolines theme changed]

\begin{document}
\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\begin{frame}{test}
\end{frame}

\end{document}
|improve this answer|||||

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.