Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Welcome to TeX.SX! To mark code samples, you can indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it, not the "quote" button with quotation mark). –  Kevin C Jan 23 at 23:00
    
Do you want the page numbers to be on the same line as the navigation symbols? If so, you can set ht=0pt, dp=0pt in the beamercolorbox, and set the second \vskip.5ex. –  Kevin C Jan 23 at 23:06
    
In this minimal example, I left the navigation symbols in. In my actual version, I have removed them. Ideally, I'd like the solution to include the option of either having them or not; however, if they are included, they should be on the same line to minimize wasted space. –  user44666 Jan 23 at 23:09

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Thank you. This works as I had wanted. Therefore, I'll accept this as my solution. However, I'm a brand new beamer user and relatively new LaTeX/TeX user. Even though your answer is the simplest given my starting point, is there a more elegant solution to my problem rather than drawing boxes of zero height? It just seems kind of hack-ish, and I want to make sure I'm learning the right mechanisms for accomplishing the layout I want. –  user44666 Jan 23 at 23:31
    
@user44666 In fact, I would call Kevin C's solution elegant: other solutions might be longer and not as simple as his. Using boxes width zero height can be a very useful resource. –  Gonzalo Medina Jan 23 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.