I want to create a beamer template with a horizontal rule below every frame title.
The line should start just below the first letter of the title and extend until the very end of the frame.
Desired result:
The solution should be flexible enough to handle different font sizes and long titles spanning two lines. However, the vertical position of rule should not adapt to the height of the characters used in the frame title (e.g., whether or not the characters extend below to the baseline). To clarify:
To create a rule spanning the entire width of the frame, I use \makebox[\linewidth][l]{\rule{\paperwidth}{0.4pt}}, as suggested by others. An undesired side-effect of using \makebox is that it behaves differently from \hrule, e.g., it has a different height.
I solved the problem of fluctuating positioning of the rule by using \vphantom{g} in the frame title, but another solution might be more elegant.
\documentclass[t,9pt]{beamer}
\setbeamertemplate{frametitle}{%
\usebeamerfont{frametitle}\insertframetitle%
\vphantom{g}% To avoid fluctuations per frame
%\hrule% Uncomment to see desired effect, without a full-width hrule
\makebox[\linewidth][l]{\rule{\paperwidth}{0.4pt}}%
}
\begin{document}
\begin{frame}{Frame Title}
Frame contents.
\end{frame}
\end{document}
How do I get the desired result of a line below the frame title running until the right end of the frame?




hspaceyou added. However, omitting this, your answer solves my question, although I find a solution withleaderscleaner. – timothymctim Dec 11 '16 at 19:30\setbeamercolor{frametitle}{fg=DarkBlue,bg=White}:/ – Dog_69 Mar 24 '22 at 16:45\addtobeamertemplate{frametitle}{\vspace*{0pt}}{\vspace*{-12pt}{\rule{\textwidth}{0.8pt}}\vspace*{-5pt}}. The frame title appeared twice with your code. Since my partial solution works fine (so far), I'm not thinking about posting a separate question for the moment, although I might if I found some issues. Thank you for your interest. – Dog_69 Mar 25 '22 at 15:55