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 am trying to customize a beamer theme. In the footline, information such as author, title, date ... are in several beamercolorboxes.

\hbox{%
\begin{beamercolorbox}[wd=.70\paperwidth,ht=7.25ex,left,leftskip=2ex]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle{} - \insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.20\paperwidth,ht=7.25ex,center]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}
\end{beamercolorbox}
\begin{beamercolorbox}[wd=.10\paperwidth,ht=7.25ex,right,rightskip=2ex]{date in head/foot}%
    \insertframenumber{} / \inserttotalframenumber
\end{beamercolorbox}}%

I can easily manage the height and width of the box but the text is still completely at the bottom of the box. I would like this text to be vertically aligned.

How can I do that?

share|improve this question
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Werner May 17 '12 at 20:17
add comment

2 Answers 2

up vote 6 down vote accepted

You can set the depth of the boxes to a proper value using dp=<length>:

\documentclass{beamer}
\usetheme{Warsaw}

\setbeamertemplate{footline}{%
\hbox{%
\begin{beamercolorbox}[wd=.70\paperwidth,ht=4.25ex,dp=3ex,left,leftskip=2ex]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle{} - \insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.20\paperwidth,ht=4.25ex,dp=3ex,center]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.10\paperwidth,ht=4.25ex,dp=3ex,right,rightskip=2ex]{date in head/foot}%
    \insertframenumber{} / \inserttotalframenumber
\end{beamercolorbox}}%
}

\title{The Title}
\author{The Author}

\begin{document}

\begin{frame}
test
\end{frame}

\end{document}

enter image description here

Notice that you have a spurious blank space at the end of the second beamercolorbox; I removed that space in my example code.

share|improve this answer
    
Thank you it works. However, I do not understand this depth parameter. Is it a sort of z coordinate into the beamercolorbox? I thought that this depth was related to the layer of the page in order to manage stacking of several beamercolorbox. Are beamercolorbox really useful here ? Why beamer theme do not simply use parbox or other more simple box ? –  Ger May 18 '12 at 7:01
    
@Ger Please, don't forget to mark the answer that you consider best solved your problem as accepted (in case of doubt, please see How do you accept an answer?). Boxes in (La)TeX have three basic dimensions: width, height and depth (the meaning of the first two is obvious). (Cont.) –  Gonzalo Medina May 18 '12 at 13:06
    
@Ger The depth of a box is the distance betwee the baseline and the botoom of the box; think of the two characters "bg" the box for "b" has a depth of 0pt (there's no downwards strokes), but the depth of the box for "g" is positive (the length of the downwards strokes of the "g" below the baseline). –  Gonzalo Medina May 18 '12 at 13:07
    
@Ger beamercolorboxes are, in fact, built using simpler boxes but incorporating ready to use functionality (you can easily control the color, the width, depth, height, the margins, etc.). You could dispense with the use of beamercolorboxes and use only \parboxes or even \vboxes and \hboxes, but then your code would be too lengthy. –  Gonzalo Medina May 18 '12 at 13:10
add comment

The content of a beamercolorbox is typeset into a box. With the ht=<height> parameter, the height of this box is set to <height>, but the content stays at the bottom. You can use the sep=<dimension> parameter instead, which adds extra to every side of the box, thus centering the content. If you need to set a fixed height, however (which is quite reasonable for a footline), you can use an additional \vbox and \vfil inside the beamercolorbox, as described in this answer:

\documentclass{beamer}
\usetheme{Ilmenau}
\setbeamertemplate{footline}{%
\hbox{%
\begin{beamercolorbox}[wd=.70\paperwidth,ht=7.25ex,left,leftskip=2ex]{title in head/foot}%
    \vbox to7.25ex{\vfil\hbox{\usebeamerfont{title in head/foot}\insertshorttitle{} - \insertshortauthor}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.20\paperwidth,ht=7.25ex,center]{date in head/foot}%
    \vbox to7.25ex{\vfil\hbox{\usebeamerfont{date in head/foot}\insertshortdate{}}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.10\paperwidth,ht=7.25ex,right,rightskip=2ex]{date in head/foot}%
    \vbox to7.25ex{\vfil\hbox{\insertframenumber{} / \inserttotalframenumber}\vfil}%
\end{beamercolorbox}}%
}
\author{Author}
\title{Title}
\begin{document}
\frame{}
\end{document}

resulting footline

share|improve this answer
add comment

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.