# Behaviour of frametitle with raisebox

See update below. The following problem occurred while I was trying to alter the frametitle in beamer. (Actually I want a picture in the Titlebar. I used a rule instead.)

\documentclass{beamer}
\usetheme{AnnArbor}

\setbeamercolor*{frametitle in title}{fg=red, bg=black}

\setbeamertemplate{frametitle}{%
\vspace{-0.165ex}
\mbox{%
\begin{beamercolorbox}[wd=\paperwidth, dp=1ex, ht=4.5ex, sep=1ex, colsep*=0pt]{frametitle in title}%
\usebeamerfont{frametitle}
\insertframetitle
\hfill
\raisebox{-1.75ex}[\ht\strutbox][-\ht\strutbox]{\rule{5ex}{5ex}}
\end{beamercolorbox}%
}%
}

\begin{document}

\begin{frame}
\frametitle{Hello}
Everythings fine here
\end{frame}

\begin{frame}%[fragile]
\frametitle{Can you see?}
DO
\end{frame}

\end{document}


So you can easily see that the red square representing the picture (I want it there) is shifted upwards on a fragile frame. I have no idea how fragile works (neither I have an idea about beamer but I was able to handle it so far.) Therefore I thought about an if-construct to figure out when fragil is on but... well there is no such construct available in user land...

Update: I just figured out, that the Problem has nothing to do with fragiles frames. It comes from letters with descender. So in fact I'm struggling to use \raisebox correctly.

-
 Is this a question? May I suggest you delete this question and ask again for specific help with \raisebox? – Will Robertson Dec 1 '10 at 7:09 I tidied up your question a bit, hope that's OK. – Hendrik Vogt Dec 1 '10 at 8:57

You are quite right, the problem comes from the descender of the "y" in "Can you see". (It's quite natural that you were puzzled and first thought fragile to be the culprit; I had a related question where I also didn't know what's happening. Juan A. Navarro called it "the dreadful Beamer's vertical alignment problem" ...)
Solution: Add a \strut to your frame titles, like this:
\frametitle{Hello\strut}

Then you see that the picture isn't shifted anymore. Now the picture is too high, but this can easily be solved by adapting the \raisebox{-1.75ex} of the picture.
 Hi thanks so much... Now i use the following code (if s.o. has a related prob) \usebeamerfont{frametitle} \insertframetitle\strut \hfill \raisebox{-2ex}[0pt][-\ht\strutbox ]{ \insertmylogo}  – bloodworks Dec 1 '10 at 9:20