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.

How can I customise the headline of my slides in order to have some white space above and below the title of the frame?

I guess I should change the template with the following instruction: \setbeamertemplate{headline}

but how?

Thanks in advance

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

From your description, it's not clear (at least to me) which template you need to modify; headline or frametile. Anyways, you can use \addtobeamertemplate to add the spacing before (using the first argument) and after (using the second argument) the headline or frametitle template; a little example (of course, instead of 1cm you can use the desired length):

\documentclass{beamer}
\usetheme{Warsaw}

\addtobeamertemplate{frametitle}{\vspace*{1cm}}{\vspace*{1cm}}

\begin{document}

\begin{frame}
\frametitle{Test Frame}
test
\end{frame}

\end{document}

enter image description here

After the new requirement made in a comment, a redefinition of the frametitle template (as defined in beamerouterthemeshadow,sty since the theme used is Warsaw) is needed:

\documentclass{beamer}
\usetheme{Warsaw}

\makeatletter
\setbeamertemplate{frametitle}
{%
  \nointerlineskip%
  \vskip-2pt%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip.50ex% NEW: original \vskip-.75ex
          \leftskip0.3cm%
          \rightskip0.3cm plus1fil\leavevmode
          \insertframetitle%
          \ifx\insertframesubtitle\@empty%
            \strut\par%
          \else
            \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par\vskip2ex}% NEW: added \vskip2ex
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \nointerlineskip
    \vskip-0.2pt
    \hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
    \vskip-2pt
}
\makeatother
\addtobeamertemplate{frametitle}{\vspace*{1cm}}{\vspace*{1cm}}


\begin{document}

\begin{frame}
\frametitle{Test Frame Title}
\framesubtitle{Test Frame Subtitle}
test
\end{frame}

\end{document}

enter image description here

The lines that were changed are signaled in the code with % NEW; there you can adjust the lengths according to your needs.

share|improve this answer
    
thks so much...exactly what I needed!just another quick question: I'd also like to have some space in the headline around the word (e.g. Test Frame in your slide) so that the size of font is the same but the height of the headline is bigger...how can I do that? –  Matteo Dec 3 '12 at 22:02
    
@Matteo this probably requires a redefinition of the template itself; which theme are you using? –  Gonzalo Medina Dec 3 '12 at 22:05
    
\usetheme{Warsaw}, since I'm kind of a newbie in the beamer package, could you point me out some useful links on the redefinition of templates? –  Matteo Dec 3 '12 at 22:06
    
@Matteo I updated my answer with the needed redefinition; regarding your question, I am not aware of a document explaining the redefinition of templates (the beamer documentation contains some explanations, but at a basic level); for more sophisticated changes you need to look at the original code of the templates and made the necessary changes. –  Gonzalo Medina Dec 3 '12 at 22:19
    
you helped me a lot, thanks... I'll check and let you know if I have doubts... ;) –  Matteo Dec 3 '12 at 22:29
show 1 more 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.