6

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?

8

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.