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 interested in having a local change to the default theme of beamer.

I want every title in the beginning of a slide to be boldfaced, black (instead of purplish, black) with a horizontal line that stretches below it, with some margin between the line and the end points of the slide.

Is that possible to do with beamer?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

One option would be to set the frametitle template to add the horizontal rule; something along these lines:

\documentclass{beamer}

\setbeamertemplate{frametitle}{\color{black}\bfseries\insertframetitle\par\vskip-6pt\hrulefill}

\begin{document}

\begin{frame}
\frametitle{Test title for the frame}
\end{frame}

\end{document}

enter image description here

To keep the exact formatting of the original frametitle template, you can change the default definition (I wasn't sure about the position of the rule in the case of a frame subtitle, so I opted for placing the rule below a possible frame subtitle; this can be easily modified):

\documentclass{beamer}

\makeatletter
\setbeamertemplate{frametitle}
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,left,wd=\the\@tempdima]{frametitle}
    \vbox{}\vskip-1ex%
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    {\strut\color{black}\bfseries\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1.5ex%
    \rule{\dimexpr\paperwidth-0.6cm\relax}{0.4pt}}
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
    %
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{Test title for the frame}
\end{frame}

\end{document}

enter image description here

share|improve this answer
    
that's great, thanks! –  kloop Nov 16 '12 at 3:23

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.