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.

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...

thx for comments!

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.

share|improve this question
    
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

1 Answer 1

up vote 1 down vote accepted

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}
\frametitle{Can you see?\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.

share|improve this answer
    
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

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.