[Tex/LaTex] How to modify the Beamer footline in a way that doesn’t change positioning of contents/sidebar

beamerheader-footer

I've started with the basic Berkeley theme in Beamer. I wanted to modify the footer to include the page numbers that are centered on the slide. However, the modified footline element seems to be "stacked" at the bottom of the slide, which shifts slide content up and cuts off the bottom corner of the sidebar.

I want the slide to look exactly like the basic theme with just the page numbers pasted at the bottom, centered. I want the sidebar to extend all the way to the bottom of the slide. What do I have to modify to get this done?

Example code:

\documentclass{beamer}
\usetheme[width=2.0cm]{Berkeley}

%% **this part modifies footline to include slide numbers**

\setbeamertemplate{footline}{%
 \leavevmode%
 \hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{frame number}%
 \vskip0pt
   \usebeamerfont{footline}\usebeamercolor[fg]{footline}\insertframenumber/\inserttotalframenumber
 \vskip0pt
\end{beamercolorbox}%
}%
 \vskip0pt%
}

\usepackage[utf8]{inputenc}

\title{Sample title}
\author{Anonymous}
\institute{ShareLaTeX}
\date{2013}

\begin{document}

\frame{\titlepage}

\begin{frame}
\frametitle{Sample frame title}
This is a text in first frame. This is a text in first frame. This is a text in first frame.
\end{frame}

\end{document}

enter image description here

Best Answer

You can set ht=0pt, dp=0pt so that the beamercolorbox has zero height. Then, adjust the second \vskip to raise the page numbers from the bottom edge. To remove navigation bar, simply use \setbeamertemplate{navigation symbols}{}, and this does not affect the page numbering.

Code

\documentclass{beamer}
\usetheme[width=2.0cm]{Berkeley}

%% **this part modifies footline to include slide numbers**
\setbeamertemplate{footline}{%
  \leavevmode%
  \hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=0ex,dp=0ex,center]{frame number}%
    \vskip0pt
    \usebeamerfont{footline}\usebeamercolor[fg]{footline}
    \insertframenumber/\inserttotalframenumber
    \vskip.5ex
    \end{beamercolorbox}%
  }%
  \vskip0pt%
}
% \setbeamertemplate{navigation symbols}{} % to remove navigation bar


\usepackage[utf8]{inputenc}

\title{Sample title}
\author{Anonymous}
\institute{ShareLaTeX}
\date{2013}

\begin{document}

\frame{\titlepage}

\begin{frame}
\frametitle{Sample frame title}
This is a text in first frame. This is a text in first frame. This is a text in first frame.
\end{frame}

\end{document}

Output

enter image description here