13

I'm wondering how to change the vertical position of the text in a frametitle? Take for instance this frametitle:

enter image description here

I'd like to place the text, in this case "Introduction", a bit higher such that it is exactly in the vertical center.

\documentclass{beamer}
\usepackage{textpos}
\usepackage{tikz}

%remove navigation symbols
\setbeamertemplate{navigation symbols}{}

\definecolor{TUeRed}{RGB}{170,0,0}
\definecolor{TUeBlue}{RGB}{0,68,170}

\addtobeamertemplate{frametitle}{}{% 
\begin{textblock*}{100mm}(.95\textwidth,-1cm) \tikz {\fill[white] (0,0) -- %
(2cm,0) -- (2cm,1.1cm) -- (0.5cm,1.1cm) -- cycle;\node[TUeBlue] at %
(0.8cm,0.5cm) {\normalsize\insertpagenumber};} \end{textblock*} }

\setbeamercolor{frametitle}{bg=TUeRed}
\setbeamercolor{frametitle}{fg=white}

\begin{document}

\begin{frame}
\frametitle{Introduction}
Some text
\end{frame}

\end{document} 

[Edit] Changed the LaTeX code, thanks @Percusse!

11
  • As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again.
    – Tobi
    Commented Mar 20, 2012 at 10:51
  • Can you put a working example with two slides? I don't know where to obtain the textblock environment.
    – percusse
    Commented Mar 20, 2012 at 12:04
  • Which beamer theme are you using? Please add to your question a complete, minimal example (with only those relevant settings) of your document settings. Commented Mar 20, 2012 at 12:04
  • @percusse, it's from the textpos package. I'll add a working example. Gonzalo, I don't use a theme, I'm trying to create my own.
    – Ailurus
    Commented Mar 20, 2012 at 13:14
  • 3
    A look into the beamer sources (beamerouterthemedefault.sty, ll. 140-160) shows that the off-centering of the frame title is caused by inserted \struts (l. 150). If they were removed, the frame title would be exactly vertically centered. I strongly advise you, however, not to do that - different frame titles with different heights would wiggle around vertically, which would look rather horrible in a presentation!
    – diabonas
    Commented Mar 26, 2012 at 11:16

1 Answer 1

17

A look into the beamer sources (beamerouterthemedefault.sty, ll. 140-160) shows that the off-centering of the frame title is caused by inserted \struts (l. 150). If they were removed, the frame title would be exactly vertically centered. I strongly advise you, however, not to do that - it would either cause the height of the colored frame title box to change for different frame titles, or the title would wiggle around vertically (if you set the box to a fixed height). Both would look rather horrible in a presentation...

If you feel that all frame titles are a little too low and you want to raise them just a tiny bit, you can try something like

\addtobeamertemplate{frametitle}{\vskip-0.5ex}{}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .